Back to skill

Security audit

occupation-analysis

Security checks for vulnerabilities and agentic risk

Overview

The skill is a plausible report generator, but it installs an unusually broad dependency set and can fetch arbitrary PDF URLs without clear safety limits.

Install only in an isolated virtual environment, prune or review requirements.txt before installing, avoid sudo unless you explicitly trust the package, restrict PDF fetching to known official domains, and do not store real API keys in a project .env unless it is protected and excluded from sharing.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/pdf_parser.py:65
Finding

Unrestricted URL Retrieval Enables Server-Side Request Forgery and Resource Exhaustion

Content
View full analysis

Vulnerability Details

File Location: scripts/pdf_parser.py:65-94, with attacker-controlled input declared at scripts/pdf_parser.py:374
Vulnerability Type: Unrestricted outbound request / SSRF
Risk Level: Medium

Vulnerable Code

python
def download_pdf(url: str, output_path: Optional[Path] = None, timeout: int = 30) -> Optional[Path]:
    """
    Download PDF file from URL
    
    Args:
        url: PDF file URL
        output_path: Output path (optional, defaults to temp file)
        timeout: Request timeout (seconds)
    
    Returns:
        Downloaded PDF file path, None on failure
    """
    if not url:
        print("[ERROR] URL is empty")
        return None
    
    try:
        print(f"[INFO] 正在下载PDF: {url[:80]}...")
        
        response = requests.get(url, timeout=timeout, stream=True)
        response.raise_for_status()
        
        content_type = response.headers.get('content-type', '')
        if 'pdf' not in content_type.lower():
            print(f"[WARNING] Response may not be PDF: {content_type}")
        
        if output_path is None:
            output_path = Path(tempfile.mktemp(suffix='.pdf'))
        
        output_path.parent.mkdir(parents=True, exist_ok=True)
        
        with open(output_path, 'wb') as f:
            for chunk in response.iter_content(chunk_size=8192):
                if chunk:
                    f.write(chunk)

The URL is accepted directly from a command-line argument:

python
parser.add_argument('--url', '-u', required=True, help='PDF文件URL')

Technical Analysis

