LoFP LoFP / false positives are not expected as building a scheduled task xml definition through echo on the command line is rare in legitimate software. some custom installers or administrative scripts that generate task definitions this way may trigger this detection. filter as needed based on the parent process.

Techniques

Sample rules

Windows Scheduled Task XML Built Via Console Echo

Description

The following analytic detects cmd.exe being used to write a Windows Scheduled Task XML definition to disk through the echo command. This analytic focuses on command lines that combine echo with the Task Scheduler XML namespace. This is a significant activity because legitimate software rarely assembles a task definition on the fly from the console. Browser hijackers and adware droppers do this to create a scheduled task, through schtasks.exe and the generated XML file, that periodically relaunches a copy of themselves, and then delete the XML file to hinder forensic analysis. If confirmed malicious, this could allow an attacker to establish persistence, repeatedly execute a payload and maintain control over the victim’s browser.

Detection logic


| tstats `security_content_summariesonly`
  count min(_time) as firstTime
        max(_time) as lastTime

from datamodel=Endpoint.Processes where

(
    Processes.process_name=cmd.exe
    OR
    Processes.original_file_name=Cmd.Exe
)
Processes.process="*echo *"
Processes.process="*Task version=*"
Processes.process="*xmlns=\"http://schemas.microsoft.com/windows/*"

by Processes.action Processes.dest Processes.original_file_name Processes.parent_process
   Processes.parent_process_exec Processes.parent_process_guid Processes.parent_process_id
   Processes.parent_process_name Processes.parent_process_path Processes.process Processes.process_exec
   Processes.process_guid Processes.process_hash Processes.process_id Processes.process_integrity_level
   Processes.process_name Processes.process_path Processes.user Processes.user_id Processes.vendor_product


| `drop_dm_object_name(Processes)`

| `security_content_ctime(firstTime)`

| `security_content_ctime(lastTime)`

| `windows_scheduled_task_xml_built_via_console_echo_filter`