Skip to content
XSS Disclosed report Intermediate

DOM based reflected XSS in rockstargames.com/newswire/tags through cross domain ajax request

A DOM-based reflected XSS existed in the tags parameter of a Rockstar Games newswire page. An attacker could craft a URL that caused JavaScript to execute in the victim's browser.

Mahmoud Gamal Follow

Originally disclosed on HackerOne

  • Triaged in 7 hours
  • Fixed in 8 days
  • Paid in 9 hours
  • Disclosed after 6 months

Hi, I have found a reflected XSS issue in http://www.rockstargames.com/newswire/tags which is , IMO , somekinda tricky.

#PoC:

  • URL: http://www.rockstargames.com/newswire/tags#/?tags=\%2e%2e\%2e%2e\%2e%2e\comments_dal\users\getGlobalLoginSettings%2ejson?callback=alert(%2fxss%2f);%2f%2f
  • Vulnerable Parameter: #/?tags=
  • Payload: \%2e%2e\%2e%2e\%2e%2e\comments_dal\users\getGlobalLoginSettings%2ejson?callback=alert(%2fxss%2f);%2f%2f
xss_rockstargames.png
xss_rockstargames.png From the original on HackerOne

The value of the tags parameter is sent as an XHR request to /newswire/tagContent/[tags_param]/1 and the response gets printed in the page , also I have found that if the content-type of the response is application/javascript , it gets executed as javascript. After digging for a while I found this endpoint www.rockstargames.com/comments_dal/users/getGlobalLoginSettings.json which returns a callback function in the response if the request is XHR. so I used the callback function to execute javascript through ?callback=alert(/xss/);//

Thanks!

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

Rockstar Games runs a public newswire on *.rockstargames.com. One of its features is tag browsing: a page at http://www.rockstargames.com/newswire/tags that lets a visitor look at newswire content grouped by tag. The tag is carried in the URL fragment as #/?tags=, and the page uses that value to fetch the matching tag content.

The report describes a DOM-based reflected XSS in that tag parameter. The interesting part is not a simple reflection: the researcher chained the tag parameter into an XHR path, found that a JavaScript content type makes the response execute, and then reached a second endpoint that reflects a JSONP-style callback, which gave him a way to run script.

Setup

No accounts, roles or special tooling are described. The only precondition is that the victim loads the crafted URL on www.rockstargames.com. The proof of concept uses a plain browser URL and the alert function as the executed script.

Finding it

The researcher describes the issue as "somekinda tricky", and the trickiness comes from how the tags value is used. The value of the tags parameter is sent as an XHR request to:

Text
/newswire/tagContent/[tags_param]/1

The response of that request is printed into the page. On its own that is a reflection, but the researcher also found that if the content-type of the response is application/javascript, the response gets executed as JavaScript. That second condition is what turns the reflection into script execution.

While digging further he found another endpoint on the same host:

Text
www.rockstargames.com/comments_dal/users/getGlobalLoginSettings.json

That endpoint returns a callback function in the response when the request is XHR. In other words, it reflects a callback name supplied by the caller, which is the classic JSONP pattern. The researcher used that callback to execute JavaScript.

Exploitation

Step 1: craft the tag value

The payload is placed in the fragment, in the tags parameter:

Text
\%2e%2e\%2e%2e\%2e%2e\comments_dal\users\getGlobalLoginSettings%2ejson?callback=alert(%2fxss%2f);%2f%2f

The value is a path traversal written with encoded dots (%2e is .) and backslashes as separators. Five .. segments climb out of the directory that the tag content request is built from, and the rest of the string points at comments_dal/users/getGlobalLoginSettings.json. The query string supplies the callback: callback=alert(/xss/);//. The // comments out whatever the endpoint appends after the callback name.

Step 2: deliver the full URL

The complete proof of concept URL is:

Text
http://www.rockstargames.com/newswire/tags#/?tags=\%2e%2e\%2e%2e\%2e%2e\comments_dal\users\getGlobalLoginSettings%2ejson?callback=alert(%2fxss%2f);%2f%2f

The vulnerable parameter is #/?tags=. Because the value lives after the #, it is never sent to the server as part of the initial page request; the client-side code reads it and builds the XHR itself. That is what makes this DOM-based.

Step 3: the XHR and the response

The page takes the tags value and requests:

Text
/newswire/tagContent/[tags_param]/1

