Back to skill

Security audit

paper-reader

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherently built for academic paper review, but it needs Review because it can send full paper text and notes to a Codex subprocess while inheriting the user's environment variables.

Install only if you are comfortable having paper text and notes processed by Codex. Use it in an isolated workspace with a scrubbed environment for confidential manuscripts, and review generated notes, receipts, index changes, and any Git diff before committing or pushing.

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/review.py:54
Finding

Untrusted document content is passed to a tool-capable Codex agent

Content
View full analysis

Vulnerability Details

File Location: scripts/review.py, lines 54–68
Vulnerability Type: Indirect prompt injection across an untrusted document-to-agent boundary
Risk Level: Medium

Complete Code Snippet

python
prompt = task + "\n<ORIGINAL_SOURCE>\n" + source_text + "\n</ORIGINAL_SOURCE>\n<NOTES>\n" + note_text + "\n</NOTES>\n"
receipt.parent.mkdir(parents=True, exist_ok=True)
attempts = []
answer = None
with tempfile.TemporaryDirectory(prefix="paper-review-") as temporary:
    result = Path(temporary) / "review.txt"
    command = [
        "codex", "exec", "--skip-git-repo-check", "--ephemeral",
        "-s", "read-only", "-m", "gpt-6-sol",
        "-c", "model_reasoning_effort=high",
        "--output-last-message", str(result), "-"
    ]
    try:
        code, stdout, stderr = run(command, prompt, temporary, codex_timeout, os.environ.copy())

Technical Analysis

The script concatenates the complete contents of the source paper and notes into a natural-language prompt and submits that prompt to codex exec. Source papers can originate from external publishers or other untrusted content providers.

The preceding task text tells Codex that the documents are untrusted and instructs it not to use tools. However, this restriction is enforced only through natural-language instructions. The subprocess is still a Codex agent invocation, and the selected read-only sandbox limits writes rather than technically disabling command tools or all reads.

The subprocess also inherits the parent process's complete environment through os.environ.copy(). Consequently, if adversarial document text successfully overrides or confuses the prompt-level instructions, the resulting agent execution may attempt to inspect readable local data or inherited environment variables. Any retrieved information could then be incorporated into the review returned through --output-last-message.

The issue does not demonstrate malicious intent by the Skill aut ...[truncated 1709 chars]

Remediation
View remediation

Remediation Suggestions

  1. Invoke the reviewer in a mode that technically disables shell, file, network, and other command tools rather than relying solely on prompt instructions.
  2. Run the reviewer inside a dedicated container or equivalent operating-system sandbox that exposes only copied source and notes files.
  3. Replace os.environ.copy() with a minimal allowlisted environment containing only variables required to launch Codex. Explicitly exclude credentials, tokens, proxy secrets, and unrelated application configuration.
  4. Deny outbound network access for the review subprocess unless it is strictly required.
  5. Continue treating papers and notes as untrusted data, but add structural isolation where supported, such as a data-only attachment mechanism rather than direct prompt concatenation.
  6. Treat generated reviews as untrusted output. Inspect them for unexpected secret-like values or irrelevant system information before storing, publishing, or incorporating them into persistent notes.
  7. Add regression tests using prompt-injection documents that request environment inspection, local file access, tool execution, or instruction override, and verify that these operations are technically unavailable.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
97% confidence
Finding

Passing os.environ.copy() to the external Codex subprocess exposes the full parent environment, which may include API keys, cloud credentials, repository tokens, proxy settings, or internal configuration secrets. In a tool that processes untrusted document content and invokes an external agentic CLI, broad environment inheritance unnecessarily expands the blast radius if the subprocess, its plugins, or downstream services log, misuse, or exfiltrate those values.

Content

Scanner excerpt · scripts/review.py (reported line 66)May include surrounding context.

python
"--output-last-message", str(result), "-"
        ]
        try:
            code, stdout, stderr = run(command, prompt, temporary, codex_timeout, os.environ.copy())
        except OSError as error:
            code, stdout, stderr = 127, "", type(error).__name__
        attempts.append({"backend": "codex", "exitCode": code, "timeout": code == 124})

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill instructs the agent to read files, use shell commands, invoke Python scripts, access a default repository path, and interact with Git, but it does not declare any explicit tool scope or permissions boundaries. This creates an authorization gap where an agent runtime may grant broader-than-necessary filesystem or shell access, increasing the risk of unintended file modification, data exposure, or command misuse.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description and all operational instructions are written to require responses and workflow in Chinese, including Chinese status labels and command conventions, with no indication that the user may opt into another language. This is a natural-language locale policy issue because the skill imposes a specific language behavior without documenting user choice or a justified region-specific constraint.

Content

No source excerpt is available for this finding.

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/review.py (reported line 13)May include surrounding context.

python
def run(cmd, prompt, cwd, timeout, env):
    process = subprocess.Popen(
        cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
        text=True, cwd=cwd, env=env, start_new_session=True
    )

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script automatically sends the full paper source and notes to an external Codex process, which can involve transmission of sensitive or proprietary research content outside the local workflow. That conflicts with the skill description's claim that submission follows user authorization, creating a consent and data-governance gap that is especially risky in a paper-review skill handling unpublished manuscripts or confidential notes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The instruction string explicitly says Respond in Chinese., imposing a fixed language on all outputs. This is a natural-language policy concern because the file provides no user opt-in, locale selection, or justification for enforcing a specific language.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

At the transmission point, the script sends user-provided notes and source text to an external model subprocess without an explicit warning or confirmation. In this context, that means potentially sensitive paper contents, reviewer notes, or unpublished results may be exported without adequate notice, increasing confidentiality and compliance risk.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The top-level docstring describes the skill as 'read-only', which contradicts the actual behavior of creating a receipt JSON file and a review output file. This is not merely omitted detail: the phrase 'read-only' actively suggests no file modifications, while the code performs writes as part of normal operation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.