The script passes a user-controlled URL directly to requests.get() without validating:

  • The URL scheme
  • The destination hostname
  • Resolved IP addresses
  • Loopback, private, link-local, or reserved address ranges
  • Redirect destinations
  • Whether the destination belongs to an approved Minist ...[truncated 2020 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict retrieval to approved HTTPS domains, such as an explicit allowlist for official Ministry of Education hosts.
  2. Reject all schemes except https.
  3. Resolve the hostname before connecting and reject loopback, private, link-local, multicast, unspecified, and reserved IP ranges for both IPv4 and IPv6.
  4. Disable redirects or validate every redirect destination using the same hostname and IP checks.
  5. Fail closed when the response content type is not an accepted PDF media type.
  6. Validate the downloaded file signature, such as the %PDF- header, before parsing it.
  7. Enforce a strict response-size limit using both Content-Length and a running byte counter while streaming.
  8. Apply separate connection and read timeouts.
  9. Use an outbound proxy or network policy that prevents access to internal and metadata networks.
  10. Replace tempfile.mktemp() with NamedTemporaryFile(delete=False) to avoid a separate temporary-file race condition.

T08 · Insecure Dependencies

Warning
Location
references/precheck_guide.md:8
Finding

Mandatory Installation of an Excessive and Unrelated Dependency Set

Content
View full analysis

Vulnerability Details

File Location: references/precheck_guide.md:8-19 and requirements.txt:1-126
Vulnerability Type: Excessive third-party dependency and supply-chain exposure
Risk Level: Medium

Vulnerable Configuration

The precheck guide presents installation of the entire dependency file as a required environment check:

markdown
## One. Environment Checklist

Before beginning any workflow, the following conditions must be verified:

| Check | Command/Method | Expected Result |
|--------|----------------|-----------------|
| Python environment | `python --version` | Python 3.8+ |
| Dependency installation | `pip install -r requirements.txt` | No errors |
| Data files present | Check `assets/moe_pdfs_final.json` | File exists |
| Occupation dictionary present | Check `assets/occupation_dictionary_split/` | Directory contains 6 files |
| Output directories | Check/create `output/` and `temp/` | Directories exist |
| IMA credentials | Check environment variable `IMA_OPENAPI_CLIENTID` | Configured |

The installed dependency file contains many capabilities unrelated to the imports found in the audited scripts, including:

text
APScheduler==3.11.2
Authlib==1.6.9
coze-coding-utils==0.2.6
coze-workload-identity==0.1.7
cozeloop==0.1.19
fastapi==0.121.2
GitPython==3.1.45
httpx==0.28.1
httpx-ws==0.8.2
keyring==23.5.0
langchain==1.0.3
langchain-core==1.0.2
langchain-openai==1.0.1
langgraph==1.0.2
langgraph-checkpoint==3.0.0
langgraph-prebuilt==1.0.2
langgraph-sdk==0.2.9
langsmith==0.4.39
openai==2.29.0
psutil==7.1.3
psycopg2-binary==2.9.11
pyinstaller==6.19.0
SecretStorage==3.3.1
supervisor==4.2.1
uvicorn==0.38.0
watchdog==6.0.0
websockets==15.0.1

Technical Analysis

The audited scripts directly require a much smaller set of libraries, primarily PDF parsers, requests, spreadsheet/data-processing libraries, and python-docx. Th ...[truncated 2482 chars]

Remediation
View remediation

Remediation Suggestions

  1. Generate a minimal runtime dependency list from actual audited imports.
  2. Retain only libraries necessary for PDF parsing, spreadsheet access, data processing, HTTP retrieval, and document generation.
  3. Move test, lint, packaging, and development tools into a separate development requirements file.
  4. Remove unused scheduler, supervisor, credential-store, AI-client, database, web-server, monitoring, and packaging dependencies.
  5. Reconcile requirements.txt with the dependency declaration in SKILL.md so there is one authoritative dependency set.
  6. Use a lock file with cryptographic hashes, such as pip hash-checking mode, to ensure artifact integrity.
  7. Install dependencies inside an isolated virtual environment without administrative privileges.
  8. Use a reviewed package index or internal mirror and disable unexpected fallback indexes.
  9. Add automated software-composition analysis and dependency-update review.
  10. Document which script requires each retained dependency.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (130)

Known Vulnerable Dependency: GitPython==3.1.45 — 16 advisory(ies): CVE-2026-78676 (GitPython: Dormant multi-line git-config values are corrupted into live injected); CVE-2026-67325 (GitPython: Command Injection via git long-option prefix abbreviation bypass of C); CVE-2026-73620 (GitPython: Unguarded git option forwarding in IndexFile.checkout() and TagRefere) +13 more

Critical
Category
Supply Chain
Confidence
99% confidence
Finding

GitPython==3.1.45 is flagged with numerous severe advisories, including command injection and unsafe git option forwarding. In an agent-oriented environment where repositories, configs, or paths may be influenced by external input, such issues can become direct code-execution or configuration-manipulation vectors.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: langchain-core==1.0.2 — 12 advisory(ies): CVE-2026-26013 (LangChain affected by SSRF via image_url token counting in ChatOpenAI.get_num_to); CVE-2025-65106 (LangChain Vulnerable to Template Injection via Attribute Access in Prompt Templa); CVE-2026-40087 (LangChain has incomplete f-string validation in prompt templates) +9 more

Critical
Category
Supply Chain
Confidence
99% confidence
Finding

langchain-core==1.0.2 has multiple severe advisories including SSRF, template injection, and incomplete prompt-template validation. In an LLM skill context, these are highly relevant because user-controlled prompts, URLs, and templates are common and can lead to internal network access, data exfiltration, or unsafe tool invocation.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: langgraph==1.0.2 — 2 advisory(ies): CVE-2026-28277 (LangGraph checkpoint loading has unsafe msgpack deserialization); CVE-2026-28277 (LangGraph SQLite Checkpoint is an implementation of LangGraph CheckpointSaver th)

Critical
Category
Supply Chain
Confidence
99% confidence
Finding

langgraph==1.0.2 is flagged for unsafe msgpack deserialization during checkpoint loading. In agent systems that persist state, loading crafted checkpoint data can become a code-execution or arbitrary object-instantiation path, making this especially dangerous in a workflow engine context.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · README.md (reported line 43)May include surrounding context.

md
pip install -r requirements.txt

# 安装 Pandoc(Ubuntu/Debian)
sudo apt-get update && sudo apt-get install -y pandoc

# 安装 Pandoc(macOS)
brew install pandoc

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This mismatch is security-relevant because the skill is presented as a local report generator, while the documented behavior includes downloading external PDFs, parsing them, and caching results. Hidden or under-disclosed network retrieval changes the trust boundary and can expose the environment to untrusted content, SSRF-like abuse through attacker-controlled URLs, or data handling beyond user expectation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This mismatch is security-relevant because the skill is presented as a local report generator, while the documented behavior includes downloading external PDFs, parsing them, and caching results. Hidden or under-disclosed network retrieval changes the trust boundary and can expose the environment to untrusted content, SSRF-like abuse through attacker-controlled URLs, or data handling beyond user expectation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

This mismatch is security-relevant because the skill is presented as a local report generator, while the documented behavior includes downloading external PDFs, parsing them, and caching results. Hidden or under-disclosed network retrieval changes the trust boundary and can expose the environment to untrusted content, SSRF-like abuse through attacker-controlled URLs, or data handling beyond user expectation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This mismatch is security-relevant because the skill is presented as a local report generator, while the documented behavior includes downloading external PDFs, parsing them, and caching results. Hidden or under-disclosed network retrieval changes the trust boundary and can expose the environment to untrusted content, SSRF-like abuse through attacker-controlled URLs, or data handling beyond user expectation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This mismatch is security-relevant because the skill is presented as a local report generator, while the documented behavior includes downloading external PDFs, parsing them, and caching results. Hidden or under-disclosed network retrieval changes the trust boundary and can expose the environment to untrusted content, SSRF-like abuse through attacker-controlled URLs, or data handling beyond user expectation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

This mismatch is security-relevant because the skill is presented as a local report generator, while the documented behavior includes downloading external PDFs, parsing them, and caching results. Hidden or under-disclosed network retrieval changes the trust boundary and can expose the environment to untrusted content, SSRF-like abuse through attacker-controlled URLs, or data handling beyond user expectation.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

Chaining privileged commands with '&& sudo' encourages unattended root-level execution of multiple system modifications in one step. This is dangerous because it compounds risk from command failure handling, supply-chain issues, and accidental execution in environments where the skill should not alter the base system.

Content

Scanner excerpt · SKILL.md (reported line 12)May include surrounding context.

md
- pypdf==3.17.0
    - python-docx==1.2.0
  system:
    - sudo apt-get update && sudo apt-get install -y pandoc
---

# 职业教育职业分析 Skill

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 514)May include surrounding context.

