Auditing PHP Settings to OWASP Recommendations with Nessus
Tenable recently released an audit policy for Linux servers running PHP which tests for hardening recommendations from the Open Web Application Security Project (OWASP). OWASP maintains a set of guidelines for hardening web servers, with specific attention given to PHP and Cold Fusion technologies.
In order to download the PHP audit policy, log into the Tenable Support Portal, click Downloads, click Compliance and Audit Files and then click Configuration Audit Polices. The OWASP policy is located towards the bottom of the page.
Performing a scan to test the recommended php.ini settings is straightforward:
- Download the OWASP audit policy to your laptop or computer.
- Create a Nessus scan policy with credentials to log into your target(s).
- Disable port scanning and other unneeded vulnerability checks.
- Enable the Unix Compliance Checks plugin in the Policy Compliance family.
- Under the advanced tab, for the Unix Compliance preference, add in the location to the OWASP audit file on your computer.
Performing an audit will result in a report such as this one shown below:
Typically, the PHP file is very small, so the entire time to log in and perform this audit is very minimal. In my testing, it was just a few seconds to test several Linux servers in a VM environment.
If you have dozens, hundreds or even more Linux systems that need to be audited, this is a great opportunity to leverage SSH public and private keys for secure authentication. Tenable has several customers who need to audit large numbers of RedHat or other types of Linux systems and they do so with Nessus and shared SSH keys.
If you are testing a live PHP application, you should make a copy of the php.ini file (located in /etc) before applying any changes. It is quite possible that by changing the settings in the php.ini file, you may change (or break) how your web based application works.
In general, if you are performing tests of Linux web applications, you should also consider performing the following:
- a full patch and vulnerability audit of the entire underlying Linux operating system
- a Center for Internet Security (CIS) or similar operating system configuration audit of Linux
- a similar CIS audit for Apache web server configurations
- a configuration audit of the MySQL, MS SQL or underlying database that supports the web application
Tenable offers a wide variety of audit polices for Nessus to perform these types of audits. Professional Feed and Security Center customers have access to the Tenable Support Portal which contains a wide variety of audit polices that can be downloaded and customized.
Are You Vulnerable to the Latest Exploits?
Enter your email to receive the latest cyber exposure alerts in your inbox.