Skip to content
XSS Disclosed report Intermediate

Stored XSS via AngularJS Injection

A referral contact address field rendered user input through an old AngularJS template engine, so a crafted expression was evaluated as code. An attacker with permission to create a contact could store a script that ran in the browser of anyone viewing the contact overview, including an admin.

yaworsk Follow

Originally disclosed on HackerOne

  • Triaged in 4 days
  • Fixed in 17 days
  • Paid in 5 days
  • Disclosed after 17 days

Hi All, I've found a stored XSS vulnerability via an Angular Template Injection in the messages referral address field.

##Description After visiting ``https://1337test.drchrono.com/messages/referrals/contacts/```, you can enter new contact information. In the field for the address, if enter [[5*5]], when the referrals contact overview will show the address as 25. This indicates an injection.

Opening the browser console and using the command angular.version, we can see you are using 1.1.5. So, entering the address for a contact as [[constructor.constructor('alert(document.cookie)')()]], saving and reloading the page, an stored XSS is executed

angular_injection_contacts.png
angular_injection_contacts.png From the original on HackerOne

##Steps to reproduce

  1. Create a doctors account
  2. Visit https://1337test.drchrono.com/messages/referrals/contacts/
  3. Add a new contact
  4. In the address field, enter [[constructor.constructor('alert(1)')()]]

Confirm the alert pop up with 1 in it.

##Vulnerability The stored xss could be used for a complete account take over if an admin visited this contact page. An attacker only needs permission to create a referral contact to store the payload. In the example image, I've printed all cookies to the screen but this could easily be sent to a remote endpoint.

Please let me know if you have any questions. Pete

The original report as published on HackerOne, by yaworsk. 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 address value was inserted into an AngularJS template context and evaluated by the old AngularJS 1.1.5 engine instead of being displayed as plain text.

Impact

The stored script could be used for a complete account takeover if an admin viewed the contact page, and the text says cookies could easily be sent to a remote endpoint.

What the attacker needed

A doctors account; permission to create a referral contact; victim views the contact overview

How it was found

  1. Create a doctors account.
  2. Open the referrals contacts page.
  3. Add a new contact.
  4. Put an AngularJS expression in the address field and save.
  5. Reload the contact overview and the script runs.

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.

Some web pages use a framework called AngularJS to fill in parts of the page from templates. If a user's text is treated as part of that template, the framework will calculate and run it instead of just showing it. Here the address field did exactly that, so a visitor's browser ran the attacker's code.

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 yaworsk

View all

21 more disclosed reports, best first.

More from drchrono

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.