Summary
Relative Path Traversal vulnerability in ex-aws exawslambda (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/exaws/lambda.ex and program routines ExAws.Lambda.addpermission/5, ExAws.Lambda.deleteeventsourcemapping/1, ExAws.Lambda.deletefunction/1, ExAws.Lambda.geteventsourcemapping/1, ExAws.Lambda.getfunction/1, ExAws.Lambda.getfunctionconfiguration/1, ExAws.Lambda.getpolicy/1, ExAws.Lambda.invoke/4, ExAws.Lambda.invokeasync/2, ExAws.Lambda.removepermission/2, ExAws.Lambda.updateeventsourcemapping/2, ExAws.Lambda.updatefunctioncode/2, ExAws.Lambda.updatefunctionconfiguration/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 exawslambda: from 2.0.1 before 2.2.0.
Details
1. Path construction. Every operation in lib/exaws/lambda.ex builds its request path by interpolating a caller-supplied identifier (functionname, functionarn, uuid, sourcemappinguuid or statementid) into a string, for example "/2015-03-31/functions/#{functionname}" in deletefunction/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
1. An application lets a user delete their own Lambda function by name and passes the name to ExAws.Lambda.deletefunction/1 |> ExAws.request(). 2. The application intends to delete tenant-a-fn; the attacker supplies the name tenant-a-fn/../victim-fn. 3. deletefunction/1 interpolates it into /2015-03-31/functions/tenant-a-fn/../victim-fn, and request/6 leaves the path untouched. 4. The signed DELETE request goes out with the literal /../ in its path. 5. Once the .. is normalized, the request addresses /2015-03-31/functions/victim-fn and deletes a function other than the intended one.
Impact
This is an input-validation / path-injection issue in request construction. It affects any application using exawslambda that passes user- or tenant-supplied identifiers (functionname, functionarn, uuid, sourcemappinguuid, statementid) 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.
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.charunreserved?/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.