T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:69- Finding
Unverified Pre-existing COC Script Is Executed as Root
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 69-70, 209, and 229
Vulnerability Type: Untrusted cloud document reuse leading to privileged code execution
Risk Level: HighVulnerable code:
text 1. **Check existing** — Call `ListScripts --cli-region=<coc_region>` with `--name_like="coc_ssh_key_setup"`. If found, record `script_uuid` and skip step 2. 2. **Create new** — Write a JSON file with the script content, then call `CreateScript --cli-region=<coc_region> --cli-jsonInput=<file>`.json { "path": {"script_uuid": "<script_uuid>"}, "body": { "execute_param": { "execute_user": "root" } } }Technical Analysis
The workflow searches for a COC script using the non-exact
name_likefilter and reuses a returnedscript_uuid. If a matching script is found, creation of the Skill's known script body is skipped.Before execution, the workflow does not require verification of the selected document's exact name, owner, script type, canonical content, parameters, version, or cryptographic digest. The selected document is subsequently executed on the target ECS instances with
execute_userset toroot.This creates a trust-boundary violation: script content controlled by another COC document author is treated as if it were the trusted deployment script and receives the invoking user's authority to execute on the selected hosts. The behavior is inconsistent with the intended invariant that the script only installs the generated public key.
Attack Path
- An attacker who can create or modify COC documents in the relevant cloud account plants a script matching the
coc_ssh_key_setupname filter. - The planted document contains commands chosen by the attacker.
- A more privileged user invokes this Skill against ECS instances that the attacker's own permissions do not allow them to administer directly.
- `ListScripts ...[truncated 1161 chars]
- An attacker who can create or modify COC documents in the relevant cloud account plants a script matching the
- Remediation
View remediation
Remediation Suggestions
- Do not reuse a COC script solely because it matches a
name_likesearch. - Prefer creating a uniquely named, per-run script and execute only the UUID returned directly by that successful creation request.
- If reuse is required, use an exact-name lookup and reject zero, duplicate, or ambiguous matches.
- Before execution, retrieve and validate the complete script definition, including its owner, type, canonical body, parameters, and expected version.
- Compare the canonical script body against a pinned cryptographic digest and fail closed on any mismatch.
- Verify that the document contains only the expected
PUBLIC_KEYandSSH_USERparameters and that sensitive-field settings match the trusted definition. - Apply least privilege: avoid root execution when the requested SSH account and filesystem permissions allow a narrower execution identity.
- Record the validated document identity and digest in audit output so the operator can confirm exactly what was executed.
- Do not reuse a COC script solely because it matches a
