T09 · Insecure Skill Coding Practices
- Location
scripts/debug-selector.sh:17- Finding
JavaScript Injection Through Unescaped CSS Selector Input
- Content
View full analysis
[snapshots=5]" exit 1 fi echo "Testing selector stability: $SELECTOR" echo "Snapshots: $SNAPSHOTS" echo "---" for i in $(seq 1 $SNAPSHOTS); do # Get initial count COUNT=$(pagerunner evaluate "$SESSION_ID" "$TAB_ID" "document.querySelectorAll('$SELECTOR').length") ``` ### Technical Analysis Both scripts embed a caller-controlled CSS selector directly inside a single-quoted JavaScript string passed to `pagerunner evaluate`. No JavaScript escaping, JSON serialization, or selector validation is applied. A selector containing a single quote can terminate the intended string literal and introduce additional JavaScript expressions. The resulting code runs in the context of the active browser tab rather than being restricted to a selector lookup. This violates the scripts' documented selector-only trust boundary. In an authenticated tab, injected page-context JavaScript may read visible DOM content, access same-origin storage available to JavaScript, perform authenticated same-origin requests, alter page state, or initiate application actions. HttpOnly cookies would not be directly readable, but the browser may still attach them ...[truncated 1277 chars]- Remediation
View remediation
