Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Covers MITRE ATT&CK T1546.005, where adversaries use shell trap commands on interrupt signals for persistence, with Atomic Red Team tests.
41% 86%+45 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 9 of 22 without it.
3 of 3 safety checks passed
Not used yet
Sub-technique of: T1546
Adversaries may establish persistence by executing malicious content triggered by an interrupt signal. The trap 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 ctrl+c and ctrl+d.
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 trap 'command list' signals 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
bash -c 'trap "nohup sh $PathToAtomicsFolder/T1546.005/src/echo-art-fish.sh" EXIT'
Next to this one in the catalogue, plus more from the same author.