T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- references/iam-agency.md:81
- Finding
- Overprivileged, Indefinite OBS Delegation to an External Service Account## Vulnerability Details **File Location**: `references/iam-agency.md`, lines 81–156 **Vulnerability Type**: Excessive cloud permissions and violation of least privilege **Risk Level**: High ### Vulnerable Code ```bash hcloud IAM CreateAgencyCustomPolicy \ --role.display_name="policy_ai4s_llma4ad" \ --role.description="AI4S LLM4AD delegation policy" \ --role.description_cn="LLM4AD cross-service delegation policy" \ --role.type="AX" \ --role.policy.Version="1.1" \ --role.policy.Statement.1.Effect="Allow" \ --role.policy.Statement.1.Action.1="iam:agencies:assume" \ --role.policy.Statement.1.Action.2="obs:bucket:CreateBucket" \ --role.policy.Statement.1.Action.3="obs:bucket:DeleteBucket" \ --role.policy.Statement.1.Action.4="obs:bucket:DeleteBucketPolicy" \ --role.policy.Statement.1.Action.5="obs:bucket:GetBucketAcl" \ --role.policy.Statement.1.Action.6="obs:bucket:GetBucketLocation" \ --role.policy.Statement.1.Action.7="obs:bucket:GetBucketPolicy" \ --role.policy.Statement.1.Action.8="obs:bucket:GetBucketQuota" \ --role.policy.Statement.1.Action.9="obs:bucket:GetBucketStorage" \ --role.policy.Statement.1.Action.10="obs:bucket:GetBucketStoragePolicy" \ --role.policy.Statement.1.Action.11="obs:bucket:GetEncryptionConfiguration" \ --role.policy.Statement.1.Action.12="obs:bucket:HeadBucket" \ --role.policy.Statement.1.Action.13="obs:bucket:ListAllMyBuckets" \ --role.policy.Statement.1.Action.14="obs:bucket:ListBucket" \ --role.policy.Statement.1.Action.15="obs:bucket:ListBucketMultipartUploads" \ --role.policy.Statement.1.Action.16="obs:bucket:PutBucketAcl" \ --role.policy.Statement.1.Action.17="obs:bucket:PutBucketPolicy" \ --role.policy.Statement.1.Action.18="obs:bucket:PutBucketQuota" \ --role.policy.Statement.1.Action.19="obs:bucket:PutEncryptionConfiguration" \ --role.policy.Statement.1.Action.20="obs:bucket:PutLifecycleConfiguration" \ --role ...[truncated 4664 chars]
- Remediation
- ## Remediation Suggestions 1. Replace the broad action list with the minimum operations required to upload and retrieve evolution results. Typically, this should be limited to necessary object upload, multipart-upload, and narrowly required listing operations. 2. Remove administrative actions that are not necessary for result upload, including: - `obs:bucket:CreateBucket` - `obs:bucket:DeleteBucket` - `obs:bucket:DeleteBucketPolicy` - `obs:bucket:PutBucketPolicy` - `obs:bucket:PutBucketAcl` - `obs:bucket:PutBucketQuota` - `obs:bucket:PutEncryptionConfiguration` - `obs:bucket:PutLifecycleConfiguration` - Object deletion and ACL-modification actions unless explicitly required. 3. Add an explicit resource restriction for the exact user-selected bucket and, where supported, its designated output prefix. 4. Add policy conditions preventing access to other buckets and prefixes, even if additional OBS actions are accidentally added later. 5. Replace `--agency.duration="FOREVER"` with the shortest duration that supports the requested task. 6. Document and automate post-task cleanup: revoke bucket authorization, detach the custom policy, and delete or disable the agency when it is no longer required. 7. Require the user to review and explicitly confirm the exact trusted principal, bucket, prefix, policy actions, and agency duration before creating the delegation. 8. Separate read, write, and destructive permissions so ordinary result upload never receives deletion or security-policy administration capabilities. 9. Validate the effective cloud policy after creation and fail closed if it is not resource-scoped to the selected bucket.
