# AWS - Lambda Post Exploitation {{#include ../../../../banners/hacktricks-training.md}} ## Lambda Vir meer inligting, sien: {{#ref}} ../../aws-services/aws-lambda-enum.md {{#endref}} ### Exfilrtate Lambda Credentials Lambda gebruik environment variables om credentials tydens runtime in te voeg. As jy toegang daartoe kan kry (deur `/proc/self/environ` te lees of die kwesbare funksie self te gebruik), kan jy hulle self gebruik. Hulle leef in die default variable names `AWS_SESSION_TOKEN`, `AWS_SECRET_ACCESS_KEY`, and `AWS_ACCESS_KEY_ID`. By default, these will have access to write to a cloudwatch log group (the name of which is stored in `AWS_LAMBDA_LOG_GROUP_NAME`), as well as to create arbitrary log groups, however lambda functions frequently have more permissions assigned based on their intended use. ### Steal Others Lambda URL Requests 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. {{#ref}} aws-warm-lambda-persistence.md {{#endref}} ### Steal Others Lambda URL Requests & Extensions Requests Deur Lambda Layers te misbruik is dit ook moontlik om extensions te misbruik en in die Lambda te bly voortbestaan, sowel as versoeke te steel en te wysig. {{#ref}} ../../aws-persistence/aws-lambda-persistence/aws-abusing-lambda-extensions.md {{#endref}} ### AWS Lambda – VPC Egress Bypass Forceer 'n Lambda-funksie uit 'n beperkte VPC deur sy konfigurasie by te werk met 'n leë VpcConfig (SubnetIds=[], SecurityGroupIds=[]). Die funksie sal dan in die Lambda-managed networking plane loop, herwin uitgaande internettoegang en egress controls wat deur private VPC subnets without NAT afgedwing word omseil. {{#ref}} aws-lambda-vpc-egress-bypass.md {{#endref}} ### AWS Lambda – Runtime Pinning/Rollback Abuse Benut `lambda:PutRuntimeManagementConfig` om 'n funksie aan 'n spesifieke runtime-weergawe te pin (Manual) of om opdaterings te vries (FunctionUpdate). Dit behou kompatibiliteit met malicious layers/wrappers en kan die funksie op 'n verouderde, kwesbare runtime hou om exploitation en long-term persistence te vergemaklik. {{#ref}} aws-lambda-runtime-pinning-abuse.md {{#endref}} ### AWS Lambda – Log Siphon via LoggingConfig.LogGroup Redirection Benut `lambda:UpdateFunctionConfiguration` se gevorderde logging controls om 'n funksie se logs na 'n aanvaller-gekose CloudWatch Logs log group te herlei. Dit werk sonder om kode of die execution role te verander (die meeste Lambda roles sluit reeds `logs:CreateLogGroup/CreateLogStream/PutLogEvents` via `AWSLambdaBasicExecutionRole`). As die funksie secrets/request bodies uitdruk of crash met stack traces, kan jy dit uit die nuwe log group versamel. {{#ref}} aws-lambda-loggingconfig-redirection.md {{#endref}} ### AWS - Lambda Function URL Public Exposure Skakel 'n private Lambda Function URL na 'n publieke ongeauthentiseerde endpoint deur die Function URL AuthType na NONE te stel en 'n resource-based policy aan te heg wat lambda:InvokeFunctionUrl aan almal toeken. Dit maak anonieme invocation van interne funksies moontlik en kan sensitiewe backend-operasies openbaar maak. {{#ref}} aws-lambda-function-url-public-exposure.md {{#endref}} ### AWS Lambda – Event Source Mapping Target Hijack Benut `UpdateEventSourceMapping` om die target Lambda function van 'n bestaande Event Source Mapping (ESM) te verander sodat rekords van DynamoDB Streams, Kinesis, of SQS aan 'n aanvaller-beheerde funksie gestuur word. Dit lei live data stilweg af sonder om producers of die oorspronklike funksiekode aan te raak. {{#ref}} aws-lambda-event-source-mapping-target-hijack.md {{#endref}} ### AWS Lambda – EFS Mount Injection data exfiltration Benut `lambda:UpdateFunctionConfiguration` om 'n bestaande EFS Access Point aan 'n Lambda te heg, en deploy dan eenvoudige kode wat lêers van die gemounte pad lys/lees om gedeelde secrets/config te exfiltrate wat die funksie voorheen nie kon bereik nie. {{#ref}} aws-lambda-efs-mount-injection.md {{#endref}} {{#include ../../../../banners/hacktricks-training.md}}