T09 · Insecure Skill Coding Practices
- Location
SKILL.md:64- Finding
Shell Command Injection Through Interpolated User-Controlled Paths
- Content
View full analysis
" > /dev/null 2>&1 && echo "ok" || echo "not_found" ``` ```bash find "" -type f \( -name "*.txt" -o -name "*.md" -o -name "*.docx" -o -name "*.pdf" -o -name "*.xlsx" -o -name "*.csv" \) -not -name ".kb-meta.json" -print ``` ```bash stat -f "%m" "" # macOS stat -c "%Y" "" # Linux ``` ```bash KB_FILE="/" python3 -c " import docx, os doc = docx.Document(os.environ['KB_FILE']) text = '\n'.join(p.text for p in doc.paragraphs if p.text.strip()) limit = int(os.environ.get('KB_MAX_CHARS', '0')) print(text[:limit] if limit else text) " ``` ```bash KB_FILE="/" python3 -c " import pdfplumber, os with pdfplumber.open(os.environ['KB_FILE']) as pdf: text = '\n'.join(p.extract_text() or '' for p in pdf.pages) limit = int(os.environ.get('KB_MAX_CHARS', '0')) print(text[:limit] if limit else text) " ``` ```bash KB_FILE="/" python3 -c " import openpyxl, os wb = openpyxl.load_workbook(os.environ['KB_FILE'], data_only=True) rows = [] for ws in wb.worksheets: for row in ws.iter_rows(values_only=True): line = '\t'.join(str(v) for v in row if v is not None) if line.strip(): rows.append(line) text = '\n'.join(rows) limit = int(os.environ.get('KB_MAX_CHARS', '0')) print(text[:limit] if limit else text) " ``` ### Technical Analysis The Skill directs the Agent to obtain `WATCH_DIR` from user input and then substitute it into Bash command templates. Filenames are likewise obtained by scanning a potentially attacker-controlled directory and are subsequently substituted into commands through the `` or `` placeholders. Placing substituted data ...[truncated 2271 chars]- Remediation
View remediation
