T1027.001 Binary Padding
Sub-technique of: T1027
High-Level Description
Adversaries may use binary padding to add junk data and change the on-disk representation of malware. This can be done without affecting the functionality or behavior of a binary, but can increase the size of the binary beyond what some security tools are capable of handling due to file size limitations.
Binary padding effectively changes the checksum of the file and can also be used to avoid hash-based blocklists and static anti-virus signatures. The padding used is commonly generated by a function to create junk data and then appended to the end or applied to sections of malware. Increasing the file size may decrease the effectiveness of certain tools and detection capabilities that are not designed or configured to scan large files. This may also reduce the likelihood of being collected for analysis. Public file scanning services, such as VirusTotal, limits the maximum size of an uploaded file to be analyzed.
Kill Chain Phase
- Defense Evasion (TA0005)
Platforms: Linux, Windows, macOS
What to Check
- Identify if Binary Padding technique is applicable to target environment
- Check Linux systems for indicators of Binary Padding
- Check Windows systems for indicators of Binary Padding
- Check macOS systems for indicators of Binary Padding
- Assess detection coverage (1 detection strategies)
How to Test
Atomic Red Team Tests
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
Atomic Test 1: Pad Binary to Change Hash - Linux/macOS dd
Uses dd to add a zero byte, high-quality random data, and low-quality random data to the binary to change the hash.
Upon successful execution, dd will modify /tmp/evil-binary, therefore the expected hash will change.
Supported Platforms: linux, macos
dd if=/dev/zero bs=1 count=1 >> #{file_to_pad} #adds null bytes
dd if=/dev/random bs=1 count=1 >> #{file_to_pad} #adds high-quality random data
dd if=/dev/urandom bs=1 count=1 >> #{file_to_pad} #adds low-quality random data
Dependencies:
- The binary must exist on disk at specified location (#{file_to_pad})
Atomic Test 2: Pad Binary to Change Hash using truncate command - Linux/macOS
Uses truncate to add a byte to the binary to change the hash.
Upon successful execution, truncate will modify /tmp/evil-binary, therefore the expected hash will change.
Supported Platforms: linux, macos
truncate -s +1 #{file_to_pad} #adds a byte to the file size
Dependencies:
- The binary must exist on disk at specified location (#{file_to_pad})
Manual Testing
If Atomic Red Team tests are not applicable, manually verify the technique by:
Identify Attack Surface: Determine if the target environment is susceptible to Binary Padding by examining the target platforms (Linux, Windows, macOS).
Assess Existing Defenses: Review whether mitigations for T1027.001 are in place. If defenses are absent or misconfigured, this technique may be exploitable.
Execute Test: Use tools and methods described in the MITRE ATT&CK page and external references below.
Remediation Guide
No specific mitigations documented for this technique.
Detection
Detection Strategy for Obfuscated Files or Information: Binary Padding
Risk Assessment
| Finding | Severity | Impact |
|---|---|---|
| Binary Padding technique applicable | Low | Defense Evasion |
CWE Categories
| CWE ID | Title |
|---|---|
| CWE-693 | Protection Mechanism Failure |