# Authentication Bypass with usage of PreSignedURL

Expired PreSignedURL requests to oCIS DAV endpoint bypass signature verification, letting unauthenticated attackers download any file given known username and filename.

- Payout: $2,000
- Severity: high
- Program: ownCloud
- Found by: kolokokop
- Disclosed: 2024-03-22
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/2337427
- Library page: https://bugbountylibrary.com/r/h1%3A2337427
- Tags: area:oss domain:oss impact:data-leak kind:bounty platform:hackerone sev:high tech:go technique:incomplete-fix technique:source-review vuln:access-control vuln:auth-bypass

**Target:** ownCloud Infinite Scale (oCIS) proxy PreSignedURL auth middleware / remote.php/dav/files endpoint
**Root cause:** urlIsExpired returns a nil error when OC-Date/OC-Expires indicate expiry, so validate() treats the request as authenticated and never verifies OC-Signature against the signing key.
**Steps:**
1. Identify target oCIS instance with default PreSignedURL enabled (GET allowed).
2. Know victim username and filename (e.g. admin / secret.txt).
3. Send `GET /remote.php/dav/files/admin/secret.txt?OC-Credential=admin&OC-Verb=GET&OC-Expires=60&OC-Date=2024-01-27T00:00:00.000Z&OC-Signature=notchecked` with an already-expired OC-Date.
4. Observe file contents returned without authentication.
**How found:** Code review of services/proxy/pkg/middleware/signed_url_auth.go: noticed validate() calls urlIsExpired and that the expired branch returns nil error, skipping signature/key verification; confirmed by crafting an expired signed URL with a bogus signature.
**Exploitation:** Attacker with knowledge of username and filename crafts a PreSignedURL request with an expired OC-Date and arbitrary OC-Signature; the expiry check short-circuits signature validation, granting unauthenticated GET access to private files.
**Insight:** When auditing signed-URL/token middleware, trace every early-return branch of the expiry/validity check — a nil error on the 'expired' path often short-circuits the signature verification that follows.

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

**Unauthenticated request with forged OC-Signature to read file**

```
https://localhost:9200/remote.php/dav/files/admin/secret.txt?OC-Credential=admin&OC-Verb=GET&OC-Expires=60&OC-Date=2024-01-27T00:00:00.000Z&OC-Signature=notchecked
```

