Skip to content
Path traversal Disclosed report Beginner

[Buddypress] Arbitrary File Deletion through bp_avatar_set

The bp_avatar_set action in BuddyPress allows an attacker to delete arbitrary files on the server by manipulating the original_file parameter during avatar cropping. An attacker with a normal user account could delete critical files like wp-config.php, rendering the site unavailable.

mopman Follow

Originally disclosed on HackerOne

High 7.7 View original
  • Disclosed after 9 months

Hi, The bp_avatar_set action in BuddyPress when cropping avatars allows an attacker to arbitrarily delete a file the webserver can delete through the 'original_file' parameter.

For example:

  • Create a user on a Buddypress-powered Wordpress instance (any user is OK, doesn't need to be admin, just needs to have the ability to change it's own avatar in the Buddypress profile which is normal).
  • Navigate to the avatar change URL for example /members/<username>/profile/change-avatar/ on my install.
  • Click the button to upload an image and select any valid image. Allow the first request which uploads this image to submit as normal.
  • Select the crop button, but do not allow the request to complete (I used Burp and enabled intercept mode). Modify the request to change the original_file parameter to point to a file you wish to delete, traversing up with ../.. if needed. So for example where my legitimate param was:

original_file=http%3A%2F%2Flocalhost%2F~sam%2Fwordpress%2Fwp-content%2Fuploads%2Favatars%2F2%2Fmy_ugly_face.jpg

Change to:

original_file=http%3A%2F%2Flocalhost%2F~sam%2Fwordpress%2Fwp-content%2Fuploads%2Favatars%2F2%2F../../../../../wp-config.php

Remember it will be in a numbered folder probably, so you need one more .. than expected from the URL. You can upload an image for real to see how the path ends up for guidance on this if you're an attacker and don't know the folder structure.

The wp-config.php file will be deleted when unlink() is called and the blog will then be unavailable, of course, in this case.

This path needs to be somehow validated such that it can only delete uploaded avatars (constraining to the upload directory would still allow you to delete, say, other users avatars, or other uploaded files, which would still make me sad :()

Let me know if you have any trouble reproducing or need any further info - I think I explained OK, but it is very late here. ;)

o/

The original report as published on HackerOne, by mopman. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the original_file parameter is not validated to ensure it points to an uploaded avatar file, allowing path traversal and arbitrary file deletion.

Impact

An attacker could delete arbitrary files the webserver can delete, such as wp-config.php, making the blog unavailable.

What the attacker needed

A user account with avatar change ability; ability to intercept and modify HTTP requests

How it was found

  1. Create a user on a BuddyPress-powered WordPress instance.
  2. Navigate to the avatar change URL.
  3. Upload a valid image and allow the upload request to complete.
  4. Intercept the crop request and modify the original_file parameter to point to a file to delete, using ../ to traverse directories.
  5. Submit the modified request, causing the file to be deleted.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

BuddyPress lets users upload and crop profile pictures. When you crop, the site uses a hidden field to remember where your uploaded picture is stored. The report shows that a user can change that field to point to any file on the server, and the site will delete it. This means a normal user could delete important files and break the website.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by mopman

View all

1 more disclosed report, best first.

More from WordPress

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.