Skip to content
XSS Disclosed report Beginner

XSS found in https://www.████████.mil

A reflected cross-site scripting flaw existed in a US military web application because the 'code' query parameter was inserted into JavaScript without sanitisation. An attacker could craft a link that, when opened by a victim, ran arbitrary script in the victim's browser.

thpless Follow

Originally disclosed on HackerOne

  • Triaged in 5 hours
  • Fixed in 29 days
  • Disclosed after 2 months

Hi Dear DoD Team

I found another reflected cross site script in one of your web apps.

As a proof of concept you can use the following link. https://www.███.mil/?code=%27;prompt(%27XSS%27);//

Best @thpless

Impact

Reflected XSS allows attackers to inject malicious scripts into a web application, which execute in the user's browser when triggered (e.g., via a malicious link). This can lead to theft of sensitive data like cookies, session tokens, or credentials, and may enable phishing or session hijacking. Additionally, attackers can manipulate the webpage to execute malicious actions, such as keylogging or redirecting users to harmful sites.

System Host(s)

www.██████.mil

Affected Product(s) and Version(s)

webserver

CVE Numbers

Steps to Reproduce

PoC

https://www.████████.mil/?code=%27;prompt(%27XSS%27);//

Suggested Mitigation/Remediation Actions

*** To prevent the execution of JavaScript code, you would need to sanitize the output (replace the character ' with '). ***

In this case there are three injection points on the site

HTML
<script type="text/javascript">

function getUnitOfAssignment() {
	var uoa = '';
/*	
	if(document.cookie) {
		var cookiearray = document.cookie.split(';');
	
		// Now take key value pair out of this array
		for(var i=0; i<cookiearray.length; i++) {
		   name = cookiearray[i].split('=')[0];
		   value = cookiearray[i].split('=')[1];
		   if(name == 'uoa') {
			   uoa = value;
		   }
		}
	}
*/	
	return uoa;
}

function processUserLogon(action) {
	if(action == 'logon') {
		var e = document.getElementById("environment");
		env = e.options[e.selectedIndex].value;
		var logonIdParam = "";
		var userTypeParam = "";
		if(document.getElementById("logonId") != null) {
			logonIdParam = "&logonId=" + document.getElementById("logonId").value;
		}
		if(document.getElementById("userType") != null) {
			var userType = document.getElementById("userType");
			userTypeParam = "&userType=" + userType.options[userType.selectedIndex].value;
		}
		
		var uoa = getUnitOfAssignment();
		
		window.location.href = 'https://' + env + '/webapp/wcs/stores/servlet/ProcessUserSSO?catalogId=10051&langId=-1&storeId=' + 10801
			+ '&sso=true&ssoAction=' + action + '&code=INJECTION_POINT' + logonIdParam + userTypeParam + '&uoa=' + uoa 
			+ '&dodaac=' + document.getElementById('dodaac').value + '&json=' + document.getElementById('json').value;
	} else {
		window.location.href = 'ProcessUserSSO?catalogId=10051&langId=-1&sso=true&ssoAction=' + action + '&code=INJECTION_POINT';
	}
}

function getCode() {
	var clientId = "fedmall";
	

	window.location.href = 'https://█████████/portal/oauth2/authorize?response_type=code&client_id=' + clientId + '&redirect_uri=https://www.████████.mil/webapp/wcs/stores/servlet/en/fedmall?sso=true';	
}
</script>
<br/>

<div class="rowContainer" id="container_SSO_UserInfo">
	<div class="row margin-true">
		<div class="col8 acol12 ccol9">
			<div id="UserInfoPageHeading" tabindex="0">
				<h2 class="userInfo_header" style="margin-bottom: 10px !important;">Processing User Sign In...</h2>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
dojo.addOnLoad(function() {
	ra2 = "false";
	if ((document.referrer.indexOf('-ra2.') !== -1)) {
		ra2 = "true";	
	}
	
	var clientId = "fedmall";
	
	
	window.location.href = 'ProcessUserSSO?catalogId=10051&langId=-1&app='+clientId+'&ra2='+ra2+'&ssoAction=logon&code=INJECTION_POINT&uoa=' + getUnitOfAssignment();
});
</script>

The original report as published on HackerOne, by thpless. 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 reflected the 'code' parameter into inline JavaScript without escaping or sanitising it.

Impact

An attacker could steal cookies, session tokens or credentials, and could perform phishing, session hijacking, keylogging or redirect users to harmful sites.

What the attacker needed

Victim clicks a crafted link

The fix

The output should be sanitised by escaping the single quote character before it is placed into the page.

How it was found

  1. Open the crafted URL containing the payload in the 'code' parameter.
  2. The page reflects the value into its JavaScript, and the browser executes it, showing a prompt.

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.

Cross-site scripting (XSS) is when a website takes something from the address bar and puts it into the page without cleaning it first. Here the 'code' value was placed inside a script block, so a crafted link could make the victim's browser run the attacker's JavaScript. That script runs with the site's trust and can read cookies or act as the user.

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 thpless

View all

8 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.