Summary
Amazon AWS Systems Manager Agent contains a server-side request forgery vulnerability in its port forwarding to remote hosts functionality. An authenticated remote user may bypass destination denylist checks using an equivalent representation of a blocked address, potentially reaching link-local endpoints and obtaining temporary IAM role credentials.
Affected context
The vulnerability occurs in AWS SSM Agent deployments that permit authenticated users to establish port forwarding connections to remote hosts. Risk is present when destination filtering relies on textual address comparisons and does not normalize equivalent representations of link-local or otherwise denied destinations before applying denylist rules.
Exploit preconditions
- Attack surface: SSM Agent port forwarding to remote hosts
- Required access: An authenticated remote user with permission to use the relevant port forwarding capability
- Trigger point: Validation of the requested remote destination before a forwarding connection is established
- Why exploitation is possible: Alternate address representations may evade denylist comparisons while resolving to a restricted link-local endpoint
Why this happens
The underlying bug is insufficient canonicalization and validation of network destination addresses. When security decisions compare an attacker-controlled host value without normalizing equivalent representations, a denied address may be expressed in another valid form and bypass filtering.
This maps primarily to CWE-918: Server-Side Request Forgery, because the agent can be induced to make a request to an attacker-selected internal destination. It also relates to CWE-1289: Improper Validation of Unsafe Equivalence, where distinct textual inputs are treated inconsistently even though they identify the same security-sensitive resource.
Potential impact
- An attacker may reach link-local services that should be inaccessible through the forwarding feature
- Temporary IAM role credentials may be exposed
- The attacker could act with the managed instance's IAM permissions from outside the instance
- Cloud resources and data may be accessed, modified, or deleted according to the compromised role
- Further compromise or lateral movement may be possible in affected environments
General mitigation guidance
Mitigation generally focuses on canonicalizing destination values before authorization decisions and using a deny-by-default network policy.
Common defensive patterns include:
- Resolve and normalize destination addresses before applying allowlists or denylists
- Validate all equivalent address representations, including numeric, encoded, and mapped forms
- Prefer explicit allowlists for permitted forwarding destinations
- Restrict port forwarding permissions to users and roles that require them
- Limit instance role permissions according to least-privilege principles
- Reduce access to link-local metadata and management endpoints through network controls
- Monitor and restrict exposure of temporary instance credentials
How teams detect issues like this
Detection can combine configuration review, authorization analysis, and network monitoring.
Useful approaches include:
- Review destination validation for missing canonicalization before denylist or allowlist checks
- Use static analysis and code review rules for comparisons against raw attacker-controlled host values
- Test address-validation policies against equivalent representations and DNS resolution outcomes
- Monitor SSM port forwarding activity involving link-local, metadata, or other internal address ranges
- Alert on unusual requests for instance role credentials or cloud API activity from unexpected source locations
- Enforce IAM and network policies that prevent forwarding sessions from reaching sensitive internal endpoints

