Skip to content
Info disclosure Disclosed report Beginner

Exploiting JSONP callback on /username/charts.json endpoint leads to information disclosure despite user's privacy settings

The /username/charts.json endpoint supports JSONP callbacks, which allows any website to retrieve a user's donation data even when the user has enabled a privacy setting to hide it. An attacker could host a malicious page that, when visited by an authenticated victim, leaks the victim's private donation information.

kapytein Follow

Originally disclosed on HackerOne

Medium 4.3 View original
  • Triaged in 9 hours
  • Fixed in 12 hours
  • Paid in 9 hours
  • Disclosed after 13 hours

Summary by the program

@kapytein submitted a wonderful report describing an XSSI vulnerability in liberapay.com. During the initial review, we thought that the endpoint did not disclose data from profiles that had disabled sharing details on their profiles. However, @kapytein did provide us with additional information that demonstrated leaking private data to a third-party website.

The report

Hello!

Vulnerability Details

The /username/charts.json endpoint can return a JSONP callback due to the fact that jsonp_dump is used in the file charts.json.spt. It appears that the content of the JSONP request depends on the authentication of the user. If the user enabled the privacy setting which hides the receiving donation data of the user, a 403 error will be returned unless the user is authenticated.

This happens here:

Python
if participant.hide_receiving:
    if user != participant and not user.is_admin:
        raise response.error(403)

The vulnerable code is here:

Python
[---] application/json via jsonp_dump

Basically, a jsonp_dump is unnecessary in this case (I did not notice a case where cross-domain requests need to be done), and it should be replaced with json_dump instead.

How could this be exploited?

This would eventually allow any site to call the JSONP callback, and receive the receiving donation data of the user, despite it's privacy settings. This will lead to unwanted information disclosure.

Proof of Concept

HTML
<script>
function rip(a) {

alert(JSON.stringify(a[1]));

}
</script>
<script src="https://liberapay.com/~153779/charts.json?callback=rip"></script>

Host this file, visit the site authenticated and it will print out the first row in the JSON Array. If you have not received any donation through LIbrapay so far, an empty JSON array will be returned.

Impact

This will lead to unwanted information disclosure due to the fact that privacy settings of the user will be ignored.

The original report as published on HackerOne, by kapytein. 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

Root cause

The endpoint uses jsonp_dump instead of json_dump, which enables cross-domain data retrieval and bypasses the privacy check for authenticated users.

Impact

This could lead to unwanted information disclosure because the user's privacy settings are ignored, allowing any site to read private donation data from authenticated users.

What the attacker needed

Victim is authenticated; victim visits attacker's site; victim has donation data

How it was found

  1. Create an HTML file with a script that defines a callback function to display the data.
  2. Include a script tag pointing to the victim's charts.json endpoint with the callback parameter.
  3. Host the file and visit it while authenticated as the victim.
  4. The callback receives the JSON array and displays the first row, leaking private donation data.

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.

JSONP is a technique that lets a website request data from another site using a script tag, bypassing the browser's same-origin policy. Here, the endpoint returns private donation data wrapped in a callback function, so any site can read it if the victim is logged in. The privacy setting that should block this is ignored because the check only applies to unauthenticated users.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by kapytein

View all

5 more disclosed reports, best first.

More from Liberapay

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.