T09 · Insecure Skill Coding Practices
- Location
SKILL.md:12- Finding
Shell Command Injection Through User-Controlled Command Arguments
- Content
View full analysis
``` - Dùng thông tin trả về (P/E, P/B, EPS, Tỷ suất cổ tức...) để trả lời user và đưa ra nhận định ngắn gọn. ## 2. Quét tin tức và tin đồn (News & Rumor Scanner) Khi user hỏi "Có tin tức chứng khoán gì hot không?", "Tìm tin đồn", "Chủ tịch đăng ký mua bán": - Nhận diện từ khóa user quan tâm (`keywords`). Nếu user muốn tin chung chung thì bỏ trống. Nếu user muốn tin về mua/bán nội bộ, thì truyền `keywords="mua,bán,chủ tịch,đăng ký"`. - Sử dụng tool `exec` gọi lệnh: ```bash python3 /home/hoang/.openclaw/workspace/vn-stock-scanner/scripts/scanner.py news --keywords "" ``` ``` ### Technical Analysis The Skill directs the Agent to extract ticker symbols or keywords from user input and interpolate them into shell command templates executed through `exec`. The ticker placeholder is entirely unquoted. Consequently, shell operators, command separators, substitutions, redirections, and additional arguments may be interpreted by the shell rather than passed literally to `scanner.py`. The keyword placeholder is enclosed in double quotes, but this does not provide a security boundary. An attacker can include a double quote to terminate the quoted argument and then append shell syntax. The instructions do not require allowlist validation, escaping, or invocation through a non-shell argument array. Although `argparse` safely processes arguments after Python starts, it cannot protect against commands interpreted by the shell before `scanner.py` is launched. ### Attack Path 1. An attacker submits a stock-analysis or news reque ...[truncated 1482 chars]- Remediation
View remediation
