Repository navigation
Add Linux rule: Potential Shell Or Command Execution Via Tar - #6542
rafaelsoje wants to merge 11 commits into
Conversation
There was a problem hiding this comment.
Welcome @rafaelsoje 👋
It looks like this is your first pull request on the Sigma rules repository!
Please read the SigmaHQ conventions to ensure your contribution adheres to best practices and includes all the necessary elements for a successful review.
Also check CONTRIBUTING.md for more information on how to contribute to the Sigma rules repository, specifically proper testing and validation of your rules.
Thanks again, and welcome to the Sigma community! 😃
If you want to engage more with the community for official support, general discussions or announcements:
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved matching flaws allow valid tar command-execution variants to evade detection while triggering false positives on benign checkpoint actions, compressor wrappers, and filename fragments.
6 open issues
Exclude routine bash compressor wrappers from alerts · New Detect shell payloads in tar wrapper command arguments · New Match complete tool-name tokens in shell payloads · New Match exec= only within checkpoint-action values · New Recognize tar command-execution option aliases · New Support attached compressor arguments and exact shell names · New
What changed in this PR
Adds two experimental Sigma rules to the Linux process-creation ruleset to detect potential command execution and privilege-escalation abuse of tar.
Changes:
- Detects execution-capable tar options and shell-based compressor invocations.
- Adds a related child-process rule matching selected shell images and suspicious tools in command lines.
| File | Description |
|---|---|
rules/linux/process_creation/proc_creation_lnx_tar_cmd_execution.yml |
Adds command-line detection for tar execution flags and shell compressor usage. |
rules/linux/process_creation/proc_creation_lnx_susp_tar_children.yml |
Adds detection for suspicious processes spawned by tar. |
Review effort: Max
Refine regex patterns for command line selection criteria. Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: frack113 <[email protected]>

Summary of the Pull Request
Adds two complementary Linux
process_creationrules covering command execution and privilege escalation via GNU tar's GTFOBins-abusable flags.Rule 1 — Command Execution Attempt via Tar - Linux
Detects tar invocations using flags that spawn external processes:
--checkpoint-action=exec,--to-command,--info-script/-F(alias), and-I/--use-compress-programwith a shell binary. Detection scope was derived from GNU tar source (src/system.cxexec(),src/checkpoint.c): all four paths ultimately callexecv("/bin/sh", ["/bin/sh", "-c", cmd]), except-Iwhich can also bypass the shell wrapper viarun_decompress_program()→execvp()directly — making command-line detection essential for that flag in addition to child-process monitoring.Rule 2 — Suspicious Child Process Spawned By Tar
Complements rule 1 by monitoring the process tree rather than the tar command line. When tar is granted elevated execution rights (sudoers
NOPASSWD, SUID bit, or file capabilities), a lower-privileged user can abuse these flags to spawn a shell inheriting those elevated privileges. The rule catches: unusual direct shell children of tar (non-default shells bypassingxexec()), shell invocations within the-cpayload (e.g./bin/sh -c '/bin/sh 0<&2 1>&2'), and suspicious tools referenced in the wrapper's command string. Afilter_main_expected_compressorexcludes false positives on systems where/bin/shresolves to bash/dash, where routinetar -czflogs asbash -c gzip.Changelog
new: Command Execution Attempt via Tar - Linux
new: Suspicious Child Process Spawned By Tar
Example Log Event
Fixed Issues
SigmaHQ Rule Creation Conventions