T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- SKILL.md:18
- Finding
- Cloud Credentials Exposed to Over-Broad Subagent Workloads<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 18-25 and 41-52 **Vulnerability Type**: Excessive credential exposure and violation of least privilege **Risk Level**: High ### Vulnerable Code ```markdown Spawn a Bailian subagent when tasks involve: - **PDF parsing** - Extract text, tables, or structure from PDFs - **Article/Web reading & summarization** - Long articles, documentation pages - **Large skill content processing** - When skill files exceed normal context - **Video/Audio/Image analysis** - Multimodal content processing - **DataWorks / MaxCompute operations** - SQL execution, table management - **agent_memory table CRUD** - Read/write long-term memory - **Any task estimated >2000 tokens** - Offload to save main session ``` ```text ### Spawn Task Template 你是資料工程 subagent。 AK/SK 從環境變量讀取: - os.environ['ALICLOUD_ACCESS_KEY_ID'] - os.environ['ALICLOUD_ACCESS_KEY_SECRET'] 任務:[具體任務描述] ``` ### Technical Analysis The skill delegates a wide variety of workloads to a general-purpose subagent, including processing potentially attacker-controlled websites, documents, media, and other large inputs. The generic spawn template simultaneously tells that subagent how to retrieve Alibaba Cloud access credentials from the process environment. Credential access is not limited to the MaxCompute operations that legitimately require it. A parsing or summarization task consequently runs in a context where the delegated agent knows the credential variable names and may be able to read them. This violates least privilege and unnecessarily extends the cloud trust boundary to unrelated workloads. The instructions do not establish separate runtimes, environment allowlists, short-lived credentials, or an operation-specific proxy that would prevent a non-database subagent from accessing the secrets. ### Attack Path 1. An attacker supplies a document, website, article, or other large input that triggers subagent delegation. 2. The delegated workloa ...[truncated 1219 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Do not provide cloud credentials to general-purpose parsing, summarization, or multimodal subagents. 2. Separate MaxCompute operations into a dedicated worker with a minimal environment and narrowly scoped execution policy. 3. Remove `ALICLOUD_ACCESS_KEY_ID` and `ALICLOUD_ACCESS_KEY_SECRET` from all unrelated subagent environments using an explicit environment-variable allowlist. 4. Prefer short-lived Security Token Service credentials instead of long-lived access keys. 5. Apply an IAM policy that permits access only to the required project, table, and operations. 6. Expose database operations through a constrained interface with allowlisted queries rather than allowing arbitrary cloud SDK access. 7. Treat external documents and websites as untrusted input and prevent their contents from changing tool-use or credential-access policy. 8. Rotate the credentials if this skill has already run in an environment where untrusted delegated workloads could access them. ]]>
