AWS - Lambda Post Exploitation
Reading time: 5 minutes
tip
Jifunze na fanya mazoezi ya AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Jifunze na fanya mazoezi ya GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Jifunze na fanya mazoezi ya Azure Hacking:
HackTricks Training Azure Red Team Expert (AzRTE)
Support HackTricks
- Angalia mpango wa usajili!
- Jiunge na 💬 kikundi cha Discord au kikundi cha telegram au tufuatilie kwenye Twitter 🐦 @hacktricks_live.
- Shiriki mbinu za hacking kwa kuwasilisha PRs kwa HackTricks na HackTricks Cloud repos za github.
Lambda
Kwa maelezo zaidi angalia:
Exfilrtate Lambda Credentials
Lambda inatumia variables za mazingira kuingiza credentials wakati wa runtime. Ikiwa unaweza kupata ufikiaji kwao (kwa kusoma /proc/self/environ au kwa kutumia vulnerable function yenyewe), unaweza kuzitumia mwenyewe. Ziko katika majina ya default ya variable AWS_SESSION_TOKEN, AWS_SECRET_ACCESS_KEY, na AWS_ACCESS_KEY_ID.
Kwa default, hizi zitakuwa na uwezo wa kuandika kwenye cloudwatch log group (jina lake linalohifadhiwa katika AWS_LAMBDA_LOG_GROUP_NAME), pamoja na kuunda arbitrary log groups; hata hivyo, lambda functions mara nyingi zina ruhusa zaidi zilizotengwa kulingana na matumizi yao yaliyokusudiwa.
lambda:Delete*
Mshambuliaji aliyepewa lambda:Delete* anaweza kufuta Lambda functions, versions/aliases, layers, event source mappings na usanidi mwingine unaohusiana.
aws lambda delete-function \
--function-name <LAMBDA_NAME>
Kuiba Maombi ya URL ya Lambda ya Wengine
If an attacker somehow manage to get RCE inside a Lambda he will be able to steal other users HTTP requests to the lambda. If the requests contain sensitive information (cookies, credentials...) he will be able to steal them.
Kuiba Maombi ya URL ya Lambda ya Wengine & Maombi ya Extensions
Abusing Lambda Layers it's also possible to abuse extensions and persist in the lambda but also steal and modify requests.
AWS - Abusing Lambda Extensions
AWS Lambda – VPC Egress Bypass
Force a Lambda function out of a restricted VPC by updating its configuration with an empty VpcConfig (SubnetIds=[], SecurityGroupIds=[]). The function will then run in the Lambda-managed networking plane, regaining outbound internet access and bypassing egress controls enforced by private VPC subnets without NAT.
AWS - Lambda VPC Egress Bypass
AWS Lambda – Runtime Pinning/Rollback Abuse
Abuse lambda:PutRuntimeManagementConfig to pin a function to a specific runtime version (Manual) or freeze updates (FunctionUpdate). This preserves compatibility with malicious layers/wrappers and can keep the function on an outdated, vulnerable runtime to aid exploitation and long-term persistence.
AWS - Lambda Runtime Pinning Abuse
AWS Lambda – Log Siphon via LoggingConfig.LogGroup Redirection
Abuse lambda:UpdateFunctionConfiguration advanced logging controls to redirect a function’s logs to an attacker-chosen CloudWatch Logs log group. This works without changing code or the execution role (most Lambda roles already include logs:CreateLogGroup/CreateLogStream/PutLogEvents via AWSLambdaBasicExecutionRole). If the function prints secrets/request bodies or crashes with stack traces, you can collect them from the new log group.
AWS - Lambda LoggingConfig Redirection
AWS - Lambda Function URL Public Exposure
Turn a private Lambda Function URL into a public unauthenticated endpoint by switching the Function URL AuthType to NONE and attaching a resource-based policy that grants lambda:InvokeFunctionUrl to everyone. This enables anonymous invocation of internal functions and can expose sensitive backend operations.
AWS - Lambda Function URL Public Exposure
AWS Lambda – Event Source Mapping Target Hijack
Abuse UpdateEventSourceMapping to change the target Lambda function of an existing Event Source Mapping (ESM) so that records from DynamoDB Streams, Kinesis, or SQS are delivered to an attacker-controlled function. This silently diverts live data without touching producers or the original function code.
AWS - Lambda Event Source Mapping Hijack
AWS Lambda – EFS Mount Injection data exfiltration
Abuse lambda:UpdateFunctionConfiguration to attach an existing EFS Access Point to a Lambda, then deploy trivial code that lists/reads files from the mounted path to exfiltrate shared secrets/config that the function previously couldn’t access.
AWS - Lambda EFS Mount Injection
tip
Jifunze na fanya mazoezi ya AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Jifunze na fanya mazoezi ya GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Jifunze na fanya mazoezi ya Azure Hacking:
HackTricks Training Azure Red Team Expert (AzRTE)
Support HackTricks
- Angalia mpango wa usajili!
- Jiunge na 💬 kikundi cha Discord au kikundi cha telegram au tufuatilie kwenye Twitter 🐦 @hacktricks_live.
- Shiriki mbinu za hacking kwa kuwasilisha PRs kwa HackTricks na HackTricks Cloud repos za github.
HackTricks Cloud