Uncover Secrets in CodeCommit and Dockerb
| 2024-7-14
字数 1233阅读时长 4 分钟
Huge Logistics has engaged your team for a security assessment. Your primary objective is to scrutinize their public repositories for overlooked credentials or sensitive information. If you discover any, use them to gain initial access to their cloud infrastructure. From there, focus on lateral and vertical movement to demonstrate impact. Your aim is to identify any security gaps so they can be closed off.
题目提供的信息:
Docker Hub
 
真实场景
一份重要的容器安全研究显示,在 337171 个镜像验证中,有 8076 个来自私有仓库并且其中的 8% 带有私钥、API 密钥等凭证数据,特别地,研究发现 52107 个私钥和 3158个 API 密钥,其中 2920 个 API 来自云服务提供商(1213个用来调用 AWS API)
 
在 dockerhub 中搜 huge-logistics-terraform-runner 镜像
notion image
 
当然也可以走 API 获取 tag 名
 
安装个 docker 插件
 
镜像分析
notion image
 
镜像漏洞查看
notion image
 
进入容器
在环境变量找到 aksk
 
当然通过 docker inspect 也能看到,还能看到镜像作者信息
 
枚举一下 aksk 权限,发现 ListRepositories 权限
 
能查看仓库列表
 
查看特定仓库
 
查看仓库分支
 
查看分支的 commitId
 
获取 commit 信息
 
看看改动了什么
 
把文件拿下来
 
base64 解码得到
 
查看桶内容拿 flag
 
防御
通过下载 https://github.com/trufflesecurity/trufflehog/releases trufflehog 工具来扫描镜像,比如
当然会有一些误报了,比如 AKIAJ5C56P35AEBRX2QQ 就是一个文档里的举例 ak
 
值得注意的是 trufflehog 不能识别镜像中文件的 AWS 密钥,或许后面可能会支持这个功能,不过我们可以这样去发现
 
进一步阅读
  1. https://www.threatdown.com/blog/docker-hub-images-found-to-expose-secrets-and-private-keys/ - 目前 dockerhub 可公开访问的镜像很多,镜像中的密钥泄露屡见不鲜
  1. https://aws.amazon.com/cn/blogs/compute/discovering-sensitive-data-in-aws-codecommit-with-aws-lambda-2/ - 通过 CodeCOmmit 的事件触发 aws lambda 扫描是否存在凭证泄漏,存在则推送事件
Loading...
目录