md
pandoc temp/report.md --reference-doc=references/reference.docx -o output/report.docx

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 653)May include surrounding context.

md
pandoc temp/report.md --reference-doc=references/reference.docx -o output/report.docx

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/precheck_guide.md (reported line 127)May include surrounding context.

md
|------|------|----------|
| Python 版本过低 | 系统安装的是 Python 2 或旧版 3.x | 安装 Python 3.8+ |
| 数据文件缺失 | 未下载或路径错误 | 检查 assets/ 目录 |
| IMA 凭证未配置 | .env 文件不存在或未加载 | 创建 .env 文件并配置环境变量 |
| 依赖安装失败 | 网络问题或版本冲突 | 使用国内镜像或更新 pip |

---

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

The command instructs users to place a client identifier directly into a .env file via shell redirection. While not inherently malicious, embedding secret-related setup in quick-start commands without safeguards increases the chance of accidental exposure through committed files, copied examples, or insecure workstation practices.

Content

Scanner excerpt · references/precheck_guide.md (reported line 146)May include surrounding context.

md
ls assets/occupation_dictionary_split/

# 4. 配置环境变量(创建 .env)
echo "IMA_OPENAPI_CLIENTID=your_client_id" > .env
echo "IMA_OPENAPI_APIKEY=your_api_key" >> .env

# 5. 运行测试

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

This line instructs users to write the API key into a .env file using a shell command. Because it handles an actual secret value, it is more sensitive than the client ID line and can directly lead to credential compromise if the file is committed, shared, backed up insecurely, or used in multi-user environments.

Content

Scanner excerpt · references/precheck_guide.md (reported line 147)May include surrounding context.

md
# 4. 配置环境变量(创建 .env)
echo "IMA_OPENAPI_CLIENTID=your_client_id" > .env
echo "IMA_OPENAPI_APIKEY=your_api_key" >> .env

# 5. 运行测试
python scripts/search_major.py --major "汽车运用与维修" --level "中等职业教育"

Known Vulnerable Dependency: Authlib==1.6.9 — 6 advisory(ies): CVE-2026-41425 (Authlib: Cross-site request forging when using cache); CVE-2026-44681 (Authlib OIDC Implicit/Hybrid Authorization Vulnerable to Open Redirect); CVE-2026-41479 (Authlib OAuth 2.0 has Open Redirect in Authorization API that allows attacker-co) +3 more

High
Category
Supply Chain
Confidence
98% confidence
Finding

