SSD Advisory – Sophos XG from Unauthenticated Persistent XSS to Unauthorized Root Access

Credit to Author: SSD / Maor Schwartz| Date: Mon, 08 Jan 2018 06:21:27 +0000

Want to get paid for a vulnerability similar to this one?
Contact us at: sxsxdx@xbxexyxoxnxdxsxexcxuxrxixtxy.xcom
See our full scope at: https://blogs.securiteam.com/index.php/product_scope

Vulnerability Summary
The following advisory describes an unauthenticated persistent XSS that leads to unauthorized root access found in Sophos XG version 17.

Sophos XG Firewall “provides unprecedented visibility into your network, users, and applications directly from the all-new control center. You also get rich on-box reporting and the option to add Sophos iView for centralized reporting across multiple firewalls.”

Credit
An independent security researcher has reported this vulnerability to Beyond Security’s SecuriTeam Secure Disclosure program.

Vendor response
Sophos was informed of the vulnerability, their response was:

CVE: CVE-2017-18014

Vulnerability details
An unauthenticated user can trigger a persistent XSS vulnerability in the WAF log page (Control Center -> Log Viewer -> in the filter option “Web Server Protection”) in the webadmin interface which can be used to execute any action that webadmin of the firewall can (creating new user / ssh enabling and adding an ssh auth-key etc).

In order to trigger the vulnerability we will demonstrate the following scenario:

  • Sophos XG Firewall will configured with 3 zones: Trusted, Untrusted, DMZ
  • A WEB server will be placed in DMZ
  • The firewall will protect the web server using Web Application Firewall (WAF) with default Sophos recommendation.
  • An attacker, from Untrusted network, will send a URL request to the web server in DMZ. This cause the injection of the script in the WAF logs page
  • An admin, from Trusted, will visit WAF log page
  • The script, without any other interaction or alert, will add an SSH auth-key to admin user and will allow ssh administration from Untrusted.
  • The attacker will get full root ssh shell

The Sophos XG WAF log page will execute the “User-Agent” parameter in the POST request.

Proof of Concept
Sophos XG configuration:

  • Firewall interface Trusted – 192.168.10.190 port A
  • Firewall interface Untrusted – 192.168.0.192 port B
  • Firewall interface DMZ – 192.168.20.190 port C

Environment

  • The Sophos XG Fireweal admin portal will be at https://192.168.10.190:4444/webconsole/webpages/login.jsp
  • In Trusted network the Admin PC IP: 192.168.10.191
  • In DMZ network the “Webserver” can be netcat listener at IP: 192.168.20.191
  • In Unrusted network, the Attacker controlled website IP: 192.168.0.12

From the attacker PC create an ssh auth key (empty passphrase):

Then read the pub key – This key will be used in the attack.

Note that you have to encode part of your key when you insert it in the attack script – every ‘+’ must be replaced with ‘%2B’.

Modify the 17.js script (see below) replacing ===>INSERT-YOUR-PUB-KEY<=== with your pub key

Change Host 17.js to your website.

Now run the follow cURL command, injecting the “User-Agent”:

Print Friendly, PDF & Email

https://blogs.securiteam.com/index.php/feed