T09 · Insecure Skill Coding Practices
- Location
SKILL.md:64- Finding
Shell Command Injection Through Unvalidated Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:64-80;references/sources.md:76-89
Vulnerability Type: Shell command injection
Risk Level: HighVulnerable Code
SKILL.md:64-80:bash # List all years for a subject gh api "repos/wujiaming88/awesome-ruankao/contents/真题/{科目名}" --jq '.[].name' # Obtain the file list for a year gh api "repos/wujiaming88/awesome-ruankao/contents/真题/{科目名}/{年份目录}" --jq '.[].name' # Obtain the file download URL gh api "repos/wujiaming88/awesome-ruankao/contents/真题/{科目名}/{年份目录}/综合知识.md" --jq '.download_url' # List mock-examination directories gh api "repos/wujiaming88/awesome-ruankao/contents/模拟题/系统架构设计师/2026年5月" --jq '.[].name' # Obtain mock-examination content gh api "repos/wujiaming88/awesome-ruankao/contents/模拟题/系统架构设计师/2026年5月/模拟卷{N}/综合知识_题目.md" --jq '.download_url'references/sources.md:76-89:bash gh api "repos/wujiaming88/awesome-ruankao/contents/真题" --jq '.[].name' gh api "repos/wujiaming88/awesome-ruankao/contents/真题/系统架构设计师" --jq '.[].name' gh api "repos/wujiaming88/awesome-ruankao/contents/真题/系统架构设计师/2024年下半年/综合知识.md" --jq '.download_url' gh api "repos/wujiaming88/awesome-ruankao/contents/模拟题/系统架构设计师/2026年5月" --jq '.[].name' gh api "repos/wujiaming88/awesome-ruankao/contents/模拟题/系统架构设计师/2026年5月/模拟卷3/综合知识_题目.md" --jq '.download_url'Technical Analysis
The Skill declares access to the
exectool and directs the agent to construct shell commands by substituting subject names, year-directory values, and mock-examination numbers into command strings. Although the variable fields appear inside double quotes, double quotes do not disable shell command substitution, including constructs such as$(command)and backticks.The instructions do not require the agent to map input to immutable constants, validate it against an exact allowlist, reject shell metacharacters, or invoke
ghwithout a shell. Consequently, an agent t ...[truncated 1503 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the
execcapability and use a structured GitHub API or HTTP client whose URL and query components are passed as data rather than shell text. - Map supported subjects to fixed internal repository paths. Never use the original user-provided subject string in a command.
- Parse years as integers and enforce an explicit supported range. Map semester values to fixed constants.
- Parse mock-examination numbers as integers and accept only the documented range of 1 through 5.
- If process execution is unavoidable, invoke
ghthrough an argument-array API without a shell, equivalent toshell=false. - Reject parameters containing control characters, path separators outside the expected format, shell metacharacters, command substitutions, or traversal sequences.
- Add negative tests using values containing
$(), backticks, quotes, semicolons, newlines, and path traversal components. - Apply the same hardened examples in both
SKILL.mdandreferences/sources.mdso that the reference document cannot reintroduce unsafe execution patterns.
- Remove the
