# Hunting for Bucket Traversals in Google's Client Libraries

Python GCS transfer_manager.upload_chunks_concurrently built XML API URL without encoding blob.name, letting attacker-supplied names with ../ upload objects into unintended buckets.

- Payout: unconfirmed
- Severity: high
- Program: Google
- Found by: Jakub Domeracki
- Disclosed: 2025-05-17
- Write-up quality: 7/10
- Original: https://jdomeracki.github.io/2025/05/04/hunting_for_bucket_traversals/
- Library page: https://bugbountylibrary.com/r/blog%3Ajdomeracki-github-io-2025-05-04-hunting-for-bucket-traversals
- Tags: area:cloud domain:cloud impact:data-leak impact:integrity kind:bounty platform:blog sev:high tech:gcp tech:python technique:chained technique:source-review vuln:path-traversal

**Target:** google-cloud-storage Python library, transfer_manager.upload_chunks_concurrently (XML API)
**Root cause:** URL path built via string format with unencoded bucket.name and blob.name, so a blob name containing ../ escapes the intended bucket path.
**Steps:**
1. Identify that upload_chunks_concurrently constructs `url = "{hostname}/{bucket}/{blob}".format(...)` without context-specific encoding.
2. Supply a blob name containing `../<other-bucket>/<object>` from user input.
3. Call upload_chunks_concurrently() with that blob name; the request path traverses out of the intended bucket.
4. Object is written to the unintended bucket if the service account has IAM rights there.
**How found:** Followed up a prior N-day in the Go Cloud Storage client; focused audit on the XML API due to its error-prone schema and S3 interoperability, did source review plus grey-box testing and spotted the unencoded URL format string.
**Exploitation:** Attacker controls blob name passed to the library; dot-dot-slash in the name redirects the XML API upload to a different bucket the service account can write to, enabling overwrite of existing files or planting objects later consumed by the app (config override, XSS).
**Escalation:** Chained with app behavior: uploaded object becomes a config file fetched by the client, enabling config override or stored XSS in the consuming application.
**Insight:** Audit vendor SDKs that build request URLs by string formatting bucket/object names; the XML/S3-compatible API surface is more traversal-prone than JSON/RPC, and blob names are attacker-controlled in upload helpers.

## Proof of concept (copied exactly from the original report)

**Insecure URL path construction in transfer_manager**

```
url = "{hostname}/{bucket}/{blob}".format(
 hostname=hostname, bucket=bucket.name, blob=blob.name
 )
```

