Skip to content

Add Linux rule: Potential Shell Or Command Execution Via Tar - #6542

Open
rafaelsoje wants to merge 11 commits into
SigmaHQ:masterfrom
rafaelsoje:add-tar-shell-execution
Open

rafaelsoje wants to merge 11 commits into
SigmaHQ:masterfrom
rafaelsoje:add-tar-shell-execution

Conversation

@rafaelsoje

@rafaelsoje rafaelsoje commented Oct 30, 2026 •

Copy link
Copy Markdown

Summary of the Pull Request

Adds two complementary Linux process_creation rules 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-program with a shell binary. Detection scope was derived from GNU tar source (src/system.c xexec(), src/checkpoint.c): all four paths ultimately call execv("/bin/sh", ["/bin/sh", "-c", cmd]), except -I which can also bypass the shell wrapper via run_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 bypassing xexec()), shell invocations within the -c payload (e.g. /bin/sh -c '/bin/sh 0<&2 1>&2'), and suspicious tools referenced in the wrapper's command string. A filter_main_expected_compressor excludes false positives on systems where /bin/sh resolves to bash/dash, where routine tar -czf logs as bash -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

  • If your PR adds new rules, please consider following and applying these conventions

@github-actions github-actions Bot added Rules Review Needed The PR requires review Linux Pull request add/update linux related rules labels Oct 30, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

👉 Join our Discord server

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
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

swachchhanda000 and others added 3 commits November 26, 2026 20:03
Refine regex patterns for command line selection criteria.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@frack113 frack113 added the Author Input Required changes the require information from original author of the rules label Nov 27, 2026
@frack113 frack113 removed the Author Input Required changes the require information from original author of the rules label Nov 27, 2026
@frack113 frack113 added Ready to Merge and removed Review Needed The PR requires review labels Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Linux Pull request add/update linux related rules Ready to Merge Rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants