- title: Scheduled Task Creation
id: 92626ddd-662c-49e3-ac59-f6535f12d189
status: experimental
description: Detects the creation of scheduled tasks in user session
author: Florian Roth
logsource:
category: process_creation
product: windows
service: null
detection:
selection:
Image: '*\schtasks.exe'
CommandLine: '* /create *'
filter:
User: NT AUTHORITY\SYSTEM
condition: selection and not filter
fields:
- CommandLine
- ParentCommandLine
tags:
- attack.execution
- attack.persistence
- attack.privilege_escalation
- attack.t1053
- attack.s0111
- car.2013-08-001
falsepositives:
- Administrative activity
- Software installation
level: low
In [ ]:
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
import pandas as pd
In [ ]:
es = Elasticsearch(['http://helk-elasticsearch:9200'])
searchContext = Search(using=es, index='logs-*', doc_type='doc')
In [ ]:
s = searchContext.query('query_string', query='((process_path.keyword:*\\schtasks.exe AND process_command_line.keyword:*\ \/create\ *) AND (NOT (user_account:"NT\ AUTHORITY\\SYSTEM")))')
response = s.execute()
if response.success():
df = pd.DataFrame((d.to_dict() for d in s.scan()))
In [ ]:
df.head()