Back to skill

Security audit

Paper-Code Joint Analysis

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its research-paper/code-analysis purpose, but its bundled reader-builder can recursively delete an arbitrary user-writable output directory when run with `--out` and `--force`.

Review this skill before installing in a workspace with valuable writable files. If used, keep analysis in a fresh project directory, do not pass a custom `--out` path, and avoid `--force` unless the output is the expected generated `site/` directory. Use `--install-katex-fonts` only when CDN access is acceptable.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/build_static_reader.py:117
Finding

Arbitrary Recursive Directory Deletion Through User-Controlled Output Path

Content
View full analysis

Vulnerability Details

File Location: scripts/build_static_reader.py:117, 129, 141-146
Vulnerability Type: Unrestricted recursive directory deletion
Risk Level: High

Vulnerable Code

python
parser.add_argument(
    "--out",
    default=None,
    help="Output site directory. Defaults to <analysis_dir>/site.",
)
parser.add_argument(
    "--force",
    action="store_true",
    help="Overwrite an existing site directory.",
)

# ...

out_dir = Path(args.out).resolve() if args.out else analysis_dir / "site"
if out_dir.exists() and args.force:
    shutil.rmtree(out_dir)
elif out_dir.exists() and any(out_dir.iterdir()):
    raise SystemExit(
        f"output directory exists and is not empty: {out_dir}; use --force"
    )
copytree_contents(template, out_dir)

Technical Analysis

The --out argument accepts an arbitrary filesystem path. When --force is supplied, the resolved path is passed directly to shutil.rmtree() without enforcing any safety boundary.

The implementation does not verify that:

  • out_dir is a child of the supplied analysis directory;
  • out_dir is the expected generated site directory;
  • out_dir differs from analysis_dir;
  • the target was previously created by this application;
  • the target is not a filesystem root, home directory, repository root, or another valuable writable directory.

Calling Path.resolve() canonicalizes the path but does not make deletion safe. It does not restrict the target to an authorized directory.

This behavior exceeds the minimum filesystem privileges needed to rebuild a static reader. The application only needs to replace its own generated site files, not recursively delete any directory selected by the caller.

