Back to skill

Security audit

IMA知识库上传

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed IMA knowledge-base upload guide, but it documents handling cloud credentials in command-line arguments without safety guidance.

Review this skill before installing if you will use Method B. Do not paste real COS secrets into command lines or shared agent transcripts; use short-lived, least-privilege credentials through environment variables or a protected credential provider, and verify the target knowledge-base ID before uploading.

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
SKILL.md:56
Finding
Cloud Credentials Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `SKILL.md`, lines 56–58 **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium ```javascript // Step 3: COS上传 // node skills/ima-skill/knowledge-base/scripts/cos-upload.cjs --file "file" --secret-id "..." --secret-key "..." --token "..." --bucket "..." --region "..." --cos-key "..." --content-type "application/pdf" // Step 4: add_knowledge ``` ### Technical Analysis The documented COS upload workflow instructs users or agents to provide the COS secret ID, secret key, and temporary token directly as command-line arguments. Although the shown values are placeholders rather than embedded credentials, following this pattern with real credentials can expose them through: - Process inspection utilities and system process telemetry - Shell command history - Terminal session recording - CI/CD job output and diagnostic logs - Agent tool-call records or command auditing systems Command-line arguments are generally unsuitable for secrets because they may be readable by other local processes or retained after the upload completes. Exploitation requires access to process metadata, command history, or logs containing the executed command. ### Attack Path 1. A user or agent follows the documented Method B workflow. 2. Valid COS credentials are substituted for `--secret-id`, `--secret-key`, and `--token`. 3. The upload command executes with those credentials present in its argument vector. 4. A local user, monitoring component, logging service, or other party with access to process details, shell history, or execution logs captures the arguments. 5. The exposed credentials are reused against COS before they expire or are revoked. 6. The attacker performs operations permitted by the credentials and their associated cloud policy. ### Impact Assessment Successful exploitation may disclose active cloud credentials. The resulting privileges are limited to those granted to the expos ...[truncated 402 chars]
Remediation
## Remediation Suggestions - Remove secret-bearing command-line options from the documented workflow. - Have `cos-upload.cjs` read credentials from protected environment variables, standard input, or a permission-restricted credential file. - Prefer a cloud credential provider chain or workload identity mechanism that supplies short-lived, least-privilege credentials without exposing them in commands. - If environment variables are used, ensure commands and environment dumps are not logged and that child-process inheritance is restricted where practical. - Prevent the script from printing secrets in errors, debug output, or stack traces. - Configure CI/CD and agent execution systems to redact credential values and disable shell tracing around authentication operations. - Grant the upload identity access only to the required bucket, object prefix, and operations. - Use short-lived credentials and rotate or revoke any credential passed through command-line arguments. - Document secure credential setup separately from the upload invocation, for example: ```bash read -s COS_SECRET_KEY export COS_SECRET_KEY node skills/ima-skill/knowledge-base/scripts/cos-upload.cjs \ --file "file" \ --bucket "bucket" \ --region "region" \ --cos-key "object-key" \ --content-type "application/pdf" unset COS_SECRET_KEY ``` The implementation should retrieve the secret from the protected input or environment rather than accepting it as an argument.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The manifest description says this is the standard process for uploading Markdown files to the IMA knowledge base, with Method A specifically framed as the recommended Markdown path. However, the documented Method B explicitly supports arbitrary files such as PDF and Word via create_media, COS upload, and add_knowledge, which is a broader capability than the stated Markdown-focused purpose.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The documentation includes a credential-bearing COS upload command with secret-id, secret-key, and token parameters but provides no warning about secure secret handling, shell history exposure, or data transmission risks. Users may paste sensitive credentials directly into terminals, logs, or shared transcripts, increasing the chance of credential leakage and unauthorized access to storage or related knowledge-base content.

Static analysis

No suspicious patterns detected.