Detection rules › Sigma

Set Suspicious Files as System Files Using Attrib.EXE

Status
test
Severity
high
Log source
category process_creation, product windows
Author
Nasreddine Bencherchali (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects the usage of attrib with the "+s" option to set scripts or executables located in suspicious locations as system files to hide them from users and make them unable to be deleted with simple rights. The rule limits the search to specific extensions and directories to avoid FPs

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: Set Suspicious Files as System Files Using Attrib.EXE
id: efec536f-72e8-4656-8960-5e85d091345b
related:
    - id: bb19e94c-59ae-4c15-8c12-c563d23fe52b
      type: derived
status: test
description: |
    Detects the usage of attrib with the "+s" option to set scripts or executables located in suspicious locations as system files to hide them from users and make them unable to be deleted with simple rights. The rule limits the search to specific extensions and directories to avoid FPs
references:
    - https://app.any.run/tasks/c28cabc8-a19f-40f3-a78b-cae506a5c0d4
    - https://app.any.run/tasks/cfc8870b-ccd7-4210-88cf-a8087476a6d0
    - https://unit42.paloaltonetworks.com/unit42-sure-ill-take-new-combojack-malware-alters-clipboards-steal-cryptocurrency/
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-06-28
modified: 2023-03-14
tags:
    - attack.stealth
    - attack.t1564.001
logsource:
    category: process_creation
    product: windows
detection:
    selection_img:
        - Image|endswith: '\attrib.exe'
        - OriginalFileName: 'ATTRIB.EXE'
    selection_cli:
        CommandLine|contains: ' +s'
    selection_paths:
        CommandLine|contains:
            - ' %' # Custom Environment variable
            - '\Users\Public\'
            - '\AppData\Local\'
            - '\ProgramData\'
            - '\Downloads\'
            - '\Windows\Temp\'
    selection_ext:
        CommandLine|contains:
            - '.bat'
            - '.dll'
            - '.exe'
            - '.hta'
            - '.ps1'
            - '.vbe'
            - '.vbs'
    filter_optional_installer:
        CommandLine|contains|all:
            - '\Windows\TEMP\'
            - '.exe'
    condition: all of selection* and not 1 of filter_optional_*
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

all of selection* and not 1 of filter_optional_*

Stage 1: selection_img

selection_img:
    - Image|endswith: '\attrib.exe'
    - OriginalFileName: 'ATTRIB.EXE'

Stage 2: selection_cli

selection_cli:
    CommandLine|contains: ' +s'

Stage 3: selection_paths

selection_paths:
    CommandLine|contains:
        - ' %'
        - '\Users\Public\'
        - '\AppData\Local\'
        - '\ProgramData\'
        - '\Downloads\'
        - '\Windows\Temp\'

Stage 4: selection_ext

selection_ext:
    CommandLine|contains:
        - '.bat'
        - '.dll'
        - '.exe'
        - '.hta'
        - '.ps1'
        - '.vbe'
        - '.vbs'

Stage 5: not filter_optional_installer

filter_optional_installer:
    CommandLine|contains|all:
        - '\Windows\TEMP\'
        - '.exe'

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
CommandLinematch.exeexcludes:CommandLine field:"CommandLine" value:".exe"
CommandLinematch\Windows\TEMP\excludes:CommandLine field:"CommandLine" value:"\Windows\TEMP\"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
CommandLinematch
  • %
  • +s
  • .bat corpus 11 (sigma 9, elastic 1, kusto 1)
  • .dll corpus 16 (sigma 16)
  • .exe corpus 5 (sigma 5)
  • .hta corpus 6 (sigma 6)
  • .ps1 corpus 4 (sigma 3, elastic 1)
  • .vbe corpus 5 (sigma 5)
  • .vbs corpus 7 (sigma 7)
  • \AppData\Local\ corpus 11 (sigma 10, elastic 1)
  • \Downloads\ corpus 15 (sigma 14, elastic 1)
  • \ProgramData\ corpus 4 (sigma 3, elastic 1)
  • \Users\Public\ corpus 18 (sigma 17, elastic 1)
  • \Windows\Temp\ corpus 13 (sigma 12, elastic 1)
field:"CommandLine" kind:match
Imageends_with
  • \attrib.exe corpus 5 (sigma 5)
field:"Image" kind:ends_with value:"\attrib.exe"
OriginalFileNameeq
  • ATTRIB.EXE corpus 5 (sigma 3, elastic 2)
field:"OriginalFileName" kind:eq value:"ATTRIB.EXE"