Am I affected?
Description
Relative Path Traversal vulnerability in ex-aws ex_aws_lambda (ExAws.Lambda module) allows an attacker to redirect an AWS Lambda control-plane request at an unintended resource by injecting path traversal sequences into a caller-supplied identifier.
This vulnerability is associated with program file lib/ex_aws/lambda.ex and program routines ExAws.Lambda.add_permission/5, ExAws.Lambda.delete_event_source_mapping/1, ExAws.Lambda.delete_function/1, ExAws.Lambda.get_event_source_mapping/1, ExAws.Lambda.get_function/1, ExAws.Lambda.get_function_configuration/1, ExAws.Lambda.get_policy/1, ExAws.Lambda.invoke/4, ExAws.Lambda.invoke_async/2, ExAws.Lambda.remove_permission/2, ExAws.Lambda.update_event_source_mapping/2, ExAws.Lambda.update_function_code/2, ExAws.Lambda.update_function_configuration/2.
ExAws.Lambda builds every request path by interpolating caller-supplied identifiers (function names, ARNs, UUIDs, statement IDs) directly into the URL with plain string interpolation, without percent-encoding or validation. The shared request helper only encodes query parameters, never the path, so path metacharacters such as / and .. reach the wire unchanged. An application that passes an untrusted or user-influenced identifier into an ExAws.Lambda operation can therefore have its request steered at a different Lambda resource: a ../ segment climbs out of the intended /2015-03-31/functions/<name> slot and, once the .. is normalized by the HTTP client or the AWS endpoint, addresses a sibling function in the same account. The signed credentials and the HTTP method are unchanged, so the request still succeeds against the wrong resource. Affected operations include function deletion, invocation, configuration updates, and permission changes. Applications that only pass hardcoded or strictly validated identifiers are not affected.
This issue affects ex_aws_lambda: from 2.0.1 before 2.2.0.
Technical analysis
1. Path construction. Every operation in lib/ex_aws/lambda.ex builds its request path by interpolating a caller-supplied identifier (function_name, function_arn, uuid, source_mapping_uuid or statement_id) into a string, for example "/2015-03-31/functions/#{function_name}" in delete_function/1.
2. No encoding. The shared request/6 helper encodes only the query parameters and passes the path through to the operation verbatim, and no identifier is checked against Lambda's name and ARN character set. Path metacharacters such as /, .., ? and # reach the wire unchanged.
3. Redirected request. A .. segment climbs out of the intended /2015-03-31/functions/<name> slot. Once the HTTP client or the AWS endpoint normalizes it, the request addresses a sibling resource. The HTTP method and the signed credentials are unchanged, so the delete, invoke, configuration update or permission change succeeds against the wrong function in the same account.
Proof of concept
- An application lets a user delete their own Lambda function by name and passes the name to
ExAws.Lambda.delete_function/1 |> ExAws.request(). - The application intends to delete
tenant-a-fn; the attacker supplies the nametenant-a-fn/../victim-fn. delete_function/1interpolates it into/2015-03-31/functions/tenant-a-fn/../victim-fn, andrequest/6leaves the path untouched.- The signed
DELETErequest goes out with the literal/../in its path. - Once the
..is normalized, the request addresses/2015-03-31/functions/victim-fnand deletes a function other than the intended one.
Weaknesses & attack patterns
Weakness
CWE-23
·
Relative Path Traversal
in catalog →
MITRE ↗
Attack patterns
CAPEC-139
·
Relative Path Traversal
MITRE ↗
This is an input-validation / path-injection issue in request construction. It affects any application using ex_aws_lambda that passes user- or tenant-supplied identifiers (function_name, function_arn, uuid, source_mapping_uuid, statement_id) into ExAws.Lambda operations without sanitizing them first, typically apps that expose Lambda management behind an HTTP boundary. The consequence is cross-resource action: a control-plane call (delete, invoke, update configuration, add/remove permission) executed against a Lambda function other than the intended one, within the same account and credentials. Applications that only ever pass hardcoded or strictly validated names are unaffected.
Affected — Hex / ex_aws_lambda Hex.pm ↗ Repository ↗
modules · source files · routines
Affected — GitHub / ex-aws/ex_aws_lambda Repository ↗
modules · source files · routines
Workarounds
Validate each caller-supplied identifier against AWS Lambda's permitted name and ARN character set before passing it to an ExAws.Lambda operation, or percent-encode each identifier segment (for example URI.encode(segment, &URI.char_unreserved?/1)) so that path metacharacters cannot alter the request path.
Configurations
The affected application must pass an untrusted or user-influenced identifier (function name, ARN, UUID, source mapping UUID, or statement ID) into an ExAws.Lambda operation without first validating it against the AWS Lambda name and ARN character set. Exploitation additionally depends on the configured HTTP client or the AWS endpoint normalizing .. path segments before routing. Applications that only ever pass hardcoded or strictly validated identifiers are not affected.
References
Credits
CVSS breakdown
CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:L/SA:L
Exploitability
- Attack Vector
- Local
- Attack Complexity
- Low
- Attack Requirements
- Present
- Privileges Required
- Low
- User Interaction
- None
Vulnerable System
- Confidentiality
- None
- Integrity
- Low
- Availability
- Low
Subsequent Systems
- Confidentiality
- None
- Integrity
- Low
- Availability
- Low