I am conducting a penetration test for a client, and they're using Wordpress. I need to…
- User
I am conducting a penetration test for a client, and they're using Wordpress. I need to see the media attachments in the site, but I don't have permissions to use the API /media endpoint.
There's no directory listing on wp-content/uploads, and wp-sitemap-posts-attachment-1.xml redirects me to attachment-sitemap.xml, which gives 404. /sitemap.xml doesn't have any attachment map as well.
There are no relevant references to wp-content/uploads, and embedded media doesn't really help me.
- Assistant
You're in a common situation: WordPress media enumeration is often blocked by default, especially on well-configured sites. Here’s a breakdown of your options and some creative approaches, given your constraints:
1. Direct Enumeration via Guessing
WordPress stores media in predictable paths:
/wp-content/uploads/YYYY/MM/filename.extIf you know the site’s age, you can try brute-forcing common years/months and filenames. For example:
/wp-content/uploads/2023/12/logo.png/wp-content/uploads/2024/01/banner.jpg
You can automate this with tools like Gobuster or Dirsearch with custom wordlists (e.g., common image names, months, years).
2. Scraping Media from Public Pages
Even if the API and sitemaps are blocked, media files embedded in posts/pages are still public.
- Use a crawler (e.g., wget, HTTrack, Scrapy) to download all pages.
- Parse the HTML for
<img src=...>,<a href=...>, and other media tags. - Extract URLs pointing to
/wp-content/uploads/.
This will give you all media that is actually used on the site, which is often what matters most.
3. Wayback Machine / Archive.org
Check if the site has been crawled by the Wayback Machine.
- Search for
/wp-content/uploads/URLs. - Sometimes, old sitemaps or media files are indexed there.
4. RSS Feeds
WordPress often exposes media in RSS feeds, especially for attachments:
- Try
/feed/or/?feed=rss2 - Look for
<enclosure>tags or direct links to media.
5. Author/Attachment ID Enumeration
WordPress attachments are a post type (
attachment).- Try accessing
/?attachment_id=1,/?attachment_id=2, etc. - Or
/index.php?attachment_id=1 - Sometimes, this will redirect to the media file or show a page with the media.
You can automate this with a simple script.
6. Third-Party Search Engines
- Use Google Dorks:
site:example.com inurl:/wp-content/uploads/ - Or try Bing, Yandex, etc.
7. Check for Plugins/Theme Leaks
Some plugins or themes may leak media URLs in their own sitemaps, feeds, or AJAX endpoints.
- Look for
/wp-json/endpoints (other than/media). - Check
/wp-admin/admin-ajax.phpfor public actions.
8. Check Robots.txt
Sometimes,
/robots.txtwill list disallowed (but existing) upload directories or sitemaps.
9. Check for Old Sitemaps
Try common sitemap plugin paths:
/sitemap_index.xml/sitemap-attachments.xml/media-sitemap.xml/uploads-sitemap.xml
10. Check for Caching/CDN Leaks
If the site uses a CDN (Cloudflare, etc.), sometimes media is cached and can be found via CDN URLs or by brute-forcing CDN subdomains.
Summary Table
Method Effectiveness Stealth Automation Brute-force uploads/years Medium Low High Scrape public pages High High High Wayback Machine Medium High Manual RSS feeds Low-Medium High Medium Attachment ID enumeration Low Low High Google Dorks Medium High Manual Plugin/theme leaks Low Medium Manual
If you want a sample script for any of these methods, let me know!
If you have permission for more intrusive testing, brute-forcing is an option, but scraping public pages is usually the most effective and least noisy.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.