Skip to content

fix(upload): replace predictable uniqid() with cryptographically secure random_bytes()#754

Merged
digininja merged 1 commit into
digininja:masterfrom
IdkWhatAmIDoin:fix/impossible-upload
May 29, 2026
Merged

fix(upload): replace predictable uniqid() with cryptographically secure random_bytes()#754
digininja merged 1 commit into
digininja:masterfrom
IdkWhatAmIDoin:fix/impossible-upload

Conversation

@IdkWhatAmIDoin

Copy link
Copy Markdown
Contributor

summary

uniqid() is based on the system microtime and is inherently predictable. i changed it to random_bytes(), because even if it doesn't change the security, it's still a bad practice

what changed

  • md5( uniqid() . $uploaded_name ): replaced with bin2hex( random_bytes( 16 ) )
  • refactored the naming block to kill the dual-evaluation bug where two completely different random strings were generated for $target_file and $temp_file
  • stored token in $random_name variable

…re random_bytes()

it doesnt really matter for security, but its a bad practice
@digininja

Copy link
Copy Markdown
Owner

Please understand, the app is supposed to be full of bad coding and vulnerabilities, we don't need fixes for things like this.

@digininja digininja closed this May 29, 2026
@IdkWhatAmIDoin

Copy link
Copy Markdown
Contributor Author

i understand the app needs to be vulnerable, but this pr only changes the impossible difficulty which should show actual secure code, same as #752 which was merged yesterday. its gonna show people that learn on dvwa bad practices

@digininja digininja reopened this May 29, 2026
@digininja

Copy link
Copy Markdown
Owner

ok, but for future ones, remember that we aren't supposed to be perfect, it is designed to have issues for people to find.

@digininja digininja merged commit a6cd0ea into digininja:master May 29, 2026
8 of 9 checks passed
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.

2 participants