phpinfophpold
```html
phpinfo.php.old Exposure: Security Risks, Detection & Remediation Playbook
phpinfo.php.old Exposure: Complete Security Playbook for Detection & Remediation
Legacy phpinfo.php.old files lingering on web servers are a silent but critical vulnerability. Attackers routinely scan for these files to extract PHP version numbers, server paths, compiled modules, environment variables, and database credentials hard-coded in scripts. This playbook gives you everything you need to locate, assess, and eliminate phpinfo.php exposure — including old or cached variants.
Key Takeaways
- A
phpinfo.php.oldfile leaks the same sensitive data as its current counterpart — PHP version, server API, loaded modules, environment variables, and included paths. - Older PHP versions (below 7.4 and especially below 5.6) are actively unsupported, meaning any phpinfo exposure on those versions is a high-priority vulnerability.
- Search-engine caches, Wayback Machine archives, and CDN edge nodes can serve stale phpinfo responses even after the file is deleted.
- A single remediation checklist — remove the file, harden
.htaccess, disablephpinfo()in production, audit backups, and flush caches. - Automated scanning should run weekly to catch re-emergence from deployments, CI/CD artifacts, or forgotten staging sites.
What Is phpinfo.php.old and Why Does It Matter?
The phpinfo() Function at a Glance
The phpinfo() function outputs a large HTML page containing the complete PHP runtime configuration. Among the exposed data points are:
- Exact PHP version and OS build string
- Loaded extensions and their version numbers
include_path,doc_root, andopen_basedirsettings$_ENVvariables (sometimes including API keys and database passwords)- Server software and Apache/Nginx environment headers
- Compiled-in module paths used by directory-traversal exploits
How .old Files Appear
phpinfo.php.old files typically result from one or more of these scenarios:
- Developers renaming
phpinfo.phpbefore replacing it, then forgetting the backup. - Deployment scripts that preserve previous builds as
*.oldartifacts. - Version-control misconfigurations pushing backup files to the document root.
- CMS migration tools leaving diagnostic pages behind in non-public directories.
- FTP clients auto-creating
file.bakorfile.oldduring transfers.
Risk Assessment: What Attackers Gain from phpinfo.php.old
| Exposed Data Point | Exploit Potential | Risk Level |
|---|---|---|
| PHP version number | Enables targeted CVE lookups; confirms known-vulnerable release | High |
| Loaded extensions + versions | Identifies vulnerable plugins (e.g., outdated ImageMagick, OpenSSL) | High |
| Server API (Apache mod_php, FPM, CGI) | Determines attack surface for handler-based exploits and SSRF | Medium |
| Document root & include paths | Powers directory traversal, LFI, and RCE attempts | High |
| $_ENV / $_SERVER variables | May reveal DB credentials, API keys, cloud tokens | Critical |
| Compiled-in modules (CGI, Suhosin) | Confirms presence or absence of hardening layers | Medium |
| OS & kernel string | Correlates with OS-level CVEs for privilege escalation | Medium |
Detection Checklist: Finding Exposed phpinfo.php.old Files
Phase 1 — On-Server Scan
- [ ] Run
find /var/www -iname '*phpinfo*' -o -iname '*.php.old' -o -iname '*.php.bak' 2>/dev/null - [ ] Check common deployment roots:
public_html,www,htdocs,web - [ ] Search hidden directories:
.git,.svn,.archive - [ ] Inspect temporary directories:
/tmp,/var/tmp, upload caches - [ ] Run
grep -rl 'phpinfo(' /var/wwwto find all files calling the function - [ ] Audit
composer.lockand deployment manifests for stray diagnostic scripts
Phase 2 — External Reconnaissance
- [ ] Query
site:yourdomain.com phpinfo.phpon Google and Bing - [ ] Check the Wayback Machine (
web.archive.org) for historical captures - [ ] Use Shodan/Censys to search for phpinfo fingerprints on your IP range
- [ ] Run an open-source scanner (Nmap script
http-php-info,nucleitemplates) - [ ] Verify CDN logs and edge-cache entries for cached phpinfo responses
- [ ] Test
https://yourdomain.com/phpinfo.php.oldand variants from an external IP
Phase 3 — Log Analysis
- [ ] Search access logs for
GET /phpinfo.php,*.old,*.bakpatterns - [ ] Identify source IPs that probed the endpoint — these are likely threat actors
- [ ] Cross-reference probe timestamps with firewall and WAF alert logs
- [ ] Retain forensic snapshots before any remediation for incident documentation
Remediation Playbook
Step 1 — Immediate Containment
- [ ] Delete every
phpinfo.php,phpinfo.php.old, andphpinfo.php.bakfile found. - [ ] Block the file pattern at the web-server level (see hardening table below).
- [ ] Rotate any credentials visible in
$_ENVoutput from the exposed page. - [ ] Document the exposure timeline, accessed IPs, and affected paths.
Step 2 — Web-Server Hardening
| Platform | Hardening Rule | Effect |
|---|---|---|
| Apache (.htaccess) | <FilesMatch "^phpinfo.*"> |
Denies direct access to phpinfo and phpinfo.* variants |
| Apache (.htaccess) | <FilesMatch "\.php\.old$"> |
Blocks legacy backup PHP files |
| Nginx (server block) | location ~* ^.*phpinfo { return 404; } |
Returns |