Skip to content

Harden low file upload handling - #290

Open
r1kka6 wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
r1kka6:fix/file-upload-low
Open

r1kka6 wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
r1kka6:fix/file-upload-low

Conversation

@r1kka6

@r1kka6 r1kka6 commented Aug 10, 2026

Copy link
Copy Markdown

Summary

  • validate low-level uploads as server-decoded JPEG or PNG images instead of trusting the supplied filename and MIME type
  • re-encode accepted images through GD and store them under random filenames with trusted extensions
  • reject malformed, empty, oversized, and non-image uploads before anything reaches the public upload directory

Verification

  • docker run --rm -v "$PWD":/work -w /work php:8.3-cli php -l vulnerabilities/upload/source/low.php
  • vulnerable baseline stores dvwa-upload-shell.php and executing /hackable/uploads/dvwa-upload-shell.php returns PWNED
  • patched runtime rejects the same PHP payload, accepts a legitimate JPEG as a random .jpg, and leaves the original shell path at 404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant