Back to skill

Security audit

TencentCloud General OCR

Security checks for vulnerabilities and agentic risk

Overview

This Tencent Cloud OCR skill is mostly coherent, but it can upload any readable local file passed as an image path to Tencent Cloud without validating that it is actually an image.

Review before installing. Use this skill only for images you are comfortable sending to Tencent Cloud under your Tencent account, and avoid passing arbitrary local paths or sensitive documents unless you have verified they are intended image inputs. Prefer a pinned SDK version and consider adding image-type validation plus an explicit upload confirmation step.

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

Warning
Location
scripts/main.py:57
Finding
Arbitrary Local Files Can Be Uploaded Without Image Validation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/main.py`, lines 57–76 and 158–159 **Vulnerability Type**: Insufficient input and file-type validation **Risk Level**: Medium ### Vulnerable Code ```python if os.path.isfile(value): with open(value, "rb") as f: raw = f.read() # If the file content is already Base64 text, use it directly try: raw_str = raw.decode("utf-8").strip() base64.b64decode(raw_str, validate=True) return raw_str except (UnicodeDecodeError, ValueError): pass # Otherwise, encode the binary file as Base64 if len(raw) > MAX_IMAGE_SIZE_BYTES: print( f"Error: Image file exceeds the " f"{MAX_IMAGE_SIZE_BYTES // (1024 * 1024)}MB limit", file=sys.stderr, ) sys.exit(1) encoded = base64.b64encode(raw).decode("utf-8") return encoded ``` The returned content is subsequently assigned directly to the OCR request: ```python elif args.image_base64: req.ImageBase64 = load_image_base64(args.image_base64) ``` ### Technical Analysis The `--image-base64` argument accepts either Base64 data or an arbitrary local file path. When the supplied value points to an existing file, the script reads the complete file and sends its Base64 representation to Tencent Cloud through the OCR request. The implementation only applies a size limit. It does not verify that the selected file is a supported PNG, JPEG, or BMP image through magic-byte inspection or trusted image decoding. It also accepts any syntactically valid Base64 text file without verifying that the decoded bytes represent an image. Base64 encoding does not protect confidentiality; it merely changes the representation of the source bytes. Consequently, a non-image file containing credentials, configuration, tokens, or other private information can be encoded and transmitted to the external OCR service. This behavior is related to the declared OCR function beca ...[truncated 1525 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate decoded content before transmission using both file signatures and a trusted image decoder. 2. Allow only the formats documented by the Skill, such as PNG, JPEG, and BMP. 3. Reject Base64 text unless its decoded bytes successfully validate as a supported image. 4. Apply the size limit to decoded image bytes in every input path, including Base64 text files. 5. Where practical, restrict local inputs to an explicitly approved working directory. 6. Require explicit user confirmation before uploading a local file, displaying its canonical path, detected format, and destination. 7. Clearly disclose that local image content is sent to Tencent Cloud for processing. 8. Add tests confirming that text files, credential files, malformed images, polyglot files, and Base64-encoded non-image data are rejected. ]]>

T08 · Insecure Dependencies

Note
Location
SKILL.md:31
Finding
Unpinned Runtime Dependency Installation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 31–34 **Vulnerability Type**: Unpinned third-party dependency **Risk Level**: Low ### Vulnerable Code ```markdown - Python 3.6+ - Dependency: `tencentcloud-sdk-python` (install with `pip install tencentcloud-sdk-python`) - Environment variables: - `TENCENTCLOUD_SECRET_ID` - `TENCENTCLOUD_SECRET_KEY` ``` ### Technical Analysis The installation instruction retrieves `tencentcloud-sdk-python` without a fixed version, lock file, or integrity hash. Package resolution may therefore select a different release or different transitive dependency versions at each installation. The package name and API use are consistent with the documented Tencent Cloud SDK, and the reviewed project does not use a suspicious package index or typographically deceptive package name. Nevertheless, trusting an unconstrained future release makes installation non-reproducible and expands the supply-chain trust boundary. If the package or one of its dependencies is compromised, malicious code could execute during installation, import, or SDK use with the privileges of the user running the Skill. ### Attack Path 1. A user follows the documented command: ```bash pip install tencentcloud-sdk-python ``` 2. `pip` resolves the latest compatible package and transitive dependencies from its configured package index. 3. A compromised or unexpectedly changed release is downloaded because no audited version or hash is required. 4. Malicious package code executes during installation or when imported by `scripts/main.py`. 5. The dependency may access data available to the process, including the Tencent Cloud credentials loaded by the Skill. This path depends on an upstream package, dependency, or package-index compromise; no malicious dependency was found in the project itself. ### Impact Assessment A compromised dependency would run with the same operating-system privileges as the invoking user. It could potent ...[truncated 399 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin `tencentcloud-sdk-python` to a specifically reviewed version. 2. Maintain a lock file that fixes all transitive dependency versions. 3. Use hash-verified installation, such as a requirements file with `--hash` entries and `pip install --require-hashes`. 4. Install dependencies in an isolated virtual environment rather than into a privileged or shared Python environment. 5. Review and regularly update pinned dependencies through a controlled process. 6. Use a trusted package index and disable unapproved additional indexes to reduce dependency-confusion risk. 7. Add automated dependency vulnerability and provenance checks to the release process. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill requires access to environment variables containing cloud API credentials, but it does not declare any explicit tool scope or permissions boundary. This weakens least-privilege controls and makes credential use opaque to reviewers and orchestrators, increasing the chance of unintended secret access or misuse.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill describes OCR functionality and required credentials but does not warn that image contents will be transmitted to an external cloud provider and processed using account-linked API keys. Users may unknowingly expose sensitive images, IDs, ads, or embedded personal/business data to a third party without informed consent.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The activation criteria are very broad, including essentially any OCR-related request, which can cause the skill to trigger in situations where users did not intend to send images or extracted text to Tencent Cloud. Overbroad routing increases the risk of unnecessary third-party data disclosure and accidental credential-backed API usage.

Static analysis

No suspicious patterns detected.