Your Password, in the Address Bar

Easy

· Backend

Incident

SEV-1

BUG-IG-1811

Priority: Critical · reported by security

Time to fix: 10 min

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

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. 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.
  4. Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  5. Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.

Inspired by

Instagram · 2018

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.

Code map

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
  };
};

Sign in to edit the file, run the tests and submit a fix

A free account — no card, no trial clock. You come straight back here.

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

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. 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.
  4. Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  5. 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 storage

The 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.