With the traversal payload in place, the path resolves to the getGlobalLoginSettings.json endpoint instead of a tag content resource. The endpoint returns a callback function in its response when the request is XHR, and the query string supplies callback=alert(/xss/);//. The researcher found that responses with the application/javascript content type are executed rather than printed, and the callback supplies the alert(/xss/) call.

xss_rockstargames.png
xss_rockstargames.png From the original on HackerOne

Root cause

The chain has three parts, and each one is needed for the bug:

  1. The tags fragment value is concatenated into an XHR path without sanitising path traversal sequences, so the request can be redirected to a different endpoint on the same host.
  2. The page executes responses whose content-type is application/javascript instead of treating them as data. This is likely the design of the tag content loader, which expects a script response, but it means any endpoint reachable through the traversal can supply executable code.
  3. The getGlobalLoginSettings.json endpoint reflects a caller-supplied callback parameter when the request is XHR, the JSONP pattern. That gives the attacker a controlled JavaScript expression inside a response the page is willing to execute.

None of the three parts is enough alone. The traversal gets the request to the JSONP endpoint, the content-type handling makes the response execute, and the callback reflection supplies the code.

Impact

An attacker who gets a victim to open the crafted URL runs JavaScript in the context of www.rockstargames.com. The report does not describe what data or actions that script could reach, so the practical impact beyond script execution in the site's origin is not stated.

Fix

The report does not describe a fix or a change made after disclosure. Based on the root cause, the fixes would be to reject or normalise traversal sequences in the tags value before building the XHR path, to stop executing responses based on their content type in the tag content loader, and to restrict or validate the callback parameter on getGlobalLoginSettings.json so it cannot carry arbitrary JavaScript.

Variants to test

  • Fragment-driven XHR paths. Look for client-side code that reads a value from the fragment and concatenates it into a request path. A positive result is a request that lands on a different endpoint than intended when the value contains .. segments.
  • Content-type-driven execution. Look for loaders that execute a response when its content type is JavaScript. A positive result is a response from an unintended endpoint being executed rather than printed.
  • JSONP callback reflection. Look for endpoints that return a callback function when the request is XHR. A positive result is a response containing your callback name, which can then be reached through a traversal or redirect.
  • Encoded traversal. Try %2e and backslash separators where the client-side code builds paths, since filters often check only for literal ../.

Hunting notes

This kind of bug hides where client-side code builds request paths from URL fragments, because the value never reaches the server as part of the page request and server-side filters never see it. During recon, watch for pages whose fragment parameters appear in XHR URLs, and for loaders that treat JavaScript content types as executable. The researcher showed a single crafted URL that chains the three behaviours into script execution.

Difficulty: intermediate. The individual pieces are simple, but finding the traversal, the content-type execution and the JSONP endpoint and combining them into one working URL requires methodical digging.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

What happened, in plain words

A security researcher found a way to make a Rockstar Games website run code that he chose, just by getting someone to open a specially built web address. The site is www.rockstargames.com, and the page involved is the newswire's tag browser at http://www.rockstargames.com/newswire/tags.

To understand the trick, you need three ideas.

First, a web page is a document your browser downloads and displays. Modern pages also contain small programs written in a language called JavaScript, which the browser runs on your computer. JavaScript on a page can read what is on the page, change it, and talk to the site's servers on your behalf.

Second, a URL (web address) has parts. Everything after a # symbol is called the fragment. The browser keeps the fragment for itself: when you open a link, the part after # is not sent to the server. The page's own JavaScript can read it and act on it. That detail matters a lot here, because it means the server never sees the value and any filtering the server does is bypassed.

Third, an XSS (cross-site scripting) bug is when an attacker can get their own JavaScript to run inside a page of a site they do not control. The browser treats that script as part of the site, so it runs with the site's privileges. A DOM-based XSS is one where the page's own JavaScript takes a value from the URL and uses it unsafely, without the server being involved in the mistake.

The researcher's report calls the issue "somekinda tricky", and the trickiness is that no single mistake is enough. He had to combine three separate behaviours on the site into one chain. The rest of this article walks through that chain step by step, in the order he found it.

The setup

The report describes no accounts, no special tools and no prior access. The only thing needed is that a victim opens the crafted link in a browser on www.rockstargames.com. The proof of concept uses a plain browser address and the JavaScript function alert, which pops up a small dialogue box. Seeing that box appear is the standard way to prove that your script ran.

Finding it

