RXSS on TikTok endpoints
Two TikTok incentive endpoints reflected user-supplied data without HTML escaping or output encoding. An attacker could inject a JavaScript payload that executes in a victim's browser context.
- Triaged in 7 days
- Fixed in 23 days
- Paid in 23 days
- Disclosed after 29 days
Summary by the program
A Cross-Site Scripting (XSS) vulnerability was found on two TikTok incentive endpoints, due to the reflection of user-supplied data without appropriate HTML escaping or output encoding. As a result, a JavaScript payload could be injected into the affected endpoint causing it to be executed within the context of a user's browser. We thank @ashrafabdelrazik for reporting this to our team.
What the report shows
The target is TikTok's web estate, scoped to *.tiktok.com, and the affected feature is a pair of incentive endpoints. The weakness class recorded for the finding is reflected cross-site scripting, rated medium severity with a CVSS score of 4.7. The report was disclosed on 9 January 2024 and credits the researcher @ashrafabdelrazik with the discovery.
The summary describes the mechanism in a single sentence: user-supplied data was reflected by the endpoints without appropriate HTML escaping or output encoding. Because of that, a JavaScript payload could be injected into the affected endpoint and would then execute within the context of a user's browser.
The report does not include the endpoint paths, the parameter names, the exact payload used, the HTTP request or response, or any reproduction steps. It also does not state whether a bounty was paid or what the fix was. What it does establish is the class of bug, the affected asset, the two-endpoint scope and that the reflection was of user-supplied data.
Root cause
The root cause the report points to is missing output encoding. Data that a user controls reaches the HTML response of the incentive endpoints and is written into the page without being escaped for the HTML context it lands in. When reflected input is placed into an HTML document unescaped, characters that are meaningful to the parser, such as angle brackets, are interpreted as markup rather than as text, which lets an attacker introduce a script element or an event handler attribute.
The report frames this as a failure of both escaping and output encoding. Whether the reflection sat in an HTML body, an attribute or a script block is not stated, and the correct encoding depends on which of those it was.
Impact
According to the report, an attacker could inject a JavaScript payload into the affected endpoint and have it execute in a victim's browser in the context of the TikTok origin. That is the standard consequence of reflected XSS: script running with the trust of the site, able to act as the victim against that origin.
The report does not describe a specific attack chain, does not say what session or account state the endpoints expose, and does not claim any particular data could be read or action performed. The severity rating is medium with a CVSS of 4.7, but the report itself gives no scoring breakdown. Treat the impact as bounded by what the report says: script execution in a user's browser on the affected endpoints.
How this kind of bug works
Reflected XSS arises when an application takes input from the current request and includes it in the response without encoding it for the context in which it appears. The browser receives a document that the server has assembled from trusted markup and untrusted input, and it has no way to tell the two apart. If the input contains syntax that the HTML parser recognises, the parser builds it into the document tree, and any script that results runs under the origin of the page.
The context matters. Input placed between tags needs < and > neutralised. Input placed inside an attribute needs quotes handled. Input placed inside a <script> block or a URL attribute such as href or src needs a different treatment again, because HTML entity encoding is not sufficient there. This is why generic escaping applied in the wrong place still leaves the bug open.
The defences that stop it are output encoding applied at the point of rendering, chosen for the destination context, combined with a Content Security Policy that restricts inline and third-party script, and, where the value is also stored or reused, input validation as a secondary layer. Framework templating engines that auto-escape by default remove most of this class, provided developers do not opt out of escaping for the value in question.
How to test for it
- Map the endpoints that echo something back. Search parameters, path segments, error messages, redirect targets and anything that appears in the rendered page are candidates. Incentive, referral, promo and campaign pages are common homes for this because they are built quickly and often take identifiers from the URL.
- Send a benign marker first, such as a unique alphanumeric string, and confirm where it appears in the response body. Note the exact context: between tags, inside an attribute, inside a script block, or in a URL.
- Send context-appropriate probe characters and inspect the raw response, not the rendered page. Look for whether
<,>,",'and&come back unchanged or encoded. - If the raw response reflects unencoded markup characters, escalate to a payload that would execute in that context, and confirm execution in a browser rather than relying on the response alone.
- Check whether a web application firewall or client-side filter alters the payload, and whether encoding tricks change what reaches the sink.
A positive result is a response in which attacker-controlled syntax survives into the document and a browser executes it. Common false positives are reflections that are already entity-encoded, reflections that land in a context where the characters are inert, payloads that only appear in the response but are stripped before rendering, and self-XSS where the input is only ever reflected to the person who submitted it. A reflection that requires the victim to paste something into a console is not a finding.
How it is fixed
Apply output encoding at the point where untrusted data is written into the response, matched to the context: HTML entity encoding for element content and quoted attributes, JavaScript encoding for script blocks, and URL encoding for URL components. Prefer templating engines with auto-escaping enabled by default and review any place escaping is explicitly disabled. Add a restrictive Content Security Policy as defence in depth, and validate or allowlist input where the value has a known expected shape. For values that are reflected, ensure the encoding happens on output rather than relying on filtering on input.
Hunting notes
Reflected XSS tends to hide in places where a parameter is used to build a page rather than to fetch data: search results, error and not-found pages, language and locale switches, redirect and return-url parameters, and marketing or incentive landing pages that personalise content from the query string. Parameters that look like they were added for tracking or campaign attribution are worth attention because they are often echoed into the page without going through the same review as core features.
Recon signals include endpoints that return HTML with the request's own values in the body, parameters that survive a round trip into the rendered page, and older or less-travelled parts of a large domain. Comparing the raw response with the rendered DOM quickly shows whether encoding is happening server-side or only in the browser.
To make a report land, show the full request and response, state the exact context of the reflection, and demonstrate execution with a minimal payload in a browser, including which browser and version. Explain what the script can do in that origin, such as acting on the victim's behalf, and note any user interaction required. If a filter blocks obvious payloads, document the bypass precisely rather than describing it vaguely. Programs accept reflected XSS most readily when the proof is reproducible from a clean session and the impact is tied to something the origin actually protects.
What happened, in plain words
TikTok runs a bug bounty programme on HackerOne, which means outside researchers can report security problems and the company reviews them. This report is about two TikTok "incentive" endpoints. An endpoint is simply a web address on a site that does something when your browser asks for it, for example a page that shows you a reward or a promotion. "Incentive" here means a feature designed to encourage users, such as a reward or campaign page.
The researcher credited in the report is @ashrafabdelrazik. The affected asset is recorded as *.tiktok.com, meaning any web address under the tiktok.com domain. The weakness is classified as reflected cross-site scripting, often shortened to reflected XSS. It was rated medium severity with a CVSS score of 4.7, and the report was disclosed on 9 January 2024.
The programme's own summary explains the mechanism in one sentence: user-supplied data was reflected by the endpoints without appropriate HTML escaping or output encoding. Because of that, a JavaScript payload could be injected into the affected endpoint and would then execute within the context of a user's browser.
To unpack that, imagine a website as a form that a clerk fills in for you. When you type something into a search box, the site often repeats it back: "You searched for ...". That repeating back is called reflection. The danger is that the site may repeat your text as if it were part of the page's own instructions rather than as plain text. A browser cannot tell the difference between instructions the site wrote and text a visitor supplied, unless the site marks the visitor's text as text. That marking is called escaping or output encoding. When it is missing, text that looks like code is treated as code, and the browser runs it. That is reflected XSS.
The report does not include the endpoint paths, the parameter names, the exact payload used, the HTTP request or response, or any reproduction steps. It also does not say whether a bounty was paid or what the fix was. What it does establish is the class of bug, the affected asset, the two-endpoint scope, and that the reflection was of user-supplied data.
In general, how this kind of bug works
Reflected XSS happens when an application takes input from the current request and includes it in the response without encoding it for the context in which it appears. The browser receives a document assembled from trusted markup and untrusted input, and it has no way to tell the two apart. If the input contains syntax the HTML parser recognises, the parser builds it into the document tree, and any script that results runs under the origin of the page. The origin is the combination of scheme, host and port, such as https://www.tiktok.com; script running there is treated as coming from TikTok itself.
The context matters. Input placed between tags needs < and > neutralised. Input placed inside an attribute needs quotes handled. Input placed inside a <script> block or a URL attribute such as href or src needs a different treatment again, because HTML entity encoding is not sufficient there. This is why generic escaping applied in the wrong place still leaves the bug open.
The defences that stop it are output encoding applied at the point of rendering, chosen for the destination context, combined with a Content Security Policy that restricts inline and third-party script, and, where the value is also stored or reused, input validation as a secondary layer. Framework templating engines that auto-escape by default remove most of this class, provided developers do not opt out of escaping for the value in question.
How to test for it
- Map the endpoints that echo something back. Search parameters, path segments, error messages, redirect targets and anything that appears in the rendered page are candidates. Incentive, referral, promo and campaign pages are common homes for this because they are built quickly and often take identifiers from the URL.
- Send a benign marker first, such as a unique alphanumeric string, and confirm where it appears in the response body. Note the exact context: between tags, inside an attribute, inside a script block, or in a URL.
- Send context-appropriate probe characters and inspect the raw response, not the rendered page. Look for whether
<,>,",'and&come back unchanged or encoded. - If the raw response reflects unencoded markup characters, escalate to a payload that would execute in that context, and confirm execution in a browser rather than relying on the response alone.
- Check whether a web application firewall or client-side filter alters the payload, and whether encoding tricks change what reaches the sink.
A positive result is a response in which attacker-controlled syntax survives into the document and a browser executes it. Common false positives are reflections that are already entity-encoded, reflections that land in a context where the characters are inert, payloads that only appear in the response but are stripped before rendering, and self-XSS where the input is only ever reflected to the person who submitted it. A reflection that requires the victim to paste something into a console is not a finding.
How it is fixed
Apply output encoding at the point where untrusted data is written into the response, matched to the context: HTML entity encoding for element content and quoted attributes, JavaScript encoding for script blocks, and URL encoding for URL components. Prefer templating engines with auto-escaping enabled by default and review any place escaping is explicitly disabled. Add a restrictive Content Security Policy as defence in depth, and validate or allowlist input where the value has a known expected shape. For values that are reflected, ensure the encoding happens on output rather than relying on filtering on input.
Hunting notes
Reflected XSS tends to hide in places where a parameter is used to build a page rather than to fetch data: search results, error and not-found pages, language and locale switches, redirect and return-url parameters, and marketing or incentive landing pages that personalise content from the query string. Parameters that look like they were added for tracking or campaign attribution are worth attention because they are often echoed into the page without going through the same review as core features.
Recon signals include endpoints that return HTML with the request's own values in the body, parameters that survive a round trip into the rendered page, and older or less-travelled parts of a large domain. Comparing the raw response with the rendered DOM quickly shows whether encoding is happening server-side or only in the browser.
To make a report land, show the full request and response, state the exact context of the reflection, and demonstrate execution with a minimal payload in a browser, including which browser and version. Explain what the script can do in that origin, such as acting on the victim's behalf, and note any user interaction required. If a filter blocks obvious payloads, document the bypass precisely rather than describing it vaguely. Programs accept reflected XSS most readily when the proof is reproducible from a clean session and the impact is tied to something the origin actually protects.
Glossary
- Endpoint: a specific web address on a site that performs an action when requested, such as a page or an API route.
- Bug bounty programme: a scheme where a company pays or credits outside researchers for reporting security problems.
- Reflected XSS: a bug where input from a request is echoed back into the page without proper encoding, so a browser may run it as code.
- Payload: the piece of input an attacker sends to trigger the bug, here JavaScript intended to run in the browser.
- Escaping / output encoding: converting characters that have special meaning in a document into harmless equivalents so they are shown as text, not interpreted as code.
- HTML: the language that describes the structure of a web page, made of tags such as
<script>. - HTML parser: the part of a browser that reads HTML and builds the page from it.
- JavaScript: the programming language browsers run to make pages interactive.
- Context: the place in a document where input lands (between tags, inside an attribute, inside a script block, in a URL), which determines the correct encoding.
- Origin: the scheme, host and port of a page, such as
https://www.tiktok.com; script running in that origin is trusted as that site. - Attribute: a setting written inside an HTML tag, such as
hreforsrc. - Content Security Policy (CSP): a response header that tells the browser which scripts and sources are allowed, limiting the damage of injected script.
- Input validation: checking that input matches an expected shape before using it.
- Allowlist: a list of values that are explicitly permitted, with everything else rejected.
- Templating engine: software that builds pages from templates and data, often escaping values automatically.
- Web application firewall (WAF): a filter in front of a site that inspects requests and blocks ones that look malicious.
- Sink: the place in code where untrusted data is finally written into the output.
- Self-XSS: a case where input is only reflected back to the person who entered it, so no other user can be attacked.
- DOM: the browser's in-memory model of the page, built from the HTML.
- CVSS: a standard scoring system for the severity of a vulnerability, from 0 to 10.
- Severity: a rating of how serious a bug is, here medium.
- Query string: the part of a URL after the
?, carrying parameters such as tracking values. - Session: the state a site keeps for a logged-in user, usually tied to a cookie.
- Cookie: a small piece of data a site stores in your browser and sends back with requests, often used to identify your session.
- Token: a value used to prove identity or authorise an action, often stored in a cookie or sent in a header.
- Recon: the information-gathering phase of testing, mapping what a site exposes before trying anything.
- False positive: a result that looks like a bug but is not exploitable in practice.
- Reproduction steps: the exact sequence someone else can follow to see the bug for themselves.