SkillSpector icon indicating copy to clipboard operation
SkillSpector copied to clipboard

SC2 reports HIGH remote code execution when a Markdown table cell starting with "Sh" follows an inline curl

Open forrestsatterfield opened this issue 5 days ago • 1 comments

Summary

SC2 (Remote Code Execution, HIGH, confidence 0.9) fires on a Markdown document that has an inline curl health check and, further down, a table whose first column header starts with "Sh". Nothing is piped to a shell. I found this while scanning a published Claude Code plugin's troubleshooting doc, where the table header (| Shape | Means | Fix |) was more than 50 lines below the curl.

Environment

  • SkillSpector v2.13.7 (same version as main at 636e4293)
  • skillspector scan <dir> --no-llm --format json (static only)
  • Windows 11

Reproduction

sc2min/SKILL.md:

---
name: sc2min
description: Minimal reproducer.
---

# Troubleshooting

Check the server is up: `curl https://example.com/health` should return `{"status":"ok"}`.

## Errors

| Shape | Means |
| --- | --- |
| Text starting `Error:` | The server could not answer |
score 22 MEDIUM CAUTION
  SC2 HIGH 0.9 SKILL.md:8 | 'curl https://example.com/health` should return `{"status":"ok"}`.\n\n## Errors\n\n| '

Renaming the column from Shape to Kind gives score 0 LOW SAFE with no findings. Line endings don't matter; the result is the same under LF and CRLF.

Cause

The first two entries of SC2_CODE_PATTERNS in static_patterns_supply_chain.py:

(r"curl\s+[^|]*\|\s*(?:sudo\s+)?(?:ba)?sh", 0.9),
(r"wget\s+[^|]*\|\s*(?:sudo\s+)?(?:ba)?sh", 0.9),
  • [^|]* crosses newlines, the closing backtick of the inline code span, a blank line and a heading, so the match runs to the next | in the file, which is a table pipe.
  • There is no \b after (?:ba)?sh, and the match is case-insensitive, so | Sh (from | Shape) counts as | sh. Other words would do the same, such as | Shell, | Short or | Shared.

_PIPE_TO_SHELL in the same file already does both of these right: [^|\n]* and a trailing \b.

Expected

No SC2 finding. At minimum, the pattern should stop at a line break (or at the end of an inline code span) and require a word boundary after the executor name. The same applies to the python|node|ruby|perl variants, where | Python version | or | Nodes | in a table would match the same way.

Related, but a different trigger: #717 (closed; SC2 crossing command and Markdown boundaries) and #1222.

forrestsatterfield avatar Nov 29 '26 08:11 forrestsatterfield

I would like to take this one. SC2 should not treat a table cell far below an inline curl as a pipe to a shell, and the same boundary problem applies to the python, node, ruby and perl variants. I will reproduce it on current main first, then send a PR that keeps the match on one command line with a word boundary after the executor name, plus regression tests for the table case and the real pipe cases that should still fire.

Varshith-Kali avatar Nov 29 '26 16:11 Varshith-Kali