Skip to content
XSS Disclosed report Intermediate

XSS via Client Side Template Injection on www.███/News/Speeches

The search parameter on a news page is evaluated by a client-side template engine, allowing an attacker to inject and execute arbitrary JavaScript. This enables running code in the victim's browser and potentially bypassing CORS on other endpoints.

chef_shell Follow

Originally disclosed on HackerOne

  • Triaged in 44 hours
  • Fixed in 3 months
  • Disclosed after 3 months

Dear DoD - Team, I am able to execute javascript code on www.███████/News/Speeches.

This endpoint has a search functionality with the parameter Search. The supplied value to this parameter gets embedded into the website. Furthermore the frontend of the website is presumably created with a template engine. These engines handle user supplied data within double curly braces {{...}} for example. If the user input is not sanitized corretly template injection can occur.

When supplying the Search parameter with a value inside double curly braces it gets evaluated and the result is then embedded into the web page.

For example the search value www.███████/News/Speeches?Search={{7*7}} gets evaluated to 49 and put into the web page (see image_1.png). Besides simple mathematical equations, javascript code can be put inside those braces too (see image_2.png). This will execute the code as well which results in a XSS vulnerability.

There are some mitigations to this. For example some methods are blacklisted which means alert(1) is not allowed. However this can be bypassed by encoding the payload into a base64 string and call a decode method before evaluating (executing) the code.

I've come up with a simple payload which triggers all javascript code thus bypassing the blacklisting of potential dangerous methods.

https://www.████/News/Speeches/?Search={{window['eval'](window['atob'](window['decodeURIComponent']('BASE_64_ENCODED_PAYLOAD')))}}

A poc video is attached.

Recap

A client side template injection vulnerability is present through the Search parameter. This leads to the ability to run arbitrary javascript code on the client side.

Impact

  • run arbitrary javascript code on the victims machine
  • Since the javascript code is run within the realm of ██████ CORS bypass on other endpoints could be possible.
  • Forgery of information

System Host(s)

www.█████████

Affected Product(s) and Version(s)

CVE Numbers

Steps to Reproduce

  • Copy the provided link in the description section
  • Replace the BASE_64_ENCODED_PAYLOAD with an actual base64 encoded javascript code. For Example YWxlcnQoMSk= which is alert(1) in base64.
  • Insert the crafted url into the browser.
  • done

Suggested Mitigation/Remediation Actions

Sanitize the user input so double curly braces {{...}} won't trigger a client side server injection

The original report as published on HackerOne, by chef_shell. 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 client-side template engine evaluates user input from the Search parameter without proper sanitisation, allowing template injection.

Impact

An attacker could run arbitrary JavaScript on the victim's machine, potentially bypass CORS on other endpoints, and forge information.

What the attacker needed

Victim clicks a crafted link

How it was found

  1. Copy the provided link from the description.
  2. Replace the placeholder with a base64-encoded JavaScript payload.
  3. Insert the crafted URL into the browser.

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.

The website treats what you type in a search box like a template, so code inside double curly braces runs. This lets an attacker run their own JavaScript in your browser.

What is XSS?

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

More from U.S. Dept Of Defense

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.