T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:18
- Finding
- PII Detection Commands Expose Sensitive Values in Output and Logs## Vulnerability Details **File Location**: `SKILL.md`, lines 18–30 **Vulnerability Type**: Plaintext sensitive-data exposure **Risk Level**: High ### Vulnerable Code ```bash # Scan files for common PII patterns rg -n "(\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b)" --type-not binary 2>/dev/null | head -20 echo "--- Emails found above ---" rg -n "\\b\\d{3}[-.]?\\d{2}[-.]?\\d{4}\\b" --type-not binary 2>/dev/null | head -20 echo "--- SSN-like patterns above ---" rg -n "\\b\\d{3}[-.]?\\d{3}[-.]?\\d{4}\\b" --type-not binary 2>/dev/null | head -20 echo "--- Phone numbers above ---" rg -n "\\b\\d{4}[- ]?\\d{4}[- ]?\\d{4}[- ]?\\d{4}\\b" --type-not binary 2>/dev/null | head -20 echo "--- Credit card-like patterns above ---" ``` ### Technical Analysis The `rg` commands do not specify an explicit input path, so they recursively scan the process's current working directory. Each matching line is printed without redaction, including the detected value and potentially other sensitive content from the same line. When these commands are executed by an AI agent, CI job, or administrative shell, the results may be copied into tool output, chat transcripts, terminal logs, CI artifacts, or centralized observability systems. The `head -20` limit reduces the number of exposed records but does not protect the records that are returned. ### Attack Path 1. Sensitive files containing emails, SSNs, phone numbers, or payment-card-like values are present under the current working directory. 2. A user or agent invokes the documented `detect` procedure. 3. `rg` recursively reads all accessible files in that directory tree. 4. Matching lines containing raw PII are emitted to standard output. 5. Tooling retains or forwards that output to agent transcripts, terminal logs, CI logs, or other systems not approved to store the underlying PII. ### Impact Assessment The issue does not grant additional operating-system privilege ...[truncated 412 chars]
- Remediation
- ## Remediation Suggestions - Require an explicit, user-approved input path rather than implicitly scanning the current directory. - Validate that the selected path is within an allowlisted data directory. - Exclude sensitive metadata and unrelated locations such as `.git`, credential directories, backups, secret stores, and build artifacts. - Return only aggregate counts, classifications, and file names by default. - If samples are necessary, redact the matched values before displaying them and avoid printing the remainder of the source line. - Require explicit confirmation before scanning data that may originate from production. - Document that raw scan results must not be placed in agent context, CI logs, telemetry, or persistent transcripts. - Provide a secure output option that writes access-controlled findings to a designated local file rather than standard output.
