Back to skill

Security audit

Citation Diversifier

Security checks for vulnerabilities and agentic risk

Overview

The advertised citation-budget helper is mostly coherent, but review is warranted because its script accepts unconfined file-path overrides and the package bundles broad pipeline/orchestration code outside the narrow description.

Install only if you trust the publisher and will run it on trusted workspaces. Prefer the default command without --inputs or --outputs, and avoid letting untrusted UNITS.csv or pipeline metadata choose paths until the script enforces workspace-confined reads and writes. Review whether the extra bundled pipeline/orchestration files are intended for this skill package.

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

Warning
Location
scripts/run.py:72
Finding

Unrestricted workspace path overrides allow arbitrary file reads and replacement

Content
View full analysis

Vulnerability Details

File Location: scripts/run.py:72-89, scripts/run.py:358, and tooling/common.py:25-39
Vulnerability Type: Workspace path traversal and insufficient filesystem boundary validation
Risk Level: Medium

Vulnerable Code

scripts/run.py:72-89:

python
inputs = parse_semicolon_list(args.inputs) or [
    "output/DRAFT.md",
    "outline/outline.yml",
    "outline/writer_context_packs.jsonl",
    "citations/ref.bib",
]
outputs = parse_semicolon_list(args.outputs) or ["output/CITATION_BUDGET_REPORT.md"]

draft_rel = next((p for p in inputs if p.endswith("DRAFT.md")), "output/DRAFT.md")
outline_rel = next((p for p in inputs if p.endswith("outline.yml")), "outline/outline.yml")
packs_rel = next((p for p in inputs if p.endswith("writer_context_packs.jsonl")), "outline/writer_context_packs.jsonl")
bib_rel = next((p for p in inputs if p.endswith("ref.bib")), "citations/ref.bib")

out_rel = outputs[0] if outputs else "output/CITATION_BUDGET_REPORT.md"
out_path = workspace / out_rel

draft_path = workspace / draft_rel
outline_path = workspace / outline_rel
packs_path = workspace / packs_rel
bib_path = workspace / bib_rel

scripts/run.py:358:

python
atomic_write_text(out_path, "\n".join(lines).rstrip() + "\n")

tooling/common.py:25-39:

python
def ensure_dir(path: Path) -> None:
    path.mkdir(parents=True, exist_ok=True)


def atomic_write_text(path: Path, content: str) -> None:
    ensure_dir(path.parent)
    fd, tmp_path = tempfile.mkstemp(prefix=path.name, dir=str(path.parent))
    try:
        with os.fdopen(fd, "w", encoding="utf-8") as handle:
            handle.write(content)
        os.replace(tmp_path, path)
    except Exception:
        try:
            os.unlink(tmp_path)
        except OSError:
            pass
        raise

Technical Analysis

The --inputs and --outputs arguments are parsed ...[truncated 2812 chars]

Remediation
View remediation

