AWS - CloudFront Post Exploitation

Tip

学习并练习 AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking: HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks

CloudFront

更多信息请参见:

AWS - CloudFront Enum

cloudfront:Delete*

被授予 cloudfront:Delete* 的攻击者可以删除 distributions、policies 以及其他关键的 CDN 配置对象——例如 distributions、cache/origin policies、key groups、origin access identities、functions/configs 及相关资源。此类操作可能导致服务中断、内容丢失,以及配置或取证证据的移除。

要删除 distribution,攻击者可以使用:

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

Man-in-the-Middle

这篇 blog post 提出几个不同的场景,在这些场景中,可以将一个 Lambda 添加(如果已经在使用则可修改)到通过 CloudFront 的通信中,目的是 stealing 用户信息(例如会话 cookie)并 modifying the response(注入恶意 JS 脚本)。

scenario 1: MitM where CloudFront is configured to access some HTML of a bucket

  • 创建 恶意的 function
  • 关联 它到 CloudFront distribution。
  • event type 设置为 “Viewer Response”

访问该 response 后,你可以 steal 用户的 cookie 并注入恶意 JS

scenario 2: MitM where CloudFront is already using a lambda function

  • Modify the code 修改 lambda function 的代码以 steal 敏感信息

你可以查看 tf code to recreate this scenarios here.

Tip

学习并练习 AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking: HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks