Problem Statement
Why is cloud instance metadata a common target during tests?
Explanation
Metadata services often hold tokens and role details for the instance. If an app allows server-side request forgery, attackers may reach metadata and fetch credentials. Lock down egress and use modern metadata protections.
Code Solution
SolutionRead Only
AWS IMDSv2 example: curl -X PUT http://169.254.169.254/latest/api/token -H 'X-aws-ec2-metadata-token-ttl-seconds: 21600' TOKEN=... curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/
