Skip to content
XSS Write-up Intermediate

Persistent XSS to steal passwords(Paypal)

The cancelUrl parameter in Braintree's PayPal billing agreement setup was reflected unsanitised into a script context on PayPal's login page, allowing an attacker to inject JavaScript. An attacker could steal passwords typed by victims on the PayPal login page by using a popup and postMessage to exfiltrate keystrokes, despite PayPal's CSP.

Akhil Reni Follow

Published on wesecureapp.com

Note: This bug has been reported via Paypal bug bounty program and is fixed now.

user, on wesecureapp.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker could steal passwords entered on the PayPal login page, potentially on a large scale, although PayPal's CSP blocked direct exfiltration via images, fonts, or AJAX, so the attacker used a popup and postMessage instead.

What the attacker needed

Victim clicks a link; attacker can host a page; victim types on PayPal login page

The fix

The vulnerability was fixed, though the text does not specify the exact fix; it should be fixed by properly encoding or sanitising the cancelUrl parameter before reflecting it into a script context.

How it was found

  1. Send a request to Braintree's setup_billing_agreement endpoint with a malicious cancelUrl value.
  2. Receive a 302 redirect to a PayPal approval URL containing a token.
  3. Send the approval URL to the victim, who opens it and sees the PayPal login page.
  4. The malicious script runs on the PayPal page and captures keystrokes.
  5. The script sends captured data to the attacker's page via postMessage.

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 write-up has not been written yet. The Original tab links to the source.

When you click a PayPal checkout button on a website, the site sends a request to Braintree (a PayPal company) to set up a payment agreement. One of the parameters in that request, called cancelUrl, was later inserted into a PayPal login page without proper cleaning. This let an attacker put their own JavaScript code on the real PayPal login page, which could then record what the victim types, including their password.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from PayPal

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.