Showing posts with label defense. Show all posts
Showing posts with label defense. Show all posts
Saturday, August 3, 2013
Why and How to hide Server Information
This tutorial shows how to hide the server information displayed (example show left) at the footer of any server-generated document. We also look why it is important to hide such information.
How to hide
The Apache version number and other information can be hidden by controlling two config directives.
The ServerSignature directive adds a line containing the Apache HTTP Server server version and the ServerName to the footer of any server-generated documents, such as error messages, mod_proxy ftp directory listings, mod_info output, etc. The Off setting, which is the default, suppresses the footer line (and is therefore compatible with the behavior of Apache-1.2 and below). The On setting simply adds a line with the server version number and ServerName of the serving virtual host, and the Email setting additionally creates a "mailto:" reference to the ServerAdmin of the referenced document.
Syntax:
ServerSignature On|Off|EMail
The ServerTokens directive controls whether Server response header field which is sent back to clients includes a description of the generic OS-type of the server as well as information about compiled-in modules.
Syntax:
ServerTokens Full (or not specified)
Example Footer: Apache/2.2.17 (Win32) PHP/5.3.5 Server at localhost Port 80
ServerTokens Prod
Example Footer: Apache Server at localhost Port 80
ServerTokens Major
Example Footer: Apache/2 Server at localhost Port 80
ServerTokens Minor
Example Footer: Apache/2.2 Server at localhost Port 80
ServerTokens Min
Example Footer: Apache/2.2.17 Server at localhost Port 80
ServerTokens OS
Example Footer: Apache/2.2.17 (Win32) Server at localhost Port 80
To complete remove the footer, open your httpd.conf file and append/modify config directive as follows:
ServerSignature Off
If you want a part of the information to be displayed:
ServerSignature On
ServerTokens [Major|Minor|Min|Prod|OS|Full]
Why hide
The first step when a hacker tries to crack into site/server is Footprinting and Reconnaissance (ie gather as such information as possible). This is done to select the right kind of hacks from a millions of hacks either available freely on the web or developed by the hacker. Trying out each and every hacks would take years, so the attacker spend a large amount of time on gathering as such as possible. Things become easy for the attacker if server information is displayed when he/she simply types a worng URL !!
In the above, the attacker can search for vulnerablities in Apache,OpenSSL, or FrontPage
So far this year (Aug-2013), 2 OpenSSL and 5 Apache vulnerabilites have been made public.
List of publicaly availabe vulnerablities
OpenSSL 0.9.8 : http://www.cvedetails.com/version/26306/Openssl-Openssl-0.9.8.html
Apache 2.2.17 : http://www.cvedetails.com/version/109443/Apache-Http-Server-2.2.17.html
So always use the lastest version and apply patches ;)
Thursday, August 1, 2013
Defense Against ARP Poisoning
The main reason why ARP Poisoning occurs is because the victim does not authenticate the ARP replies coming from a malicious user. As a result the ARP cache in the victim's PC contains invalid IP to MAC mapping and packet are sent to the attacker or dropped.
Defense in small networks
To view the current entries in the ARP table
victim#arp
To add an entry in the ARP as static/permanent
victim#arp -s <ip_Address> <MAC_address>
The ARP replies send by the attacker don't effect the static entries in the ARP. The ARP replies are recieved by the victim but they don't affect the statically entered ARP.To delete an entry in the ARP table
victim#arp -d <ip_address>
The mapping can be stored in a file and given as input to "arp" if there are too many entries.
Create a file with the entries in the following syntax
<MAC_ADDRESS> <IP_ADDRESS>
. .
. .
victim#arp -f <file>
But the table is cleared everytime the system boot or the network is reset.
To make the entries load into table, everytime the network adapter is turned UP.
create a file in the /etc/network/if-up.d/ directory with the following syntax
#!/bin/sh
arp -i eth0 -s <ip_address> <mac_address>
.
.
make it executable
victim# chmod +x /etc/network/if-up.d/<file>
comes to effect only after reboot.
Also if you dont want to accept ARP replies from anyone.
victim# echo 0 > /proc/sys/net/ipv4/conf/all/arp_accept
Subscribe to:
Posts (Atom)