Detection rules › Sigma

Binary Padding - MacOS

Status
test
Severity
high
Log source
product macos, category process_creation
Author
Igor Fits, Mikhail Larin, oscd.community
Source
github.com/SigmaHQ/sigma

Adversaries may use binary padding to add junk data and change the on-disk representation of malware. This rule detect using dd and truncate to add a junk data to file.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
ESFexecProcess Execution (Notify)

Rule body yaml

title: Binary Padding - MacOS
id: 95361ce5-c891-4b0a-87ca-e24607884a96
status: test
description: Adversaries may use binary padding to add junk data and change the on-disk representation of malware. This rule detect using dd and truncate to add a junk data to file.
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1027.001/T1027.001.md
    - https://linux.die.net/man/1/truncate
    - https://linux.die.net/man/1/dd
author: 'Igor Fits, Mikhail Larin, oscd.community'
date: 2020-10-19
modified: 2023-02-17
tags:
    - attack.stealth
    - attack.t1027.001
logsource:
    product: macos
    category: process_creation
detection:
    selection_truncate:
        Image|endswith: '/truncate'
        CommandLine|contains: '-s +'
    selection_dd:
        Image|endswith: '/dd'
        CommandLine|contains:
            - 'if=/dev/zero' # if input is not /dev/zero, then there is no null padding
            - 'if=/dev/random' # high-quality random data
            - 'if=/dev/urandom' # low-quality random data
    condition: 1 of selection_*
falsepositives:
    - Legitimate script work
level: high

Stages and Predicates

Stage 0: condition

1 of selection_*

Stage 1: selection_truncate

selection_truncate:
    Image|endswith: '/truncate'
    CommandLine|contains: '-s +'

Stage 2: selection_dd

selection_dd:
    Image|endswith: '/dd'
    CommandLine|contains:
        - 'if=/dev/zero'
        - 'if=/dev/random'
        - 'if=/dev/urandom'

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • -s +
  • if=/dev/random
  • if=/dev/urandom
  • if=/dev/zero
Imageends_with
  • /dd
  • /truncate