Back to skill

Security audit

wps-ocr

Security checks for vulnerabilities and agentic risk

Overview

This OCR skill is mostly coherent about using WPS cloud processing, but it needs Review because its command examples can expose users to shell injection and it uploads local files or URLs to a third-party service.

Install only if you are comfortable sending documents or public file URLs to WPS/Kingsoft cloud OCR. Do not use it for sensitive IDs, contracts, financial records, or confidential screenshots unless that disclosure is acceptable. Agents should invoke the Python script with an argument array or carefully quoted arguments, not by concatenating user-provided paths or URLs into a shell command.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:61
Finding

Shell Command Injection Through Unquoted User-Controlled Arguments

Content
View full analysis
# use local file: python3 skills/wps-ocr/scripts/wps_ocr.py --path ``` Equivalent instructions from `SKILL_zh.md:68-70`: ```bash # 使用下载链接: python3 skills/wps-ocr/scripts/wps_ocr.py --url <用户提供的文件 URL> # 本地文件: python3 skills/wps-ocr/scripts/wps_ocr.py --path <用户提供的文件 PATH> ``` ### Technical Analysis The execution instructions direct an AI Agent to construct a shell command by inserting a user-provided URL or local path directly into the command line. They do not require argument-array invocation, prohibit shell evaluation, or prescribe shell-safe quoting. If the Agent invokes the resulting text through a shell, metacharacters within the supplied URL or path can be interpreted by the shell before `wps_ocr.py` starts. Consequently, validation in `URLValidator` and `FileValidatorAndReader` cannot prevent this vulnerability because the injected command executes before Python receives the intended argument. The Python script itself does not construct a subprocess or invoke a shell. The vulnerability arises from the Skill's documented execution pattern and is exploitable only when the calling Agent interpolates untrusted input into a shell command as shown. ### Attack Path 1. An attacker submits an OCR request with a URL or local-file value containing shell metacharacters and an additional command. 2. The Agent follows the Skill instructions and substitutes that value directly into the documented command template. 3. The Agent executes the constructed command through a shell. 4. The shell parses the attacker-controlled metacharacters rather than passing the entire val ...[truncated 876 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:43
Finding

Unpinned Runtime Dependency Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill description understates important behaviors: it accepts remote URLs, sends user-supplied files or URLs to a third-party cloud service, and relies on a remote API rather than local OCR. This mismatch can cause users or orchestrators to invoke the skill under false assumptions, leading to unintended disclosure of sensitive documents or SSRF-style abuse if arbitrary URLs are passed to the remote service.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill uses sensitive capabilities (environment variables for credentials and outbound network access) but does not declare an explicit tool scope such as permissions or allowed-tools. This weakens policy enforcement and user visibility, making it easier for the skill to access secrets and exfiltrate file contents to an external service without clear runtime constraints.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The invocation guidance uses broad triggers like 'What text is this?' and 'Extract text' without strong exclusion criteria or privacy gating. In practice this can cause over-invocation on ordinary user uploads, increasing the chance that sensitive files are automatically sent to the external OCR service without sufficiently explicit user intent or informed consent.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill metadata declares WPS_OCR_CLIENT_SECRET as the required environment variable, but the user-facing setup instructions tell users to configure WPS_OCR_ACCESS_KEY instead. This mismatch can cause operators to misconfigure authentication, leading to failed requests, ad-hoc credential handling, or unsafe troubleshooting practices such as hardcoding secrets or bypassing expected secret-loading paths.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The trigger conditions are broad enough to match common requests like 'extract text' or 'what does this say,' which increases the chance the agent invokes the skill automatically. Because this skill uploads user-provided files to a third-party cloud service and the document explicitly states local file paths are not validated, overbroad triggering can cause unintended exfiltration of sensitive document contents.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code is presented as a lightweight local file parsing/OCR tool, but it actually sends user-supplied URLs and local file contents to a remote WPS endpoint for processing. This creates a confidentiality and trust-boundary risk because users may provide sensitive documents under the assumption processing is local.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

When a local path is provided, the file is read, base64-encoded, and transmitted to the remote OCR API without any explicit user-facing warning or confirmation at the point of upload. In the context of an OCR/file parsing skill, this is dangerous because users may process confidential scans, IDs, contracts, or other sensitive documents expecting local-only handling.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

整个技能说明以中文单一语言呈现,且未说明是否支持其他语言或允许按用户偏好切换。若组织策略要求不强制特定语言而应尊重用户语言选择,则该文档存在自然语言层面的locale约束问题。

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The code requires WPS_OCR_ACCESS_KEY from the process environment before it can operate. For a skill described purely as a lightweight file parsing/OCR utility, accessing environment-provided secrets is an additional capability not reflected in the stated purpose and may expose deployment credentials concerns beyond simple document parsing.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.