T05 · Unauthorized Access and Privilege Escalation
Note
- Location
- scripts/audit-firewall.sh:56
- Finding
- Unnecessary Cloud Instance Metadata Probing<![CDATA[ ## Vulnerability Details **File Location**: `scripts/audit-firewall.sh:56-63` **Vulnerability Type**: Cloud metadata service reconnaissance beyond minimum required privileges **Risk Level**: Low ### Vulnerable Code ```bash detect_cloud_provider() { if curl -s --max-time 2 http://169.254.169.254/latest/meta-data/ >/dev/null 2>&1; then CLOUD_PROVIDER="aws" elif curl -s --max-time 2 -H "Metadata-Flavor: Google" http://metadata.google.internal/ >/dev/null 2>&1; then CLOUD_PROVIDER="gcp" elif curl -s --max-time 2 -H "Metadata: true" "http://169.254.169.254/metadata/instance?api-version=2021-02-01" >/dev/null 2>&1; then CLOUD_PROVIDER="azure" fi } ``` ### Technical Analysis Every invocation of the audit script sends requests to AWS, GCP, and Azure instance metadata endpoints until one responds. Cloud metadata services are security-sensitive because neighboring paths may expose instance identity documents, access tokens, or temporary credentials. The current implementation requests only provider root or instance metadata paths, discards the responses, uses a two-second timeout, and does not request credential endpoints. Therefore, the observed code does not steal credentials or exfiltrate metadata. However, directly contacting metadata services is unnecessary for inspecting the host firewall and exceeds the minimum network access needed for the Skill's principal function. The AWS request also does not use an IMDSv2 token. Although the requested path is not itself a credential endpoint, normalizing unauthenticated metadata access is undesirable on systems where IMDSv1 remains enabled. ### Attack Path 1. An operator invokes `scripts/audit-firewall.sh`. 2. The script sends HTTP requests to link-local or internally resolved cloud metadata services. 3. It infers the cloud provider from the first successful response. 4. If this logic were later extended or influenced to request sensitive subpaths, the same access ch ...[truncated 613 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Disable metadata probing by default and require an explicit option such as `--detect-cloud-via-metadata`. 2. Prefer local evidence that does not contact a network service, including: - DMI data under `/sys/class/dmi/id/` - Installed cloud agents - Provider-specific system files - Existing operator-supplied configuration 3. Query only the provider indicated by local evidence instead of probing all providers. 4. For AWS, use IMDSv2 with a short-lived token and reject fallback to IMDSv1. 5. Retain strict connection and total timeouts and ensure that response bodies are never logged. 6. Document metadata access prominently so operators can make an informed decision before enabling it. ]]>
