Bitsadmin Download

Detects usage of bitsadmin downloading a file

Rule Content

- title: Bitsadmin Download
  id: d059842b-6b9d-4ed1-b5c3-5b89143c6ede
  status: experimental
  description: Detects usage of bitsadmin downloading a file
  references:
  - https://blog.netspi.com/15-ways-to-download-a-file/#bitsadmin
  - https://isc.sans.edu/diary/22264
  tags:
  - attack.defense_evasion
  - attack.persistence
  - attack.t1197
  - attack.s0190
  date: 2017/03/09
  modified: 2019/12/06
  author: Michael Haag
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection1:
      Image:
      - '*\bitsadmin.exe'
      CommandLine:
      - '* /transfer *'
    selection2:
      CommandLine:
      - '*copy bitsadmin.exe*'
    condition: selection1 or selection2
  fields:
  - CommandLine
  - ParentCommandLine
  falsepositives:
  - Some legitimate apps use this, but limited.
  level: medium

Querying Elasticsearch

Import Libraries


In [ ]:
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
import pandas as pd

Initialize Elasticsearch client


In [ ]:
es = Elasticsearch(['http://helk-elasticsearch:9200'])
searchContext = Search(using=es, index='logs-*', doc_type='doc')

Run Elasticsearch Query


In [ ]:
s = searchContext.query('query_string', query='((process_path.keyword:(*\\bitsadmin.exe) AND process_command_line.keyword:(*\ \/transfer\ *)) OR process_command_line.keyword:(*copy\ bitsadmin.exe*))')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()