T09 · Insecure Skill Coding Practices
- Location
scripts/data-factory.js:193- Finding
Arbitrary JavaScript Execution Through Data Templates
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This QA testing skill is mostly coherent, but it gives agents broad automatic testing power that can run project code, probe sensitive endpoints, and execute unsafe test templates without enough user control.
Use this only on repositories and services you control, preferably in an isolated test environment with minimal environment variables. Review and approve the exact startup commands, target URLs, generated configs, and any template files before running Standard mode; avoid production targets, untrusted templates, and unpinned package downloads.
scripts/data-factory.js:193Arbitrary JavaScript Execution Through Data Templates
scripts/http-test-runner.js:102Environment Variables Can Be Exfiltrated Through Configurable HTTP Requests
scripts/security-headers-check.js:21Unrestricted SSRF and Automatic Enumeration of Sensitive Internal Endpoints
references/01-静态代码审计.md:213Audit Workflow Recommends Execution of Unpinned Registry Packages
references/02-动态功能测试.md:29Standard Mode Automatically Executes Target-Repository Startup Commands
If the underlying implementation probes sensitive paths such as /admin, /.env, /debug, or /swagger while presenting itself as a general testing helper, that is a significant behavior mismatch. Undisclosed active enumeration can trigger security controls, access unintended endpoints, or scan internal services in ways the user did not knowingly authorize.
If the underlying implementation probes sensitive paths such as /admin, /.env, /debug, or /swagger while presenting itself as a general testing helper, that is a significant behavior mismatch. Undisclosed active enumeration can trigger security controls, access unintended endpoints, or scan internal services in ways the user did not knowingly authorize.
If the underlying implementation probes sensitive paths such as /admin, /.env, /debug, or /swagger while presenting itself as a general testing helper, that is a significant behavior mismatch. Undisclosed active enumeration can trigger security controls, access unintended endpoints, or scan internal services in ways the user did not knowingly authorize.
Referenced artifact was not completely inspected
| HTTP 测试跑器 | `scripts/http-test-runner.js` |
Referenced artifact was not completely inspected
| 配置检查脚本 | `scripts/security-headers-check.js` |
Referenced artifact was not completely inspected
| 测试数据工厂 | `scripts/data-factory.js` |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
| 技术栈 | 依赖文件 | Lock 文件 | 配置文件 |
|:---|:---|:---|:---|
| Node.js | `package.json` | `package-lock.json` / `yarn.lock` / `pnpm-lock.yaml` | `.npmrc` |
| Python | `requirements.txt` / `pyproject.toml` | `poetry.lock` / `Pipfile.lock` | `pip.conf` |
| Java/Maven | `pom.xml` | 无(依赖在本地仓库) | `.m2/settings.xml` |
| Java/Gradle | `build.gradle` | `gradle.lockfile` | `gradle.properties` |
This section provides explicit attack payloads and token tampering instructions, but the safety warning is fragmented and not enforced by a strong upfront gate. If the environment is misclassified or the instructions are reused out of context, the agent could perform active exploitation attempts against live systems, causing service disruption, data exposure, or unauthorized access attempts.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- SQL 注入:`' OR '1'='1`、`'; DROP TABLE users; --`
- NoSQL 注入:`{"$gt": ""}`、`{"$ne": null}`
- XSS 探测:`<script>alert(1)</script>`、`<img src=x onerror=alert(1)>`
- 命令注入:`; ls`、`| cat /etc/passwd`
- 模板注入:`${{7*7}}`、`{{constructor.constructor('return this')()}}`
**重要**:每个 Payload 发送后,记录响应状态码和响应体截断。重点是观察是否有异常响应(如返回了不应该返回的数据、SQL 错误信息等)。
The $custom feature evaluates template-supplied JavaScript using new Function, which allows arbitrary code execution in the context of the Node.js process. Because the template file is external input, an attacker or untrusted contributor can execute system commands, read files, access environment variables, or perform network activity, far beyond test data generation.
The script explicitly probes high-risk paths such as /.env, which commonly contain secrets if misconfigured. Even though the request is read-only and intended for validation, automatically attempting to access secret-bearing files increases the chance of unauthorized secret discovery against the wrong target and expands the skill from QA into sensitive reconnaissance.
"/api-docs",
"/actuator",
"/graphql",
"/.env",
"/phpinfo",
"/console",
"/metrics",
The main scan path list again includes /.env, causing the tool to request a file that may expose credentials or application secrets if publicly reachable. In the context of a broadly described QA assistant, this capability is more dangerous because users may run it outside a formally authorized security assessment scope.
"/api-docs",
"/actuator",
"/graphql",
"/.env",
"/phpinfo.php",
"/console",
"/metrics",
The skill description and example invocations are entirely in Chinese, including the required trigger phrases 按 Quick 测试 and 按 Standard 测试. This implies a fixed language requirement for use, but the README does not offer an opt-in language choice or explain that the skill is intentionally limited to a Chinese-speaking context.
The skill defines operational behavior that implies access to environment capabilities but does not declare an explicit tool or permission scope. This creates ambiguity about what the agent may access at runtime and weakens least-privilege controls, increasing the chance of unintended data exposure or broader execution than users expect.
The trigger phrases are broad enough to match ordinary developer conversation such as '测试', '代码审查', or 'PR 检查'. This raises the risk of accidental activation of a skill that may run scans, load references, or produce outputs without clear user intent, especially problematic for a tool that may perform dynamic testing or write reports.
The markdown instructs the agent to generate test-report.md in the project root, contradicting the stated '只读不写' expectation elsewhere in the skill. Undisclosed local writes can overwrite files, create noisy repo changes, or leak sensitive findings into tracked directories without the user's explicit consent.
The natural-language description is presented only in Chinese, which can impose a language preference on users without any opt-in or alternative locale. Under the policy rule, language-specific behavior or presentation should either offer a choice or clearly justify the locale restriction.
This markdown appendix is written entirely in Chinese and includes an imperative role statement directing behavior, but it does not offer any language or locale choice. The policy for this audit flags natural-language constraints that force a specific language without user opt-in unless the locale limitation is explicitly documented and justified.
The file instructs the agent to always generate test-report.md in the project root, which is a workspace write operation. Because the skill does not clearly warn the user that it will modify repository files or require confirmation before writing, it can cause unexpected file creation or overwriting, pollute commits, or interfere with existing project artifacts.
The file title and all operational instructions are written entirely in Chinese, establishing the skill's required working language implicitly. There is no natural-language indication that users may choose another language or locale, nor any justification that this is a region-specific skill.
L008 明确将本文件范围限定为源码、配置和命令行审计,且不要求项目可运行。但后文在 L303-L318 指示 AI 推断启动命令、启动项目并在失败时尝试备用端口,这已经超出纯静态审计范围,和文件自身描述不一致。
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.