#1
|
||||
Apache Security Configuring Secure Response Headers
A proper configuration of Apache Web server may extremely important since it sometimes can prevent certain Web Application Attacks even though the vulnerability is there in the web application. In this post I'll describe how to set configure apache to send Security concerned HTTP headers in its response and hide sensitive information from server response headers.
In a later post I'll describe setting virtual hosts with SSL enabled,request rewriting and redirection. If you carefully inspect HTTP responses coming from Web Servers from Google or Facebook or any other Securely configured server, you might see several non-http-standard headers inside their response. Some of them are, Quote:
Example:- Quote:
[IMG]https://miro.medium.com/v2/resize:fit:580/0*yGNM9p6sg2c4HpW-.PNG[/img] You can clearly see that above response is coming from an Apache web server with version 2.4.7 and you can see its OpenSSL and PHP versions and on which platform its running (in this case Windows) clearly. An enthusiastic attacker can search online for published vulnerabilities and exploits for above server on the given platform and the software installed on the server, if a matching exploit found, he can easily attack your web server. So, these information should never be revealed and should be hidden or obfuscated. So what we are going to do is,
[HEADING=2]Hide detailed information from server response headers[/HEADING] To mask detailed information from Server header, edit Apaches /etc/apache2/apache.conf file. Open the file and add following entries at the end. [IMG]https://miro.medium.com/v2/resize:fit:514/0*-fonf1N21zar05sS.png[/img] By changing the parameter of ServerTokens, you can mask information in few levels. Following is possible values for ServerTokens parameter. ServerTokens Full (or not specified) Server sends (e.g.): Server: Apache/2.4.2 (Unix) PHP/4.2.2 MyMod/1.2 ServerTokens Prod[uctOnly] Server sends (e.g.): Server: Apache ServerTokens Major Server sends (e.g.): Server: Apache/2 ServerTokens Minor Server sends (e.g.): Server: Apache/2.4 ServerTokens Min[imal] Server sends (e.g.): Server: Apache/2.4.2 ServerTokens OS Server sends (e.g.): Server: Apache/2.4.2 (Unix) After saving the file, if I restart apache server running the command, sudo service apache2 restart I can now see that detailed information from the server header are removed and it only displays the server is Apache. [IMG]https://miro.medium.com/v2/resize:fit:358/0*VM94jpEus3jPdJYn.png[/img] And also we need to hide PHP version which is disclosed by X-Powered-By header. To do that, simple include following line inside /etc/apache2/httpd.conf file. Header unset X-Powered-By This command will remove X-Powered-By header from the response and after restarting apache server you can see there is no more PHP version disclosure in the header. [HEADING=2]Configuration of Important HTTP Response Headers[/HEADING] Now we need to server to send Important security headers with the response. You can do this editing very file/etc/apache2/httpd.conf and add following lines. Header set X-Frame-Options SAMEORIGIN Header set X-XSS-Protection 1;mode=block Header set X-Content-Type-Options nosniff In this case lets consider only above three headers. Upon this configuration and server restart, youll now see these headers are now set in the server response. [IMG]https://miro.medium.com/v2/resize:fit:629/0*lGrpjfmVwegQwwNv.jpg[/img] These are only few configurations. Put a comment if theres any correction or something to be added. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[NEWS] Galaxy A52 gets more secure with October 2024 security patch | phillynews215 | Just About Digital Community | 0 | 10-23-2024 01:02 PM |
[NEWS] Galaxy Z Flip 5 gets more secure with July 2024 security update | phillynews215 | Just About Digital Community | 0 | 07-16-2024 08:58 AM |
Now you dont need a Titan Security Key for Googles ultra-secure protectio | phillynews215 | Bulletin News | 0 | 07-10-2024 07:56 AM |
: F-Secure Client Security 2009 | CYBER WEESJE | Recycle Bin | 0 | 12-03-2008 07:33 PM |
F-Secure Internet Security 2006 *status working* | redcell | Recycle Bin | 1 | 08-07-2006 04:05 PM |