The tag browser lets a visitor look at newswire content grouped by tag. The chosen tag is carried in the URL fragment as #/?tags=, and the page's JavaScript reads that value and uses it to fetch the matching content.

The researcher found that the value of the tags parameter is sent as an XHR request to:

Text
/newswire/tagContent/[tags_param]/1

An XHR (XMLHttpRequest) is simply a way for JavaScript running in a page to ask a server for data in the background, without reloading the page. Think of it as the page quietly phoning the server while you keep reading. [tags_param] is a placeholder: whatever the visitor put in the tags fragment is dropped into that spot in the address.

The response of that request is then printed into the page. On its own, that is a reflection: your input comes back to you. A reflection is not yet a vulnerability, but it becomes one if the input can be made to do something.

The researcher also found a second behaviour: if the content-type of the response is application/javascript, the response gets executed as JavaScript. The content-type is a label the server attaches to its answer, telling the browser what kind of thing it is sending, for example a picture, a web page or a script. Normally a page should treat fetched data as data. Here, the page trusted the label and ran the answer as a program. That is the second piece of the chain.

While digging further, he found another endpoint on the same host:

Text
www.rockstargames.com/comments_dal/users/getGlobalLoginSettings.json

An endpoint is a specific address on a server that does a specific job, like a counter in a shop: you go to the right counter for the service you want. This one returns a callback function in its response when the request is XHR. A callback here is a name the caller supplies, and the server wraps its data in a call to that name. This pattern is called JSONP: instead of returning plain data, the server returns a small piece of JavaScript that calls your named function with the data as an argument. It exists so that pages can fetch data across domains, but it also means the caller controls part of the code that comes back. That is the third piece of the chain.

Exploitation

Step 1: craft the tag value

The payload is placed in the fragment, in the tags parameter:

Text
\%2e%2e\%2e%2e\%2e%2e\comments_dal\users\getGlobalLoginSettings%2ejson?callback=alert(%2fxss%2f);%2f%2f

Line by line, in plain words:

  • %2e is the URL-encoded form of a dot (.). URLs cannot always carry certain characters directly, so they are written in a percent-encoded form. %2e%2e therefore means ...
  • .. is the notation for "the folder above the current one". In a file path, .. climbs up one level. Five of them in a row climb up five levels. This is called path traversal: using .. to walk out of the folder the programmer intended and into another part of the server's address space.
  • The backslashes (\) are used as separators between the parts of the path.
  • After the five .. segments, the rest of the string points at comments_dal/users/getGlobalLoginSettings.json, the endpoint the researcher wanted to reach.
  • The ? starts the query string, the part of a URL that carries extra settings. Here it carries callback=alert(/xss/);, which tells the endpoint to wrap its answer in a call to alert(/xss/).
  • The trailing // starts a comment in JavaScript. Everything after it on that line is ignored by the browser. The researcher added it so that whatever the endpoint appends after the callback name is commented out and cannot break the script.

So the whole value is a path that climbs out of the tag content folder and lands on a different endpoint, with a callback that runs alert(/xss/).

Step 2: deliver the full URL

The complete proof of concept URL is:

Text
http://www.rockstargames.com/newswire/tags#/?tags=\%2e%2e\%2e%2e\%2e%2e\comments_dal\users\getGlobalLoginSettings%2ejson?callback=alert(%2fxss%2f);%2f%2f
  • http://www.rockstargames.com/newswire/tags is the tag browser page.
  • # marks the start of the fragment. Everything after it stays in the browser and is never sent to the server as part of the page request.
  • /?tags= is the fragment parameter the page's JavaScript reads.
  • The rest is the payload from step 1.

The vulnerable parameter is #/?tags=. Because the value lives after the #, the server never sees it in the initial request. The page's own JavaScript reads it and builds the XHR itself. That is exactly what makes this DOM-based: the mistake happens in the browser, in the page's code, not on the server.

Step 3: the XHR and the response

The page takes the tags value and requests:

Text
/newswire/tagContent/[tags_param]/1

With the traversal payload in place, the path resolves to the getGlobalLoginSettings.json endpoint instead of a tag content resource. In other words, the page thinks it is asking for tag content, but the .. segments redirect the request to a different counter on the same server.

The endpoint returns a callback function in its response when the request is XHR, and the query string supplies callback=alert(/xss/);//. The researcher found that responses with the application/javascript content type are executed rather than printed, and the callback supplies the alert(/xss/) call.

