PHP - Server misconfiguration and code access
November 28, 2026
Introduction
During my work as a software developer I look at documentation to find out how a product communicates externally, what architectural problems arise, and which of them may have been bypassed in potentially problematic ways.
This is how I came across the website of a well-known company specializing in Identity and Access Management.
On their product page I saw the characters <?php and that immediately caught my interest.
Main part
People may have different opinions about PHP but one thing that cannot be denied is that the programming language is widely used. Accordingly my career began years ago with PHP driven by nothing more than the fun of software development. Back then I had no idea how to configure an Apache server or even what it actually was. Not to mention Nginx... So I simply uploaded my .php files to the public-facing directory and wondered why my program wasn't working.
It turned out that Apache cannot speak PHP out of the box. PHP is available as a module that has to be enabled first. If someone - like my former self - forgets to do this the entire .php file will be downloaded as-is. This gives an attacker access to the source code and allows them to see how the application works including whether it is vulnerable to injection attacks of any kind for example.
This is exactly what happened with the well-known company I cannot go into further detail about just yet.
As a result I was able to download the first .php file which referenced other files allowing me to reconstruct large parts of their website. Anyone familiar with how directory structures on the web work knows that a path followed by /index.php is often enough to gain access to even more parts of a PHP website.
Examples, Pictures
Here you can see the source code, which points to another page that is potentially vulnerable. (of course highly critical due to it's name "login.php")
else {
$login_url = '/*****/*****/*****/login.php?r='.htmlspecialchars("http" . (($_SERVER['SERVER_PORT']==443) ? "s://" : "://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
}
Here you can see a code example that is potentially at high risk of injection attacks.
if(isset($_GET["id"])) {
$docId = $_GET["id"];
}
else {
//echo "Invalid Document";
header("HTTP/1.1 404 Not Found");
exit;
}
if(!preg_match("/^[Dd]?\d\d\d\d\d\d+$/",$docId)){
header("HTTP/1.1 404 Not Found");
exit;
}
Here you can see a rough estimate of how many files could be extracted manually in a short amount of time.

Conclusion
Websites are crawled automatically in an almost unimaginable amount - at least for someone without an IT background. There is simply no way around checking them automatically for example through tests or try doing so manually. :)
In my case the website has been working before and somehow stopped due to a misconfiguration. The person responsible for this misconfiguration might not even have been aware of what has been done.