AWS - CloudFront Post Exploitation

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

CloudFront

Pour plus d’informations, consultez :

AWS - CloudFront Enum

cloudfront:Delete*

Un attaquant disposant de cloudfront:Delete* peut supprimer des distributions, des policies et d’autres objets critiques de configuration du CDN — par exemple distributions, cache/origin policies, key groups, origin access identities, functions/configs et ressources associĂ©es. Cela peut provoquer une interruption de service, une perte de contenu et la suppression de configurations ou d’artefacts d’investigation forensique.

Pour supprimer une distribution, un attaquant pourrait utiliser :

aws cloudfront delete-distribution \
--id <DISTRIBUTION_ID> \
--if-match <ETAG>

Man-in-the-Middle

This blog post propose quelques scĂ©narios diffĂ©rents oĂč une Lambda pourrait ĂȘtre ajoutĂ©e (ou modifiĂ©e si elle est dĂ©jĂ  utilisĂ©e) dans une communication through CloudFront dans le but de voler des informations utilisateur (comme le cookie de session) et de modifier la response (injection d’un script JS malveillant).

scénario 1: MitM where CloudFront is configured to access some HTML of a bucket

  • CrĂ©er la function malveillante.
  • Associer celle-ci Ă  la distribution CloudFront.
  • DĂ©finir le event type sur “Viewer Response”.

En accédant à la response, vous pourriez voler le cookie des utilisateurs et injecter un JS malveillant.

scénario 2: MitM where CloudFront is already using a lambda function

  • Modifier le code de la lambda function pour voler des informations sensibles

You can check the tf code to recreate this scenarios here.

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