Skip to content
File upload Write-up Beginner

Wrong Variable Name Leads To RCE | CVE-2025–52130

The application's file upload validation checked the wrong request parameter names, so the mime-type checks were applied to non-existent fields. An authenticated attacker could upload a PHP file and execute commands on the server by browsing to it.

medium.com

Published on medium.com

Back in May this year I spent some time going through PHP applications on Github , with a single goal in mind — to find my first CVE.

TheHiker, on medium.com

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

Root cause

The validation rules referenced parameter names that did not match the actual form field names, so the mime-type checks were never applied to the uploaded files.

Impact

An authenticated administrator could upload and execute arbitrary PHP code on the server, leading to remote code execution.

What the attacker needed

Administrator access to the application

The fix

The fix corrected the variable names in the validation rules and forced the cgv file to have a .pdf extension.

How it was found

  1. Log in as administrator and go to Factory Settings, then Reports Settings.
  2. Upload a PHP file in the file field (or the Picture field).
  3. Browse to the uploaded file to trigger 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.

When you upload a file, the website is supposed to check what kind of file it is. Here, the check looked at the wrong name in the request, so it never actually inspected the uploaded file. That let the author upload a PHP script, which the server then ran, giving command execution.

What is File upload?

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.