Remediation Suggestions

  1. Resolve and validate the workspace once:

    python
    workspace = Path(args.workspace).resolve()
    
  2. Introduce a single path-confinement helper for every input and output:

    python
    def workspace_path(workspace: Path, value: str) -> Path:
        rel = Path(value)
        if rel.is_absolute():
            raise ValueError(f"Absolute paths are not allowed: {value}")
    
        candidate = (workspace / rel).resolve()
        try:
            candidate.relative_to(workspace)
        except ValueError as exc:
            raise ValueError(f"Path escapes workspace: {value}") from exc
        return candidate
    
  3. Use this helper for draft_path, outline_path, packs_path, bib_path, and out_path before any existence check, read, directory creation, or write.

  4. Restrict output overrides to the documented output/ directory. If arbitrary output selection is unnecessary, remove --outputs entirely and always write to output/CITATION_BUDGET_REPORT.md.

  5. Validate path values obtained from UNITS.csv before forwarding them to the subprocess. Defense in depth should be implemented in both the executor and the Skill entry point.

  6. Account for symlink-based escapes. Validate resolved paths immediately before access and avoid operating in attacker-controlled parent directories where symlinks can be changed concurrently.

  7. Add regression tests covering absolute paths, ../ traversal, symlinked directories, malformed unit output fields, and valid workspace-local overrides.

Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (45)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared skill is narrowly about citation-density planning under strict guardrails: no new facts, no invented citations, only existing ref.bib keys, and per-H3 scope from outline bindings. The supplied code does not implement citation-budget planning or any citation-scoped logic. Instead, it is a general-purpose common tooling module with many unrelated utilities: atomic file writes, backups, table/YAML/JSONL I/O, status logging, approvals/checklists, pipeline lock/spec resolution, and especially query seeding for literature retrieval. That query-seeding behavior suggests expanding or structuring search queries, which is materially different from reallocating existing citations within allowed scope. There is no visible handling of citations/ref.bib keys, writer_context_packs.jsonl, evidence_bindings.jsonl, H3 citation budgets, or enforcement of the stated no-new-facts citation guardrail. Therefore the description does not accurately represent this code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is narrowly about citation-planning assistance constrained to existing references and H3 scope. The supplied code does nothing related to citations, ref.bib, writer_context_packs, evidence bindings, or citation budgeting. Instead, it is infrastructure code for running workflow units and managing pipeline execution state. Its primary purpose, triggers, and touched resources are materially different from the description, so this is a clear mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is narrowly about citation management for drafts: increasing citation density without adding facts, constrained to existing bibliography keys and H3 scope files. The supplied code does none of that. It is a substantial ideation pipeline for generating, annotating, screening, ranking, and reporting research directions from literature notes and briefs. It accesses different inputs, emits different artifacts, and serves a different primary purpose. Although both are offline content-processing tasks, the actual functionality is materially unrelated to citation budgeting, so this is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is about citation-planning for draft sections under strict citation-scope guardrails. The supplied code does nothing related to citations, H3 citation budgets, ref.bib keys, evidence bindings, or draft analysis. Instead, it implements configuration loading for pipeline spec files: reading pipeline markdown files, parsing YAML front matter, validating schema-like fields, resolving variant references, and merging overrides. While the declared description says network is none, the code also uses local filesystem access beyond the mentioned citation-related files, targeting pipeline files instead. This is a clear purpose and behavior mismatch, not just an implementation detail.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is narrowly about raising citation diversity/density by creating per-H3 citation budgets under strict no-new-facts and in-scope citation constraints. The supplied code does not implement a citation-budget planner. Instead, it is a broad validation/auditing module (tooling/quality_gate.py) for many skills in a research-writing pipeline. While it contains some citation-related checks (e.g., citation injection report status, bibliography verification counts), those are only a small subset of its behavior. Its primary purpose is quality control and artifact validation, not planning citation allocation per H3. The code also operates on many resources beyond the declared files, such as queries, outlines, section bindings, paper notes, core sets, fulltext indexes, reports, and LaTeX artifacts. Therefore the description materially misrepresents the code’s actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This is a strong mismatch. The declared description says the skill should help raise citation diversity/density by generating an in-scope citation budget plan per H3, with strict guardrails against new facts and against using citations outside existing mapped scope. The supplied code does not generate any citation plan at all. Instead, it implements a broad quality-gate system that inspects many different pipeline artifacts and returns QualityIssue objects for missing files, placeholders, weak structure, insufficient evidence, bad citation keys, poor section writing quality, merge/report failures, visuals/table completeness, and more. While some checks touch citations and scope consistency, those are only a subset of a much larger auditing capability. The primary purpose, behavior, and accessed resources are materially different from the declared skill description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is for a narrowly scoped planning tool that should help raise citation density/diversity per H3 while preserving claims and using only existing citation keys within allowed scope. The supplied code does not generate any plan or budget. Instead, it is a broad quality-gate module that inspects draft text and workspace artifacts, emits QualityIssue findings, and enforces many structural, stylistic, citation, and build-related constraints. While some checks relate to citation density, the primary behavior is auditing/validation, not citation-budget generation. It also touches numerous resources and artifact types not mentioned in the description, making this a clear description-behavior mismatch.

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 111)May include surrounding context.

