Back to skill

Security audit

APA7 Reference Helper

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent APA citation helper with a small local checker; the main risks are limited quality and test-script issues, not hidden or unsafe behavior.

Install only if a bilingual APA 7 citation helper matches your workflow. Treat the Python checker as a quick heuristic, not authoritative validation, and avoid running the smoke test with elevated privileges unless its temporary-file handling is fixed.

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
tests/smoke_test.sh:4
Finding

Predictable Temporary File Allows Symlink-Based File Overwrite

Content
View full analysis

Vulnerability Details

File Location: tests/smoke_test.sh, line 4
Vulnerability Type: Insecure predictable temporary-file handling
Risk Level: Medium

Vulnerable Code

sh
python3 scripts/apa7_quick_check.py examples/demo_references.txt >/tmp/apa7_reference_helper_smoke.txt

Technical Analysis

The smoke test redirects output to a fixed, globally predictable path in /tmp. On multi-user systems, an attacker may create /tmp/apa7_reference_helper_smoke.txt before the test runs and make it a symbolic link to another file.

Shell redirection opens the destination before launching Python. It ordinarily follows symbolic links and truncates the resolved target. No private temporary directory, exclusive file creation, ownership validation, or symbolic-link protection is used.

Successful exploitation requires the attacker to be able to create the predictable path before the victim runs the test. The linked target must also be writable by the victim account. Existing platform protections, such as Linux fs.protected_symlinks, may restrict exploitation in some environments but should not be relied upon as the application's primary defense.

Attack Path

  1. A local attacker predicts the fixed path /tmp/apa7_reference_helper_smoke.txt.
  2. Before the test runs, the attacker creates that path as a symbolic link to a file writable by the prospective test runner.
  3. The victim or CI process executes tests/smoke_test.sh.
  4. The shell processes the output redirection on line 4 and follows the symbolic link.
  5. The linked target is truncated and replaced with output from apa7_quick_check.py.
  6. The subsequent grep reads through the same path, while the original target remains corrupted.

Impact Assessment

The vulnerability permits local file corruption within the permissions of the account running the smoke test. It does not independently bypass operating-system access controls or grant arbitrary code execution.

Under a normal u ...[truncated 327 chars]

Remediation
View remediation

Remediation Suggestions

Avoid creating a temporary file when it is unnecessary. Pipe the checker output directly to grep:

sh
#!/usr/bin/env sh
set -eu
cd "$(dirname "$0")/.."

if ! python3 scripts/apa7_quick_check.py examples/demo_references.txt |
    grep -q "Checked 3 reference"; then
  echo "Smoke test failed" >&2
  exit 1
fi

echo "apa7-reference-helper smoke test passed"

If output must be retained, create a uniquely named file securely with mktemp, quote all references to it, and remove it through a trap:

sh
tmp_file="$(mktemp "${TMPDIR:-/tmp}/apa7-reference-helper.XXXXXX")"
trap 'rm -f "$tmp_file"' EXIT HUP INT TERM

python3 scripts/apa7_quick_check.py examples/demo_references.txt >"$tmp_file"
if ! grep -q "Checked 3 reference" "$tmp_file"; then
  echo "Smoke test failed" >&2
  exit 1
fi

Tests running with elevated privileges should additionally use a private, permission-restricted temporary directory and avoid shared temporary paths wherever possible.

Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The skill advertises comprehensive APA 7 formatting, auditing, and correction behavior, while the described helper script only performs lightweight structural checks on reference-list text files. This mismatch can mislead users or downstream agents into overtrusting incomplete validation, causing inaccurate academic output or unsafe automation decisions based on assumed capabilities.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The required output behavior mandates section headings and explanations in Chinese, including 问题检查表 and 文内引用示例, rather than offering a language choice. This is a natural-language policy concern because it forces a specific locale/output language by default without explicit user opt-in.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.