Application whitelisting bypass via bginfo

Execute VBscript code that is referenced within the *.bgi file.

Rule Content

- title: Application whitelisting bypass via bginfo
  id: aaf46cdc-934e-4284-b329-34aa701e3771
  status: experimental
  description: Execute VBscript code that is referenced within the *.bgi file.
  references:
  - https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/OtherMSBinaries/Bginfo.yml
  - https://oddvar.moe/2017/05/18/bypassing-application-whitelisting-with-bginfo/
  author: Beyu Denis, oscd.community
  date: 2019/10/26
  modified: 2019/11/04
  tags:
  - attack.defense_evasion
  - attack.execution
  - attack.t1218
  level: medium
  logsource:
    category: process_creation
    product: windows
    service: null
  detection:
    selection:
      Image|endswith: \bginfo.exe
      CommandLine|contains|all:
      - /popup
      - /nolicprompt
    condition: selection
  falsepositives:
  - Unknown

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:*\\bginfo.exe AND process_command_line.keyword:*\/popup* AND process_command_line.keyword:*\/nolicprompt*)')
response = s.execute()
if response.success():
    df = pd.DataFrame((d.to_dict() for d in s.scan()))

Show Results


In [ ]:
df.head()