Skip to content
XSS Disclosed report Beginner

XSS vulnerability found in javascript code of https://███.mil

The 'code' parameter on a .mil login page was inserted into inline JavaScript without proper sanitisation, allowing an attacker to break out of a string and run arbitrary script. An attacker could execute JavaScript in a victim's browser, potentially stealing credentials or session data.

thpless Follow

Originally disclosed on HackerOne

  • Triaged in under an hour
  • Fixed in 9 days
  • Disclosed after 46 days

Description

Hello DoD Team

I found an XSS vulnerability in the javascript code of ██████████.mil. The parameter code isn't sanitized enough to prevent an attack.

If you click the following link: https://███.mil/?code=xxx';%0d%0a!!!MALICIOUS%20CODE%20HERE!!!;%0d%0avar%20x=' the output looks as following.
You can see the three injection points.

JavaScript
<!doctype HTML>

<!-- BEGIN TopCategoriesDisplay.jsp --><!-- BEGIN SSORedirect.jsp -->

<script type="text/javascript">

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;
		}
		
		window.location.href = 'https://' + env + '/webapp/wcs/stores/servlet/ProcessUserSSO?catalogId=10051&langId=-1&storeId=' + 10801
			+ '&sso=true&ssoAction=' + action + '&code=xxx';
!!!MALICIOUS CODE HERE!!!;
var x='' + logonIdParam + userTypeParam + '&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=xxx';
!!!MALICIOUS CODE HERE!!!;
var x='';
	}
}

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

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


<script type="text/javascript">

	ra2 = "false";
	if ((document.referrer.indexOf('-ra2.') !== -1)) {
		ra2 = "true";	
	}
	
	var clientId = "████████";
	
	
	window.location.href = 'ProcessUserSSO?catalogId=10051&langId=-1&app='+clientId+'&ra2='+ra2+'&ssoAction=logon&code=xxx';
!!!MALICIOUS CODE HERE!!!;
var x='&uoa=';

</script>
<!-- END SSORedirect.jsp --><!-- END TopCategoriesDisplay.jsp -->		
</html>

Proof of Concept

https://███████.mil/?code=xxx';alertXSS;var%20x='

Impact

An XSS attack on a login page can lead to credential theft, session hijacking, and user redirection to phishing sites, compromising sensitive data. Malicious scripts can capture user inputs, modify form actions, or steal session cookies, enabling attackers to impersonate victims. Implementing input validation, output encoding, and a strong Content Security Policy (CSP) can mitigate these risks.

System Host(s)

███████.mil

Affected Product(s) and Version(s)

Webserver

CVE Numbers

Steps to Reproduce

###use the link:

https://███████.mil/?code=xxx';alertXSS;var%20x='

Suggested Mitigation/Remediation Actions

sanitize the character '

Bash
'   ===>   \' 

should do it

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

Impact

An attacker could run script in a victim's browser on a login page, which could lead to credential theft, session hijacking, or redirection to phishing sites.

What the attacker needed

Victim clicks a crafted link

The fix

The parameter should be properly escaped or encoded before being placed in JavaScript, and a strong Content Security Policy should be added.

How it was found

  1. Open the crafted URL containing the payload in the 'code' parameter.
  2. Observe that the payload appears unescaped in the page's JavaScript, breaking out of the string.

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.

A website took a value from the address bar and pasted it directly into a script on the page. By adding special characters, an attacker can close the existing code and insert their own instructions, which the victim's browser then runs as if the site had written them.

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.