xss_rockstargames.png
xss_rockstargames.png From the original on HackerOne

Root cause

The chain has three parts, and each one is needed for the bug:

  1. The tags fragment value is concatenated into an XHR path without sanitising path traversal sequences, so the request can be redirected to a different endpoint on the same host. Sanitising means cleaning or rejecting dangerous input before using it.
  2. The page executes responses whose content-type is application/javascript instead of treating them as data. This is likely the design of the tag content loader, which expects a script response, but it means any endpoint reachable through the traversal can supply executable code.
  3. The getGlobalLoginSettings.json endpoint reflects a caller-supplied callback parameter when the request is XHR, the JSONP pattern. That gives the attacker a controlled JavaScript expression inside a response the page is willing to execute.

None of the three parts is enough alone. The traversal gets the request to the JSONP endpoint, the content-type handling makes the response execute, and the callback reflection supplies the code.

Impact

An attacker who gets a victim to open the crafted URL runs JavaScript in the context of www.rockstargames.com. Running in the site's context (also called its origin) means the script is treated as if it belonged to that site, so it can do what the site's own scripts can do. The report does not describe what data or actions that script could reach, so the practical impact beyond script execution in the site's origin is not stated.

Fix

The report does not describe a fix or a change made after disclosure. Based on the root cause, the fixes would be to reject or normalise traversal sequences in the tags value before building the XHR path, to stop executing responses based on their content type in the tag content loader, and to restrict or validate the callback parameter on getGlobalLoginSettings.json so it cannot carry arbitrary JavaScript.

Variants to test

  • Fragment-driven XHR paths. Look for client-side code that reads a value from the fragment and concatenates it into a request path. A positive result is a request that lands on a different endpoint than intended when the value contains .. segments.
  • Content-type-driven execution. Look for loaders that execute a response when its content type is JavaScript. A positive result is a response from an unintended endpoint being executed rather than printed.
  • JSONP callback reflection. Look for endpoints that return a callback function when the request is XHR. A positive result is a response containing your callback name, which can then be reached through a traversal or redirect.
  • Encoded traversal. Try %2e and backslash separators where the client-side code builds paths, since filters often check only for literal ../.

Hunting notes

This kind of bug hides where client-side code builds request paths from URL fragments, because the value never reaches the server as part of the page request and server-side filters never see it. During recon (the early phase of looking around a target to see how it is built), watch for pages whose fragment parameters appear in XHR URLs, and for loaders that treat JavaScript content types as executable. The researcher showed a single crafted URL that chains the three behaviours into script execution.

Difficulty: intermediate. The individual pieces are simple, but finding the traversal, the content-type execution and the JSONP endpoint and combining them into one working URL requires methodical digging.

Glossary

  • JavaScript: the programming language that web pages run inside your browser.
  • URL: a web address; it can carry a fragment after # and a query string after ?.
  • Fragment: the part of a URL after #, kept by the browser and not sent to the server in the page request.
  • Query string: the part of a URL after ?, carrying extra settings for the server.
  • XSS (cross-site scripting): a bug that lets an attacker's JavaScript run inside a page of a site the attacker does not control.
  • DOM-based XSS: XSS where the page's own JavaScript takes a value from the URL and uses it unsafely, without the server being involved in the mistake.
  • XHR (XMLHttpRequest): a way for a page's JavaScript to ask a server for data in the background without reloading the page.
  • Endpoint: a specific address on a server that performs a specific job.
  • Content-type: a label the server attaches to its response saying what kind of thing it is sending, such as a picture, a page or a script.
  • Reflection: when input you supplied comes back to you in the response.
  • Callback: a function name supplied by the caller that the server wraps its data in.
  • JSONP: a pattern where a server returns JavaScript that calls a caller-named function with data, used to fetch data across domains.
  • Path traversal: using .. segments to climb out of the intended folder and reach another part of the server's address space.
  • URL encoding: writing characters in a percent form, such as %2e for a dot, so they can travel safely in a URL.
  • Comment: in JavaScript, text after // that the browser ignores.
  • Sanitising: cleaning or rejecting dangerous input before using it.
  • Origin (context): the site a script is treated as belonging to, which decides what it is allowed to do.
  • Recon: the early phase of looking around a target to understand how it is built.
  • Severity: a rating of how serious a bug is.

More by Mahmoud Gamal

View all

32 more disclosed reports, best first.

More from Rockstar Games

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.