The requirements pin Authlib to a version flagged with multiple advisories including CSRF and open redirect issues. In a skill stack that includes FastAPI, OAuth/OIDC libraries, and agent/web integrations, this is materially risky because Authlib is commonly used in authentication and authorization flows where these flaws can directly affect account security.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: click==8.3.1 — 1 advisory(ies): CVE-2026-7246 (Pallets Click, versions 8.3.2 and below, contain a command injection vulnerabili)

High
Category
Supply Chain
Confidence
87% confidence
Finding

click==8.3.1 is reported as vulnerable to command injection. While Click is often used only for local CLI parsing, if this skill or its tooling exposes CLI arguments derived from user-controlled input, the package weakness could contribute to command execution paths.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: cryptography==3.4.8 — 16 advisory(ies): CVE-2023-50782 (Python Cryptography package vulnerable to Bleichenbacher timing oracle attack); GHSA-537c-gmf6-5ccf (Vulnerable OpenSSL included in cryptography wheels); GHSA-5cpq-8wj7-hf2v (Vulnerable OpenSSL included in cryptography wheels) +13 more

High
Category
Supply Chain
Confidence
98% confidence
Finding

cryptography==3.4.8 is very old and has multiple published security issues, including weaknesses related to bundled OpenSSL and cryptographic side-channel exposure. Because this environment also contains Authlib, PyJWT, and OAuth-related components, weaknesses in the crypto layer can undermine token handling, TLS, and secret protection.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: httplib2==0.20.2 — 2 advisory(ies): CVE-2026-59939 (httplib2: Decompression Bomb Denial of Service via Unbounded gzip/deflate Respon); CVE-2026-59939 (httplib2 is a comprehensive HTTP client library for Python. Prior to 0.32.0, htt)

High
Category
Supply Chain
Confidence
95% confidence
Finding

httplib2==0.20.2 is reported vulnerable to decompression bomb denial of service. If the skill or supporting services fetch remote content, an attacker-controlled response could consume excessive memory or CPU and disrupt service availability.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: idna==3.11 — 2 advisory(ies): CVE-2026-45409 (Internationalized Domain Names in Applications (IDNA): Specially crafted inputs ); CVE-2026-45409 (Internationalized Domain Names in Applications (IDNA) for Python provides suppor)

High
Category
Supply Chain
Confidence
80% confidence
Finding

idna==3.11 is associated with an advisory around specially crafted internationalized domain inputs. This can affect hostname validation, normalization, or security decisions when the application handles user-supplied URLs or domains.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: langgraph-checkpoint==3.0.0 — 4 advisory(ies): CVE-2026-48775 (LangGraph Checkpoint: Unsafe JSON deserialization in checkpoint loading); CVE-2026-27794 (LangGraph: BaseCache Deserialization of Untrusted Data may lead to Remote Code E); CVE-2026-48775 (LangGraph Checkpoint: Unsafe JSON deserialization in checkpoint loading) +1 more

High
Category
Supply Chain
Confidence
99% confidence
Finding

langgraph-checkpoint==3.0.0 is associated with unsafe JSON/deserialization issues that may lead to remote code execution or state corruption. Because checkpoints are core to agent persistence and resumption, any deserialization flaw can have a direct impact on execution integrity.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: langgraph-sdk==0.2.9 — 2 advisory(ies): GHSA-w39p-vh2g-g8g5; PYSEC-2026-2575

High
Category
Supply Chain
Confidence
88% confidence
Finding

langgraph-sdk==0.2.9 is tied to published advisories, indicating known security defects in a component used to interact with LangGraph services or workflows. In an agent platform context, SDK flaws can affect remote workflow control, data handling, or trust boundaries between components.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: langsmith==0.4.39 — 7 advisory(ies): GHSA-3644-q5cj-c5c7; GHSA-f4xh-w4cj-qxq8; GHSA-rr7j-v2q5-chgv +4 more

High
Category
Supply Chain
Confidence
90% confidence
Finding

langsmith==0.4.39 is flagged by several advisories. Observability and tracing components often process prompts, outputs, metadata, and secrets, so vulnerabilities here can expose sensitive data or create pivot points into the broader agent system.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: oauthlib==3.2.0 — 2 advisory(ies): GHSA-3pgj-pg6c-r5p7; PYSEC-2022-269

High
Category
Supply Chain
Confidence
97% confidence
Finding

oauthlib==3.2.0 has known high-severity advisories and is security-sensitive by design because it underpins OAuth flows. In a stack that also includes Authlib and PyJWT, dependency flaws here can compromise authorization correctness, token handling, or redirect validation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.