Skip to content
XSS Disclosed report Intermediate

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.

Ahmed Elsobky Follow

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:

  1. Create a Direct Message deeplink by following the instructions on this Twitter developer guide.
  2. 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
  1. 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

screenshot.png
screenshot.png From the original on HackerOne

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

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

  1. Create a Direct Message deeplink using the Twitter developer guide.
  2. Set the text parameter to a crafted payload that includes HTML tags.
  3. 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.

More by Ahmed Elsobky

View all

1 more disclosed report, best first.

More from X / xAI

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.