Want to get paid for a vulnerability similar to this one?
Contact us at: email@example.com
See our full scope at: https://blogs.securiteam.com/index.php/product_scope
The Untangle NG Firewall appliance includes a free module called “Captive Portal”. This module is installed by default with several other recommended modules. This module works as 2FA authentication system, which enables multi user login (in VPN or LAN environment for example) and custom firewall rules for each one. It forces all traffic to be authenticated before giving access to the network, and redirects all HTTP/HTTPS request to a login/disclaimer URL (“/capture/handler.py”).
The component URI is not restricted to local users, so it can be accessed also from the administrative interface, which is enabled by default on WAN interfaces to remote users, through HTTPS (443).
There is an administrative functionality in this module to upload custom python scripts or HTML pages, packed as ZIP file. The component does not check if the user is authenticated before processing the upload. It results in an arbitrary file upload vulnerability, which allows remote unauthenticated users to write custom python/HTML files to a known folder.
All Untangle plugins has its own application id, by default the captive portal id is “16”. The uploaded files (if packed correctly) will be extracted and copied to:
The id is consistent, but in older versions may change. Anyway, it is always between 1-35, which is short enough to identify it in a few tries (in the worst case).
The content of the ZIP file must be a “custom.py” or “custom.html” file.
As result, there is a RCE vulnerability, because when the module is installed, the web server configuration is modified to execute CGI files (as python) from “/capture/” folder. So if a custom python is uploaded, accessing the file through the web will execute the content:
In a few words:
- Upload ZIP file with a file called “custom.py” with the desired Python payload inside.
- Access “/capture/custom_16/custom.py” to execute its content