Substantially weakened authenticity verification when using 'Remember me for a week'
The 'remember_user_token' cookie alone was enough to authenticate and read a user's private data, such as their bug reports and CSRF token, without the normal session cookie. Because the token was much shorter than the session cookie and appeared to encode the login time, an attacker could guess it with far less effort.
- Triaged in 11 days
- Disclosed after 14 days
Hello HackerOne,
I noticed that in order to access data bound to a user's permissions, say their own bug reports, or CSRF-token, you only need one certain cookie, which is remember_user_token, and although it is sent when the user uses HackerOne in a normal fashion, the session cookie is ignored and thus not required. This only works if the user has the "Remember me for a week" option ticked when logging in.
Both cookies are values base64-encoded values. Decoding the session cookie value results in a binary sequence of 602 bytes, and the remember_user_token results in a sequence 38 bytes wide.
Both cookies also include a trailing 20 byte value, presumably a hash value. So session comprises 602 + 20 = 622 bytes, and remember_user_token 38+20 = 58.
Being able to see confidential data with the 58 bytes rather than 622 bytes obviously lowers the amount of computing power, the number of tries in a brute-force attack, or any way you want to see it, significantly. Presupposing that both values are uniformly random data, then:
math.log10((256**622) / (256**58))
1358.2473404358832
In other words, that is 1358 orders of magnitude of difference, which is substantial.
I furthermore noticed that the various remember_user_token values that I yielded upon subsequent logins did not look random at all, but they instead looked quite similar to each other. Suspecting that the login date and time were encoded in this value, I did some statistical tests to see if I could reliably correlate the cookie value with the date and time it was set. Calculations involving these data ( cookie value -> base64 decode -> value of binary sequence as integer on one axis, login date/time as number of seconds since epoch on the other axis), eventually yielded me a 0.93 Pearson correlation coefficient for the last 8 bytes of the binary sequence in my (admittedly limited) test data. It follows that if my test data was sufficiently large to establish this degree of correlation, then knowing when a user logged in can further lower the amount of computation required to successfully guess the remember_user_token. Even if the login time is not known, an attacker can user their common sense and assume no one logged in prior to the inception of HackerOne ( < 2013 ? ) nor in the future ( say > March 2015).
Finally, it looks to me that session is frequently updated with a new value whereas remember_user_token remains constant for the remainder of the session.
To reproduce:
curl https://hackerone.com/current_user -H 'Cookie: remember_user_token={{REMEMBER_USER_TOKEN}}'
Where {{REMEMBER_USER_TOKEN}} is the value that you copy from your browser once you are logged in. This also works for bug reports in the form
https://hackerone.com/reports/[0-9]\+.json
Guido
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the 'remember me' token was accepted as a full authentication credential on its own, and it was short and partly derived from the login time rather than being long and random.
Impact
An attacker who obtained or guessed a remember_user_token could read a user's private data, and the shorter, partly predictable token could make brute-force guessing more feasible.
What the attacker needed
Victim has 'Remember me' ticked; attacker obtains or guesses the token
How it was found
- Log in with the 'Remember me for a week' option ticked.
- Copy the remember_user_token value from the browser.
- Send a request to the current_user endpoint using only that cookie.
- Observe that private data such as bug reports is returned.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you log in, a website gives your browser a cookie, which is a small piece of data that proves who you are on later visits. This report found that a special 'remember me' cookie was enough on its own to act as the user, and it was shorter and more predictable than the usual login cookie, so guessing it would be easier.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.