I'm trying to write a PoC for path traversal using hash extension attack on a PHP site. My obstacle is in specifying an acceptable string. The vulnerability is in in the URL:[the valid md5 hash]

I'm trying to print out /etc/passwd using this:��/../../../etc/passwd&hash=[extended valid hash]

The backend first checks whether the provided MD5 is valid and then prints out the requested file. I'm using the PHP functions fopen and fread for that.

I'm able to create valid hashes for arbitrary strings but PHP fails with the following error:

Warning: fopen() expects parameter 1 to be a valid path, string given in /var/www/html/download.php

Note: The characters �� in the URL are due to the MD5 padding of the hash extension.


1 Answer 1


Since PHP 5.3.4, an error is thrown if a path contains a null byte.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .