Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Adversaries may attempt to make payloads difficult to discover and analyze by delivering files to victims as uncompiled code.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 48% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 142% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 75% | 0% |
| case-16 | ✗→✓ | ▲ Improved | -58% | 0% |
| case-19 | ✗→✓ | ▲ Improved | -43% | 0% |
> Sub-technique of: T1027
Adversaries may attempt to make payloads difficult to discover and analyze by delivering files to victims as uncompiled code. Text-based source code files may subvert analysis and scrutiny from protections targeting executables/binaries. These payloads will need to be compiled before execution; typically via native utilities such as ilasm.exe, csc.exe, or GCC/MinGW.
Source code payloads may also be encrypted, encoded, and/or embedded within other files, such as those delivered as a Phishing. Payloads may also be delivered in formats unrecognizable and inherently benign to the native OS (ex: EXEs on macOS/Linux) before later being (re)compiled into a proper executable binary with a bundled compiler and execution framework.
Platforms: Linux, macOS, Windows
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
Compile C# code using csc.exe binary used by .NET Upon execution an exe named T1027.004.exe will be placed in the temp folder
Supported Platforms: windows
cmdC:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /out:#{output_file} "#{input_file}"
Dependencies:
When C# is compiled dynamically, a .cmdline file will be created as a part of the process. Certain processes are not typically observed compiling C# code, but can do so without touching disk. This can be used to unpack a payload for execution. The exe file that will be executed is named as T1027.004_DynamicCompile.exe is contained in the 'bin' folder of this atomic, and the source code to the file is in the 'src' folder. Upon execution, the exe will print 'T1027.004 Dynamic Compile'.
Supported Platforms: windows
powershellInvoke-Expression "#{input_file}"
Dependencies:
Compile a c file with either gcc or clang on FreeBSD, Linux or Macos.
Supported Platforms: linux, macos
bashgcc #{input_file} && ./a.out clang #{input_file} && ./a.out
Dependencies:
Compile a c file with either gcc or clang on FreeBSD, Linux or Macos.
Supported Platforms: linux, macos
bashg++ #{input_file} && ./a.out clang++ #{input_file} && ./a.out
Dependencies:
Compile a go file with golang on FreeBSD, Linux or Macos.
Supported Platforms: linux, macos
bashgo run #{input_file}
Dependencies:
If Atomic Red Team tests are not applicable, manually verify the technique by:
No specific mitigations documented for this technique.
| Finding | Severity | Impact | | ------------------------------------------- | -------- | --------------- | | Compile After Delivery technique applicable | High | Defense Evasion |
| CWE ID | Title | | ------- | ---------------------------- | | CWE-693 | Protection Mechanism Failure |
Other measured skills in the registry, with their headline benchmark lift.