Attack Path

  1. An attacker, unsafe automation workflow, or misleading instruction controls the command used to invoke the reader builder.
  2. The attacker supplies a valuable writa ...[truncated 1420 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict generated output to a dedicated child directory of analysis_dir, preferably exactly analysis_dir/site.

  2. If custom output directories must remain supported, verify containment after canonicalization:

    python
    analysis_dir = Path(args.analysis_dir).resolve()
    out_dir = (
        Path(args.out).resolve()
        if args.out
        else (analysis_dir / "site").resolve()
    )
    
    if out_dir == analysis_dir or analysis_dir not in out_dir.parents:
        raise SystemExit(
            "output directory must be a child of the analysis directory"
        )
    
  3. Explicitly reject dangerous targets, including filesystem roots, the current working directory, the user's home directory, and the project or analysis root.

  4. Create a generator-specific marker file inside generated sites, such as .paper-code-reader-generated.

  5. Permit recursive replacement only when that marker exists and is a regular file inside the selected output directory.

  6. Avoid deleting the whole directory where possible. Remove or replace only the known files generated by the reader builder.

  7. Check for symbolic-link and path-race conditions immediately before deletion.

  8. Add regression tests that ensure --force rejects:

    • --out equal to analysis_dir;
    • parent directories of analysis_dir;
    • arbitrary external directories;
    • filesystem roots;
    • existing directories without the generator marker.
  9. Consider requiring an additional explicit confirmation option for deletion of any non-default generated output path.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (25)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding is partially valid because the visible skill file is heavily procedural and artifact-oriented, yet does not itself define enforcement boundaries ensuring that the promised repository inspection and theory-to-code mapping are implemented safely and accurately. In practice this can mislead operators into trusting the skill to perform deeper analysis than the packaged logic may support, which is risky in security-sensitive or high-assurance review workflows.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
internalized as a local module, so execution depends only on this skill's own `SKILL.md`, `modules/`, `references/`, `scripts/`, and `assets/`.

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · assets/reader-template/index.html (reported line 1)May include surrounding context.

html
<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · assets/reader-template/vendor/mermaid.min.js (reported line 12)May include surrounding context.

js
;var d=typeof s;return(d=="number"?v9(u)&&BX(s,u.length):d=="string"&&s in u)?gD(u[s],i):!1}function yRt(i){return FX(function(s,u){var d=-1,p=u.length,v=p>1?u[p-1]:void 0,b=p>2?u[2]:void 0;for(v=i.length>3&&typeof v=="function"?(p--,v):void 0,b&&JF(u[0],u[1],b)&&(v=p<3?void 0:v,p=1),s=Object(s);++d<p;){var y=u[d];y&&i(s,y,d,v)}return s})}var xRt=yRt(function(i,s,u){uje(i,s,u)});const RX=xRt,dje="​",kRt={curveBasis:BF,curveBasisClosed:INt,curveBasisOpen:ONt,curveBumpX:MNt,curveBumpY:DNt,curveBundle:NNt,curveCardinalClosed:BNt,curveCardinalOpen:FNt,curveCardinal:PNt,curveCatmullRomClosed:jNt,curveCatmullRomOpen:$Nt,curveCatmullRom:RNt,curveLinear:xp,curveLinearClosed:zNt,curveMonotoneX:qNt,curveMonotoneY:HNt,curveNatural:VNt,curveStep:UNt,curveStepAfter:KNt,curveStepBefore:GNt},ERt=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,TRt=function(i,s){const u=gje(i,/(?:init\b)|(?:initialize\b)/);let d={};if(Array.isArray(u)){const b=u.map(y=>y.args);CX(b),d=t

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill explicitly instructs use of file reads/writes, shell execution, and optional network access, but it does not declare any tool scope or permissions boundary. In an agentic environment, missing explicit least-privilege constraints increases the chance that the skill is invoked with broader capabilities than necessary, enabling unintended filesystem changes, command execution, or outbound access during analysis.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file states that the default user-facing language is Chinese and instructs reports and explanations to be written in Chinese unless the user explicitly requests another language. This imposes a locale/language default rather than offering a neutral choice up front, which matches the policy category for language or locale constraints without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This line requires the reader's visible UI and analysis text to be Chinese by default, which is another explicit language-policy constraint. Because the file does not frame this as a region-specific tool or require prior user opt-in, it falls under the natural-language policy violation category.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file hard-codes user-facing messages in Chinese throughout the UI, including errors, headings, and status text, without any indication that the user can choose another language. This is a natural-language policy concern because it imposes a specific language/locale on all users without opt-in or documented regional justification.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module mandates a fixed output language/length target ('at least 12,000 Chinese/English characters') without user opt-in. This can override user preference, cause unwanted language selection or excessive output generation, and degrade usability or policy compliance in downstream contexts where concise or single-language answers are required.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Line L011 states the report should usually be at least 12,000 Chinese/English characters, which imposes a language/locale constraint in the skill instructions. The file does not offer the user a language choice or explain a justified region-specific requirement, so this is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Line L003 states that user-facing analysis output is Chinese by default, and later lines reinforce Chinese-visible output requirements. This imposes a specific language/locale choice in the skill contract without offering the user an explicit choice or documenting a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest frames this skill as jointly analyzing a paper and its open-source implementation, producing reports, mappings, and a static reader. However, the instructions explicitly include a network-enabled asset download path (--install-katex-fonts) to fetch WOFF2 fonts, which is ancillary UI enhancement rather than an obvious requirement for the core analysis task.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document declares lang="zh-CN", which fixes the interface locale to Simplified Chinese. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern unless the locale restriction is documented and justified, which is not evident in this file.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.obfuscated_code

Potential obfuscated payload detected.

Warn
Code
suspicious.obfuscated_code
Location
assets/reader-template/vendor/mermaid.min.js:371