The $300 Journey from RFI to RCE that Changed Everything
The Social Warfare WordPress plugin version 3.5.0 used file_get_contents on a user-supplied URL without validation, allowing remote file inclusion. The fetched content was then passed to eval, enabling remote code execution if the payload was wrapped in <pre> tags.
Published on medium.com
This story dates back to about three years ago, but it’s one of those incidents that stuck with me. So, I thought, why not share it as my first blog on Medium?
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could execute arbitrary commands on the server, leading to full remote code execution.
What the attacker needed
Social Warfare plugin version 3.5.0; attacker-controlled server
The fix
The plugin should be updated to a version that does not use file_get_contents on user input or eval on fetched content.
How it was found
- Identify the outdated Social Warfare plugin version 3.5.0.
- Download and analyse the plugin source code to find file_get_contents and eval usage.
- Set up a local server and use ngrok to expose a payload file publicly.
- Craft a URL to admin-post.php with swp_debug=load_options and swp_url pointing to the payload.
- Wrap the payload in <pre> tags to pass the plugin's check.
- Access the crafted URL to trigger remote code execution.
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 write-up has not been written yet. The Original tab links to the source.
A WordPress plugin took a web address from the visitor and downloaded whatever was at that address. It then ran the downloaded text as computer code, so an attacker could make the server run their own commands.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.