Shell expansion in quoted text
Backticks or command substitution sit inside a double-quoted message or body, where the shell runs them.
Why it is risky
Section titled “Why it is risky”In a shell, text between backticks or inside $( ) in a double-quoted argument is executed before the command starts, and its output replaces it. Markdown uses backticks for code, so a pull request body, issue comment or commit message that formats a command as code can run that command instead of showing it.
Example
Section titled “Example”An agent writes a pull request description with gh pr create --body "To reset, run \docker volume prune`“, but the backticks are not escaped and the body is in double quotes. The shell runs the prune before gh` is called, and the description shows the command’s output.
This is a fictional example, not an event from a customer.
What Omnodex Detects
Section titled “What Omnodex Detects”The rule looks at shell commands that run git, gh or glab and give a text argument in double quotes: a message, body, title, notes, description, comment or subject, by long flag or by short flags such as -m, -b and -t. It reports a backtick pair or a $( ) command substitution inside that quoted text.
| Rule ID | Event category | Tier | Base severity |
|---|---|---|---|
RULE_THREAT_SHELL_EXPANSION_IN_TEXT | threat_command | Community | MEDIUM |
Base severity is the rule default. A finding involving content saved for later execution may have a lower severity. Your loaded rule version and event details determine the finding you see.
It does not report single-quoted text, backticks or dollar signs escaped with a backslash, arithmetic such as $((1+2)), or a message read from a file. A message passed as $(cat <<'EOF' ... EOF), with a quoted heredoc delimiter, is the safe way to pass multi-line text and is not reported.
What to check next
Section titled “What to check next”Look at the full command and what the backticks contained. If the text was meant to be shown, rewrite the command with single quotes, a quoted heredoc, or a body file. If the contents were a command, check what it did and whether it was authorized.
False positives
Section titled “False positives”A deliberate $(date) or $(git rev-parse HEAD) in a message matches. So does a $(cat file) that is meant to read a body from a file.
False negatives
Section titled “False negatives”Other programs, such as curl --data or a shell script that builds the text, are not checked. Quoting styles of other shells, text assembled in several steps, and expansion in arguments that are not one of the listed text flags can be missed.
Technical details
Section titled “Technical details”The base severity is MEDIUM. The rule reads the command text and does not run it, so a finding shows that expansion was possible, not what the expanded command did.
A finding describes a pattern in captured activity. Review the original call, its result, and the task context before concluding that harm occurred. Absence of a finding does not establish that an operation is safe.