{"id":305,"date":"2020-03-31T09:39:29","date_gmt":"2020-03-31T09:39:29","guid":{"rendered":"http:\/\/ictbank.ir\/blog\/?p=305"},"modified":"2023-05-02T17:00:04","modified_gmt":"2023-05-02T17:00:04","slug":"how-to-make-apache-web-server-more-secure","status":"publish","type":"post","link":"https:\/\/ictbank.ir\/blog\/how-to-make-apache-web-server-more-secure\/","title":{"rendered":"How to make Apache HTTPD Web Server more secure"},"content":{"rendered":"\n<p>There are some known security issues that can make an Apache HTTPD Web Server insecure.<\/p>\n\n\n\n<p>If using Apache HTTPD as a web service is your approach, then you should scan your web server in first step.<\/p>\n\n\n\n<p>There are many tools to scan a web server. here we will use <strong>NIKTO<\/strong>. Nikto is a free tool which is installed on Kali linux by default.<\/p>\n\n\n\n<p>You can scan your server by this command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nnikto -h ictbank.ir\n<\/pre><\/div>\n\n\n<p>This command may suggests some issues that you have to handle.<\/p>\n\n\n\n<p>Here we will see some of them and try to fix them:<\/p>\n\n\n\n<p>1.<strong>The anti-clickjacking X-Frame-Options header is not present.<\/strong><\/p>\n\n\n\n<p>This vulnerability means that this website could be at risk of a clickjacking attack. (read more: https:\/\/www.netsparker.com\/web-vulnerability-scanner\/vulnerabilities\/missing-x-frame-options-header\/)<\/p>\n\n\n\n<p>To secure Apache HTTPD from this threat, you have to edit Apache HTTPD config file (\/etc\/httpd\/conf\/httpd.conf) and add the follow line:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nHeader always append X-Frame-Options SAMEORIGIN\n<\/pre><\/div>\n\n\n<p>You can replace SAMEORIGIN option with one of these:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>DENY: It completely denies to be loaded in frame\/iframe.<\/li>\n\n\n\n<li>SAMEORIGIN: It allows only if the site which wants to load has a same origin.<\/li>\n\n\n\n<li>ALLOW-FROM URL: It grants a specific URL to load itself in a iframe. However please pay attention to that, not all browsers support this.<\/li>\n<\/ul>\n\n\n\n<p>2.<strong>The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS<\/strong><\/p>\n\n\n\n<p>As the message indicate, this vulnerability can lead to XSS attacks. (read more: https:\/\/www.keycdn.com\/blog\/x-xss-protection)<\/p>\n\n\n\n<p>To secure Apache HTTPD from this threat, you have to edit Apache HTTPD config file (\/etc\/httpd\/conf\/httpd.conf) and add the follow line:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nheader always set X-XSS-Protection &quot;1; mode=block&quot;\n<\/pre><\/div>\n\n\n<p>3.<strong>The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type<\/strong><\/p>\n\n\n\n<p>with this vulnerability there is a possibility to execute style sheet and steal content from another site through content type doesn\u2019t match (read more: https:\/\/geekflare.com\/secure-mime-types-in-apache-nginx-with-x-content-type-options\/)<\/p>\n\n\n\n<p>To secure Apache HTTPD from this threat, you have to edit Apache HTTPD config file (\/etc\/httpd\/conf\/httpd.conf) and add the follow line:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nHeader set X-Content-Type-Options nosniff\n<\/pre><\/div>\n\n\n<p>Don&#8217;t forget to restart Apache HTTPD service after these changes. Good Luck!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are some known security issues that can make an Apache HTTPD Web Server insecure. If using Apache HTTPD as a web service is your approach, then you should scan your web server in first step. There are many tools to scan a web server. here we will use NIKTO. Nikto is a free tool [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[140,53,55,1,51,50,52,71],"tags":[],"class_list":["post-305","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache","category-centos","category-fedora","category-installation","category-linxu","category-os","category-redhat","category-security"],"_links":{"self":[{"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/posts\/305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/comments?post=305"}],"version-history":[{"count":5,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/posts\/305\/revisions"}],"predecessor-version":[{"id":736,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/posts\/305\/revisions\/736"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/media\/732"}],"wp:attachment":[{"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/media?parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/categories?post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ictbank.ir\/blog\/wp-json\/wp\/v2\/tags?post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}