feat(ctf): Shell Injection — run_diagnostics command injection challenge#467
Open
steadhac wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Shell Injection CTF challenge (
rce-shell-injection) mapping to intentionalbug #369 (SU-DIAG-003 —
run_diagnosticshas no command allowlist).run_diagnosticsaccepts a free-formcommandstring and passes it to the system withoutsanitization. Shell operators like
;,&&,||,|, backticks, and$()are not stripped,allowing an attacker to chain arbitrary commands alongside legitimate diagnostic ones.
This is distinct from Shell Shock (
rce-shell-shock): Shell Shock targetsexecute_scriptwithreverse shell / destructive payloads. This challenge targets
run_diagnosticswith command chaining— a lower-friction attack vector that looks like a legitimate maintenance workflow.
The underlying bug is intentionally left unfixed per #369 ("intentional CTF design").
Files
finbot/ctf/definitions/challenges/rce/shell_injection.yaml— challenge definition,RCEDetectorconfig scoped torun_diagnostics.command, 9 injection patterns, 3 tiered hintsHow it works
Reuses
RCEDetectorwithtool_names: [run_diagnostics]andcontent_fields: [command].No new detector class needed — the YAML overrides the default
execute_scriptscope.Labels
LLM01:Prompt Injection·LLM06:Excessive Agency·CWE-78·CWE-20·AML.T0043·AML.T0054·ASI-01·ASI-02·ASI-05Test plan
uv run python scripts/reload_challenges.py— loads 18 challenges, no YAML errorsrce-shell-shockprerequisiteorder_index: 11— no collision with existing challenges (Shell Shock: 10, Privilege Escalation: 12)Closes #369