Skip to content
XSS Write-up Advanced

Cross Site Template Injection

The article explains a reflected XSS vulnerability in an AngularJS application where user input is evaluated as an expression via $parse, allowing an attacker to execute arbitrary JavaScript. The author demonstrates a sandbox escape using constructor tricks and the orderBy filter to bypass restrictions on quotes and $eval.

medium.com

Published on medium.com

In my priviuous article i have explained about CSTI with AngularJs , Now let’s deep dive into CSTI, This article is related to one of the Expert lab of XSS from port swigger

13v! ⚔️, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application passes user input into AngularJS's $parse function, which evaluates it as an expression, and the sandbox can be escaped using constructor properties and the orderBy filter.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially leading to data theft or other malicious actions.

What the attacker needed

Victim visits a crafted URL; AngularJS is used on the page

How it was found

  1. Identify that the search input is reflected and evaluated by AngularJS.
  2. Inspect the source code to see that $parse is used on the input.
  3. Craft a payload that breaks the parser logic by overriding charAt with join.
  4. Use the orderBy filter with a constructor-based fromCharCode to build and execute alert(1).

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 write-up has not been written yet. The Original tab links to the source.

This is about a website that takes what you type and treats it like a mini-program instead of plain text. Because of that, an attacker can type special code that the website runs in the visitor's browser, which could steal data or perform actions as the user. The article shows how to get around some protections the website puts in place.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

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.