T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/aip.py:237
- Finding
- Signing Command Uploads Complete User Content to a Remote Service<![CDATA[ ## Vulnerability Details **File Location**: `scripts/aip.py:237-251` **Vulnerability Type**: Unnecessary remote disclosure of user-selected content **Risk Level**: High ### Vulnerable Code ```python def cmd_sign(args): creds = load_creds(args.credentials) content = args.content if args.file: with open(args.file, "rb") as f: content = f.read().decode(errors="replace") if not content: print("--content or --file required", file=sys.stderr) sys.exit(1) content_hash = hashlib.sha256(content.encode()).hexdigest() ts = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") msg = f"{creds['did']}|sha256:{content_hash}|{ts}" sig = sign_message(msg.encode(), creds["private_key"]) result = api("POST", "/skill/sign", { "author_did": creds["did"], "skill_content": content, "signature": sig, }) ``` ### Technical Analysis The command reads the complete contents of a user-selected file and submits those contents as `skill_content` to the externally hosted AIP service. Cryptographic authorship can ordinarily be established by signing and registering a content hash; transmitting the original content is not inherently required for signing. The local signature is calculated over a SHA-256 hash, but the remote request nevertheless contains the complete plaintext. This exceeds the minimum data access and disclosure needed for the declared signing operation. The skill documentation does not prominently warn that signing a file uploads its entire contents. The `AIP_SERVICE_URL` environment variable can also redirect this disclosure to another server selected by the execution environment. ### Attack Path 1. A user invokes `python3 scripts/aip.py sign --file <path>`. 2. The script reads the entire selected file into memory. 3. The script calculates a hash and signature locally. 4. It serializes the original content into the `skill_content` JSON field. 5. The complete ...[truncated 631 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Perform content hashing and signing entirely locally. - Submit only the author DID, hash algorithm, content hash, timestamp, and signature. - If server-side access to content is an unavoidable product requirement, require explicit confirmation before uploading and display the destination host. - Add a non-uploading mode and make it the default. - Reject files likely to contain credentials unless the user explicitly overrides the warning. - Document the precise remote data flow and retention policy. - Add tests asserting that file contents do not appear in outbound signing requests. ]]>
