Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Adversaries may establish persistence by executing malicious content triggered by an interrupt signal.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 14% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 77% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 4% | 0% |
| case-10 | ✗→✓ | ▲ Improved | -27% | 0% |
| case-17 | ✗→✓ | ▲ Improved | -10% | 0% |
> Sub-technique of: T1546
Adversaries may establish persistence by executing malicious content triggered by an interrupt signal. The <code>trap</code> command allows programs and shells to specify commands that will be executed upon receiving interrupt signals. A common situation is a script allowing for graceful termination and handling of common keyboard interrupts like <code>ctrl+c</code> and <code>ctrl+d</code>.
Adversaries can use this to register code to be executed when the shell encounters specific interrupts as a persistence mechanism. Trap commands are of the following format <code>trap 'command list' signals</code> where "command list" will be executed when "signals" are received.
Platforms: macOS, Linux
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
Launch bash shell with command arg to create TRAP on EXIT. The trap executes script that writes to /tmp/art-fish.txt
Supported Platforms: macos, linux
bashbash -c 'trap "nohup sh $PathToAtomicsFolder/T1546.005/src/echo-art-fish.sh" EXIT'
Launch bash shell with command arg to create TRAP on EXIT. The trap executes script that writes to /tmp/art-fish.txt
Supported Platforms: linux
bashbash -c 'trap "nohup sh $PathToAtomicsFolder/T1546.005/src/echo-art-fish.sh" EXIT'
Dependencies:
Launch bash shell with command arg to create TRAP on SIGINT (CTRL+C), then send SIGINT signal. The trap executes script that writes to /tmp/art-fish.txt
Supported Platforms: macos, linux
bashbash -c 'trap "nohup sh $PathToAtomicsFolder/T1546.005/src/echo-art-fish.sh" SIGINT && kill -SIGINT $$'
Launch bash shell with command arg to create TRAP on SIGINT (CTRL+C), then send SIGINT signal. The trap executes script that writes to /tmp/art-fish.txt
Supported Platforms: linux
bashbash -c 'trap "nohup sh $PathToAtomicsFolder/T1546.005/src/echo-art-fish.sh" SIGINT && kill -SIGINT $$'
Dependencies:
If Atomic Red Team tests are not applicable, manually verify the technique by:
No specific mitigations documented for this technique.
| Finding | Severity | Impact | | ------------------------- | -------- | -------------------- | | Trap technique applicable | Low | Privilege Escalation |
| CWE ID | Title | | ------- | ----------------------------- | | CWE-269 | Improper Privilege Management |
Other measured skills in the registry, with their headline benchmark lift.