md
- `python scripts/run.py --help`

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `python scripts/run.py --help`

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `python scripts/run.py --help`

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The pipeline assigns thesis-citation-enhance-review responsibilities such as expanding candidate literature and updating bibliography files, which conflicts with the cited skill context's explicit guardrails of no new facts, no invented citations, and existing-keys-only use from citations/ref.bib. This creates a specification mismatch that can cause downstream agents to exceed allowed authority, silently introduce unsupported citations, or bypass scope controls when trying to satisfy pipeline expectations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Stage 5 explicitly describes outputs like an enhanced bibliography and candidate reference expansion, which are incompatible with a no-new-facts, existing-keys-only citation skill. In practice, this kind of mismatch is dangerous because an agent following the pipeline may fabricate references, import unsanctioned sources, or change claim-to-citation mappings beyond approved evidence scope in order to fulfill the documented stage outputs.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file implements a generic workflow executor that can run arbitrary skill scripts and mutate multiple workspace control files, which is far broader than the declared purpose of a citation-diversification skill. In this skill context, that capability expansion is dangerous because a supposedly narrow, no-new-facts, no-network citation planner could be used as a vehicle for executing unrelated code and altering pipeline state, violating least privilege and user expectations.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

Launching a general-purpose script runner via subprocess is not justified by the manifest for a no-network citation-budgeting skill and materially increases attack surface. Even without shell injection, this design allows arbitrary repository code execution under the guise of a narrow document-editing helper, making abuse or accidental misuse much more damaging in this context.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

This file is a full ideation and research-direction generation module, producing brainstorm signals, direction cards, screening, shortlist, reports, and appendices. That behavior materially exceeds the declared skill scope of citation diversification with 'NO NEW FACTS' and creates a capability mismatch where invoking the skill could cause broad content generation and workspace mutation unrelated to citation budgeting.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The dispatch table in check_unit_outputs routes to validators for ideation, retrieval, taxonomy, writing, merging, global review, LaTeX, and artifact-contract auditing. That is a semantic mismatch with a manifest describing a narrowly scoped citation-diversifier that should only raise citation diversity/density within H3 scope using existing bibkeys.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill declares no explicit tool scope or permissions while its documented behavior includes reading files, writing output, and invoking a shell-based helper script. In an agent framework, missing capability scoping weakens containment and can allow broader-than-expected filesystem or command execution if the runtime grants defaults more permissive than the user expects.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The routing hints and default routing are broad enough to capture generic requests such as 'survey', 'review', and common Chinese equivalents, which can cause this pipeline to activate outside narrowly intended contexts. In an agent system, over-broad routing can misapply a powerful workflow, consume resources, and steer user tasks into unintended file-producing behavior, especially since this pipeline is marked as the default with high priority.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The title and core goal repeatedly define the skill as producing a '中文毕业论文' and later require '中文学位论文风格润色', but the document does not offer any user opt-in or alternative language path. Under the policy, forcing a specific language or locale without choice is a natural-language policy violation unless the constraint is explicitly justified as region-specific.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The routing_hints contain very broad generic terms such as "idea", "brainstorm", and multilingual equivalents that can match ordinary user requests outside this pipeline's intended scope. This can cause misrouting into a literature-grounded research pipeline when a user only wanted casual ideation, creating scope confusion, unnecessary artifact generation, and possible downstream invocation of other skills without clear user intent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest-style routing hints include generic phrases like "one-page" and "one page," which are common everyday expressions and are not specific to this literature-snapshot pipeline. Such broad triggers can cause unintended invocation because the file does not provide exclusion conditions or tighter context for when these phrases should activate the skill.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The routing hint list includes the generic phrase "peer review", which is broad enough to match many ordinary requests that may not actually require this specific pipeline. Overly broad triggers can cause misrouting, leading the agent to invoke a review workflow in inappropriate contexts and produce incorrect or unnecessary outputs based on the wrong artifact expectations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The routing hint list includes very broad terms such as "systematic" and "systematic review," which can cause this pipeline to be selected for loosely related requests rather than only true PRISMA-style review tasks. Over-broad routing increases the chance of unintended activation, misrouting, and execution of the wrong workflow, which can degrade integrity and auditability of downstream research artifacts.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The pipeline declares broad routing hints (tutorial, 教程) with a relatively high routing priority but does not include clear activation constraints or disambiguation logic. This can cause the pipeline to trigger for loosely related requests, leading to incorrect workflow execution, unintended artifact generation, or misrouting away from more appropriate pipelines.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes a skill focused on generating an in-scope citation budget plan without adding facts or citations, but this module contains numerous generic write and mutation helpers for JSONL/TSV/YAML files, status logs, decisions logs, approval checklists, checkpoint blocks, query seeding, and directory copying. Those operations materially exceed a narrow citation-diversification/planning implementation and indicate the skill codebase can alter broad workspace state unrelated to per-H3 citation budgeting.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.