Back to skill

Security audit

Information Extraction

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local information-extraction helper that writes user-directed output files, with one practical caution around unsafe TSV spreadsheet export.

Install only if you are comfortable with a local skill reading provided text and writing extracted facts to chosen output files. Avoid opening TSV exports from untrusted or adversarial input in spreadsheet software unless formula execution is disabled or the data is sanitized first.

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/export_triples.py:22
Finding

Spreadsheet Formula Injection in TSV Export

Content
View full analysis

Vulnerability Details

File Location: scripts/export_triples.py, lines 22–27
Vulnerability Type: Spreadsheet formula injection caused by unsafe TSV serialization
Risk Level: Medium

Vulnerable Code

python
def export_tsv(triples, output):
    with open(output, "w", encoding="utf-8", newline="") as f:
        writer = csv.DictWriter(f, fieldnames=["subject", "predicate", "object", "evidence", "confidence"], delimiter="\t")
        writer.writeheader()
        for row in triples:
            writer.writerow({k: row.get(k) for k in writer.fieldnames})

Technical Analysis

The TSV exporter writes extracted values directly into spreadsheet-compatible cells without neutralizing formula-leading characters. Extracted fields such as subject, predicate, object, and evidence may contain attacker-controlled text.

When a cell begins with a character such as =, +, -, or @, spreadsheet applications may interpret it as a formula rather than plain text. CSV or TSV quoting alone does not reliably prevent formula evaluation because spreadsheet applications can still evaluate quoted cell contents after parsing them.

Attack Path

  1. An attacker supplies source text containing a formula-like value in an entity, attribute, relation, or evidence field.
  2. The extraction pipeline preserves that value in a generated triple.
  3. A user invokes export_triples.py with --format tsv.
  4. The malicious value is written into the TSV file without formula neutralization.
  5. The user opens the exported TSV file in spreadsheet software.
  6. The spreadsheet may evaluate the value as a formula under its applicable security policy.

Impact Assessment

Successful exploitation occurs in the context of the user opening the exported file, not in the Python process itself. Depending on the spreadsheet application and its security configuration, formula execution may:

  • Initiate external network requests and disclose data through request parameters ...[truncated 448 chars]
Remediation
View remediation

Remediation Suggestions

Neutralize every untrusted string before writing spreadsheet-compatible output:

  1. Detect cells whose first non-whitespace character is =, +, -, or @.
  2. Prefix dangerous values with a single quote or use another escaping strategy explicitly supported by the intended spreadsheet applications.
  3. Apply neutralization to all exported string fields, including subject, predicate, object, and evidence.
  4. Consider tab, carriage-return, newline, and Unicode-based bypasses when implementing validation.
  5. Preserve a separate machine-oriented JSON or JSONL export when exact, unmodified values are required.
  6. Document that exported records contain untrusted data and should not be opened with formula execution enabled.
  7. Add tests covering formula payloads, leading whitespace, multiline values, and each formula-triggering prefix.

Example hardening approach:

python
FORMULA_PREFIXES = ("=", "+", "-", "@")

def sanitize_tsv_cell(value):
    if not isinstance(value, str):
        return value
    stripped = value.lstrip()
    if stripped.startswith(FORMULA_PREFIXES):
        return "'" + value
    return value

def export_tsv(triples, output):
    fields = ["subject", "predicate", "object", "evidence", "confidence"]
    with open(output, "w", encoding="utf-8", newline="") as f:
        writer = csv.DictWriter(f, fieldnames=fields, delimiter="\t")
        writer.writeheader()
        for row in triples:
            writer.writerow({
                key: sanitize_tsv_cell(row.get(key))
                for key in fields
            })
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 (4)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description promises an extraction pipeline that converts raw unstructured text into structured facts. The actual code does not parse source text, run any extraction logic, or derive triples from documents. Instead, it reads already-produced triples from a JSON file and exports them to different serialization formats. That is a materially different primary purpose: export/serialization of existing structured data rather than information extraction. No undeclared sensitive access is evident beyond normal file I/O for reading input and writing output.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill documents and encourages use of local scripts that read and write files, but it declares no explicit tool scope such as permissions or allowed-tools. This creates a least-privilege and transparency problem: an agent may invoke file-capable operations without the skill clearly constraining or signaling that capability, increasing the chance of unintended file access or modification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The manifest frames the skill as converting unstructured text into structured facts, triples, and graph-ready records, which is primarily a transformation function. The code additionally creates directories and writes JSON to an arbitrary output path, introducing persistent filesystem side effects not stated in the description.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

This code creates directories and writes a JSON file containing extracted entities, relations, attributes, events, and evidence derived from the provided input text. While the CLI argument names imply output behavior, there is no comment, docstring, or user-facing warning that potentially sensitive input content will be persisted to disk.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.