Your Password, in the Address Bar — JavaScript Bug Hunt
Modelled on Instagram's November 2018 disclosure. Instagram told some users that its "Download Your Data" tool had put their password in the URL of the page…
- Language: JavaScript
- Layer: Backend
- Difficulty: Easy
- Concepts: Security, Auth, Logging
- Modelled on: Instagram · 2018
- Visible tests: a correct password is accepted; the password is not in the URL
- Reward: 50 XP for a complete fix
Incident
- Severity: SEV-1 (priority: Critical)
- Ticket: BUG-IG-1811
- Reported by: security
- Time to fix: 10 minutes, the target for an easy incident
Failing checks on the shipped build
- the password is not in the URL — the credential must not appear in the URL: expected a truthy value but got false
How to work this incident
- Read the report: write down the expected behaviour and the actual one in a sentence each.
- Reproduce it: run the visible tests and find the failing check that matches the report.
- Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
- Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
- Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.
Briefing
Modelled on Instagram's November 2018 disclosure. Instagram told some users that its "Download Your Data" tool had put their password in the URL of the page in their browser, and that the passwords had been stored on Facebook's servers as a result. A URL ends up in browser history, proxies and server access logs, none of which treat it as a secret.
This reconstruction's client sends the credential as query parameters, and the (locked) server logs every request line.
Fix buildRequest so the password travels in the request body.
Bug report
BUG-IG-1811 · Priority: Critical · Reported by: security
buildRequest(username, password) must return: { method: "POST", url: "/accounts/data_download/request", body: { username: <username>, password: <password> } }
- the URL is exactly the path: no query string, no credential in it
- the server must still accept a correct password (200) and refuse a wrong one (403)
Observed: the access log contains lines like "GET /accounts/data_download/request?username=kai&password=…".
Logs
[edge] GET /accounts/data_download/request?username=kai&password=hunter2 200
[logs] shipped 1 access-log batch to shared storageThe code as shipped
src/privacy/downloadClient.js (editable)
var PATH = "/accounts/data_download/request";
exports.PATH = PATH;
exports.buildRequest = function (username, password) {
return {
method: "GET",
url: PATH + "?username=" + encodeURIComponent(username) + "&password=" + encodeURIComponent(password),
body: null
};
};
Read-only context: src/privacy/server.js.
Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More JavaScript bug hunts.