T09 · Insecure Skill Coding Practices
- Location
scripts/detect_conflicts.py:198- Finding
Untrusted Maven and Gradle Projects Can Execute Arbitrary Build Logic During Scanning
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent dependency-conflict scanner, but it automatically runs Maven or Gradle project build logic, including repository-provided Gradle wrappers, without clear isolation or informed opt-in.
Install only if you intend to run dependency analysis on projects you trust, or if you can run it in a disposable sandbox/container with no secrets, limited filesystem access, and controlled network access. Avoid pointing it at untrusted Maven or Gradle repositories unless live build execution is disabled or isolated, and treat generated HTML reports as untrusted content.
scripts/detect_conflicts.py:198Untrusted Maven and Gradle Projects Can Execute Arbitrary Build Logic During Scanning
scripts/detect_conflicts.py:532Unescaped Project Metadata Allows Stored HTML Injection in Generated Reports
{c.artifact_key}
{type_label}
{', '.join(c.versions[:4])}
{', '.join(c.modules[:3])}
{c.suggestion}
"""
```
```python
Spring Boot microservice project · {result.project_dir} · {result.scan_time}
``` ### Technical Analysis The HTML report generator interpolates dynamic values directly into HTML without context-appropriate escaping. Relevant values include: - `c.artifact_key` - Dependency versions in `c.versions` - Module names in `c.modules` - `c.suggestion` - `result.project_dir` Artifact identifiers, versions, and module names may originate from project-controlled POM files or build-tool output. A malicious repository can therefore place HTML markup into values that eventually reach a generated conflict row. The attacker can ensure that such data is included in the report by defining multiple versions of an artifact or constructing metadata that triggers a known incompatibility rule. Because the values are inserted as raw markup, injected tags and event handlers can alter the report or execute script in environments that permit active content in local HTML files. The report also lacks a Content Security Policy that could reduce the effect of successful injection. ### Attack Path 1. An attacker creates a project containing crafted dependency or module metadata with an HTML payload. 2. The attacker defines conflicting versions or an incompatible dependency combination so the ...[truncated 1181 chars]Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
解决方案:
<!-- 在父 POM 的 dependencyManagement 中统一版本 -->
<dependencyManagement>
<dependencies>
<dependency>
The skill explicitly runs project-provided Gradle tooling for analysis, which lets a malicious repository execute arbitrary build logic during what should be a read-only scan. In this skill context, the danger is elevated because users will point it at untrusted source trees and expect dependency inspection, not code execution.
The skill instructs running a local Python script and dependency-inspection shell commands, and it also generates report files, but it does not declare any explicit tool scope such as allowed-tools or permissions. That omission weakens least-privilege boundaries and can lead to unintended shell execution or file creation in the user's environment without clear policy constraints.
The trigger description includes broad phrases like any request involving Maven/Gradle dependency resolution issues in a Java/Spring Boot project, which can cause the skill to activate in situations where the user did not intend local project scanning or shell-based analysis. Over-broad triggering increases the chance of unnecessary command execution and file generation, especially when combined with undeclared tool scope.
This file contains extensive user-facing natural language in Chinese, including incompatibility descriptions, suggestions, CLI help, console output, and HTML metadata, while providing no option to select another language. That can violate the policy against forcing a specific language or locale without user opt-in.
Running Maven for dependency resolution introduces executable build behavior and side effects that are broader than parsing manifests. Although less risky than invoking a project-local Gradle wrapper, it still processes untrusted project configuration and can perform network access or trigger unsafe plugin-related behavior in an analyst environment.
This subprocess invocation executes Maven against an untrusted repository. While the command is fixed and not shell-injected, Maven dependency resolution can trigger plugin behavior, read project configuration, and perform network/file access, so analyzing a hostile project can cause unintended code execution or other side effects beyond passive inspection.
"""Run mvn dependency:tree and capture output."""
mvn_cmd = "mvn"
try:
result = subprocess.run(
[mvn_cmd, "dependency:tree", "-DoutputType=text", "--batch-mode", "-q"],
cwd=project_dir,
capture_output=True,
This subprocess call may execute ./gradlew from the target project, which is code supplied by the scanned repository. Running a project-provided wrapper is effectively arbitrary code execution in the analyst's environment and exceeds the narrow purpose of dependency conflict detection.
gradle_cmd = "gradle"
try:
result = subprocess.run(
[str(gradle_path) if gradle_path.exists() else gradle_cmd,
"dependencies", "--configuration", "compileClasspath"],
cwd=project_dir,
The skill is presented primarily in Chinese for headings and user-facing guidance, while some operational text is in English, but it never states that the response language should follow user preference. This can violate language-choice policy if the skill implicitly defaults to a language without opt-in or explicit flexibility.
The skill directs the agent to run local inspection commands and create report files but does not explicitly warn the user that shell commands will be executed against their project and that artifacts will be written to disk. This can surprise users, create unwanted files, and expose project metadata through generated reports if execution occurs without informed consent.
This markdown file uses Chinese from the title onward and does not indicate that the language choice is optional or region-specific. Under the natural-language policy rule, forcing a specific language without user opt-in can be a locale policy violation.