T09 · Insecure Skill Coding Practices
- Location
SKILL.md:108- Finding
Unvalidated Target Injection into the recon-ng Command Stream
- Content
View full analysis
- Remediation
View remediation
&2 exit 1 ;; esac ``` 2. Apply explicit length and label validation. Each DNS label should be 1–63 characters, and the complete domain should not exceed 253 characters. 3. Reject all carriage-return and newline characters independently, even if broader domain validation is also present: ```bash case "$TARGET" in *$'\n'* | *$'\r'*) echo "Control characters are not permitted" >&2 exit 1 ;; esac ``` 4. Prefer a recon-ng API, structured interface, or parameterized invocation that separates data from console commands. Avoid generating interpreter command streams by interpolating external values into here-documents. 5. If a here-document remains necessary, construct it only after strict allowlist validation. Quoting the here-document delimiter would disable all expansion and therefore requires another safe mechanism for passing validated values. 6. Run recon-ng with least privilege, isolate its workspace, restrict file-system access, and configure only the API keys required for the selected modules. 7. Add negative tests using targets containing newlines, carriage returns, spaces, Unicode control characters, and recon-ng command text to verify that malformed values are rejected before recon-ng starts. ]]>
