XSS via Direct Message deeplinks
A Direct Message deeplink's text parameter was not properly sanitised, allowing an attacker to inject arbitrary HTML tags on the twitter.com origin. The deployed CSP blocked JavaScript execution, but HTML injection could still enable phishing or deanonymisation attacks.
Originally disclosed on HackerOne
- Triaged in 42 hours
- Fixed in 12 days
- Paid in 5 days
- Disclosed after 13 months
Description: By using a specially crafted payload as the value of the text parameter in a Direct Message deeplink, a malicious user can inject arbitrary HTML tags and possibly run arbitrary JavaScript code on the "twitter.com" origin.
Steps To Reproduce:
- Create a Direct Message deeplink by following the instructions on this Twitter developer guide.
- Use the following payload as the value for the text parameter:
%3C%3C/%3Cx%3E/script/test000%3E%3C%3C/%3Cx%3Esvg%20onload%3Dalert%28%29%3E%3C/%3E%3Cscript%3E1%3C%5Cx%3E2
- Tweet the deeplink you created. It should look like the following:
https://twitter.com/messages/compose?recipient_id=988260476659404801&welcome_message_id=988274596427304964&text=%3C%3C/%3Cx%3E/script/test000%3E%3C%3C/%3Cx%3Esvg%20onload%3Dalert%28%29%3E%3C/%3E%3Cscript%3E1%3C%5Cx%3E2
Impact
It seems that the deployed CSP policy currently blocks the execution of arbitrary JavaScript code, however, arbitrary HTML tags can still be injection on twitter.com to carry out other kinds of attacks (i.e., deanonymization attacks, phishing, etc.). While you're in the process of verifying this, I'll be working on a bypass for the CSP policy in order to execute arbitrary JavaScript.
The hacker selected the Cross-site Scripting (XSS) - DOM weakness. This vulnerability type requires contextual information from the hacker. They provided the following answers:
URL https://twitter.com/fvofo0000001444/status/988278372894740480
Verified Yes
Attachments

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
Likely the application inserted the text parameter from the deeplink into the page without proper HTML encoding or sanitisation.
Impact
The CSP blocked JavaScript execution, but arbitrary HTML injection on twitter.com could still be used for phishing or deanonymisation attacks.
What the attacker needed
Attacker creates and shares a crafted deeplink
How it was found
- Create a Direct Message deeplink using the Twitter developer guide.
- Set the text parameter to a crafted payload that includes HTML tags.
- Tweet the deeplink so it can be clicked.
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.
A deeplink is a special URL that opens a specific part of an app, like a pre-filled message. The text parameter in that URL was not cleaned before being shown on the page, so an attacker could insert their own HTML (the code that builds web pages). This let them change how the page looked, which could be used to trick people, even though a security policy stopped JavaScript from running.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.