(Jul 7, 2017 01:40 AM)Zixem Wrote: Are you sure you implemented the Path Truncation right? the total input for the include() function is supposed to be 4096 bytes.
It means /src/+(YOUR BUFFER) = 4096 bytes or more.
plus, why did you showed only the file_exist() warning?
did you get any actual file inclusion errors?(they might be turned off, but i'm curious about what's going on over there)
What it seems to be doing is checking if the file exists through file_exists() then passing input to a function that reads that data (probably include(), require(), readfile(), etc. most likely include() tho) the input is then appended '.php' and in a specific directory. I am able to include different PHP files by doing ..
VulnerablePage.php?file=../../testpage
Which will include testpage.php because '.php' is already appended I am looking for a way to escape this to retrieve /etc/passwd
I am pretty sure the code is setup kinda like this ~
PHP Code
<?php
$file = $_GET['file'];
if (file_exists($file)) {
include('/src/' . $file . '.php');
} else {
echo '404';
}
?>
or this ~
PHP Code
<?php
$file = $_GET['file'] . '.php';
if (file_exists($file)) {
include('/src/' . $file);
} else {
echo '404';
}
?>
either way its appending .php to the inputted file
I will go ahead and test and make sure the path truncation is correct