Back to skill

Security audit

CTF Router

Security checks for vulnerabilities and agentic risk

Overview

This CTF routing skill is purpose-aligned and disclosed, with environment setup guidance that users should run cautiously but no evidence of hidden, destructive, persistent, or exfiltrating behavior.

Install and run this only for legitimate CTF practice or contests that allow AI help. Use an isolated virtual environment or disposable container, review any generated pip or system package command before running it, avoid elevated shells unless needed, and only point the tooling at challenge files or systems you are authorized to test.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T08 · Insecure Dependencies

Warning
Location
scripts/env-check.py:153
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: scripts/env-check.py:153-156; related installation guidance in SKILL.md:10-15
Vulnerability Type: Unpinned and integrity-unverified third-party dependencies
Risk Level: Medium

Vulnerable Code

python
if missing:
    print(f"\n>>> 缺失 Python 库可一键安装:\n    {sys.executable} -m pip install "
          + " ".join(missing))
else:
    print("\n>>> Python 库齐全。")

The related instructions in SKILL.md recommend creating a virtual environment and installing the listed packages without a lockfile, exact versions, or integrity hashes:

markdown
`pwntools z3-solver sympy pycryptodome gmpy2 requests volatility3 flask-unsign
pillow numpy pyzbar python-magic-bin dnspython`.
...
`python -m venv ctf-venv` 然后装上述包。

Technical Analysis

The environment-checking script constructs a pip install command from missing package names without enforcing exact versions, package hashes, or an approved package index. Dependency resolution therefore selects whatever compatible releases are available from the configured index at installation time. The resulting environment is not reproducible and can change after the Skill has been reviewed.

If a listed package, one of its transitive dependencies, or the configured package index is compromised, installation may execute attacker-controlled build or installation logic. In addition, check_python_lib() imports installed modules to inspect their versions, which executes each package's module initialization code. The broad dependency set increases the exposed supply-chain surface.

The script only prints the installation command and does not install packages automatically. Consequently, exploitation requires a user or agent to follow the generated instruction. No evidence was found that the package names were intentionally malicious or that the project configures an untrusted package repository.

Attack

...[truncated 1376 chars]

Remediation
View remediation

Remediation Suggestions

  1. Create a reviewed requirements lockfile containing exact versions for all direct and transitive dependencies.
  2. Generate and verify cryptographic hashes for every distribution, and install with:
    bash
    python -m pip install --require-hashes -r requirements.lock
    
  3. Configure an explicitly approved package index and disable unintended fallback indexes where appropriate.
  4. Review dependency provenance and package ownership before adding or updating packages.
  5. Use automated dependency scanning and controlled update workflows to detect compromised, vulnerable, or abandoned components.
  6. Minimize the default dependency set and install specialized CTF tooling only when required.
  7. Perform installation and package imports inside an isolated, non-privileged virtual environment or disposable container.
  8. Update env-check.py to print the locked installation command rather than dynamically joining unrestricted package names.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose is routing CTF tasks, but the content also instructs environment inspection, package/tool discovery, PATH/filesystem probing, and subprocess-style platform checks such as WSL enumeration. That mismatch is dangerous because a caller expecting harmless classification may instead trigger host reconnaissance and operational setup behavior, which broadens access and creates opportunities for unintended data exposure or policy bypass.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The description uses extremely broad activation phrases like any CTF, problem-solving, flag, or challenge-related request, making accidental or overbroad invocation likely. Over-triggering is risky here because this skill contains shell and tooling guidance that can redirect agent behavior into unnecessary reconnaissance or exploit-oriented workflows even when the user intent is ambiguous.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises shell, file, and network-adjacent operational guidance but does not declare any explicit tool scope or permission boundaries. In practice this can cause an agent to use powerful capabilities implicitly, reducing auditability and increasing the chance of unexpected command execution or filesystem inspection beyond simple CTF triage.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Claiming this skill is the universal first step for all CTF-solving requests creates an unsafe routing monopoly without constraints. In context, that increases the chance that unrelated or sensitive requests are funneled into a skill that recommends invasive tooling, environment checks, and exploit-adjacent workflows before necessity is established.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/env-check.py (reported line 27)May include surrounding context.

python
def check_python_lib(name, import_name=None, note=""):
    mod = import_name or name
    try:
        m = __import__(mod)
        ver = getattr(m, "__version__", None) or getattr(m, "version", None)
        if callable(ver):
            try:

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/env-check.py (reported line 78)May include surrounding context.

python
if not wsl:
        return None
    try:
        out = subprocess.run(
            ["wsl", "--list", "--quiet"],
            capture_output=True, timeout=15,
        ).stdout.decode("utf-16-le", errors="ignore")

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/env-check.py (reported line 144)May include surrounding context.

python
print(f"{OK}WSL 发行版: {', '.join(distros)}")
        print("    建议在 Kali 内补齐: gdb / binwalk / foremost / strings / john /")
        print("    checksec / ROPgadget / strace / ltrace / upx / nmap / 字典文件")
        print("    Kali: wsl --install kali-linux; 其他发行版: sudo apt install 对应包")
    elif platform.system() == "Windows":
        print(f"{MISS}未检测到 WSL 发行版 -> wsl --install kali-linux")
        print("    (gdb/ltrace/binwalk/foremost 等 Linux 工具需要 WSL)")

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring, usage guidance, and later user-facing output are written in Chinese, which imposes a specific language on users. The policy allows locale constraints when users are given a choice or the constraint is clearly justified, but no such opt-in or justification appears here.

Content

No source excerpt is available for this finding.