Support The Ethical Hacker !! - Click Here If You Like My Contents !!!

Showing posts with label countermeasures. Show all posts
Showing posts with label countermeasures. Show all posts

Tuesday, December 1, 2009

DDOS-Distributed DOS Attacks

DDOS attacks are very effective as well as dangerous when compared to the simple DOS attacks.
Now You might have a question.. A Big WHY...?
So let me come to the point....
DDOS attacks are multiple leveled attacks.We will discuss more on this in later parts.This makes them very dangerous.Due to the same reason these type of attacks are very difficult to counter.
Know what is different in DDOS Attacks...
In DDOS attacks an attacker breaches in to a lesser secure network say consisting of some 150 systems.He takes control of all systems in that network.Then in the later steps he'll install tools in those systems which can do a DOS attack or even Worse a DDOS attack.Then he will initialize the systems to attack.This makes it difficult to counter or prevent .

One common method of attack is to saturate the target by initializing many external connection requests and there by ceasing even the legitimate connection requests from reaching the target.This may prove to be very hazardous to the companies and firms which rely the internet or their network for income generation.For Eg: A DDOS attack on Yahoo or Google servers may lose them Billions of dollars in income even in several minutes. 



Courtesy: Wikepedia

Countermeasures :
  • Separate or compartmentalize critical services.Do not use the same server to give many services.
  • Buy more Bandwidth than normally required to counter the sudden attacks
  • Filter out usless or malicious traffic as early as possible
  • Disable publicly accessible services
  • Portscan the system regularly and make sure that no DDOS attacking tool is installed in the system
  • Balance traffic load on a set of servers
  • Regular  monitoring and working closely with the ISP will always help.
  • Patch the systems regularly
  • IPSec provides proper verification and authentication in the IP protocol
TOOLS:
  • Tribal Flood Network (TFN)
  • Trin00
  • Stacheldraht
  • shaft
  • Mstream
  • WinTrin00


Tuesday, November 24, 2009

DoS- Denial Of Service Attacks

This a common form of attack any admin should protect his networks from.DoS attacks are used to compromise or bring down systems and networks.Each System connected to internet has a limited bandwidth and memory available for it.In the DoS attacks an attacker tries to choke or clog up all the available bandwidth on the target.As a result even the legitimate customers or clients are no longer be able to connect to the target.Some kind of data traffic is used by the attacker as the weapon for this attack.

Main Steps in DoS attacks:
  1. Attacker sends technically infinite amount of malicious data to the network.
  2. Target network gets choked or clogged up and cannot handle the inflow of the malicious data.This results in the crashing of the network as well as the target system.
  3. Even real people or clients cannot connect to the target network.
  4. This  results in loss of revenue,disrupt services,inconvenience,customer dissatisfaction and many other problems.
  In most of the cases a server may have a T1 or T3 connections that serves all the clients.A simple DoS attack can easily generate a traffic up to 20 to 30 Mbps clogging up the entire network bandwidth.Now this may be fatal for the services offered.A DoS attack is usually an attack of last resort. It’s considered an unsophisticated attack because it doesn’t gain the hacker access to any information but rather annoys the target and interrupts their service.

Different types of Dos attacks :
Some type of main DoS attacks are briefed in this section.

Ping of Death :
TCP/IP protocol is working based on many rules and limitations.One of such limitations is that the maximum size of a data packet that can be sent through a network is 65536 bytes.In the Ping of Death attack a packet having the size greater than the maximum allowable size is send to the target system.As soon as the target receives such packet it crashes or hangs or reboots.This is because the protocol can handle only legitimate data packets.The main problem with this attack is that any one can do such an attack with the help of a slightly advanced ping tool or command in Linux .
 command in Linux to perform this attack :
ping -l
Eg: ping -l 65545

NB:This attack only affects  the systems up to Win 95/98.All the upper versions are patched to this type of attack.

Tear Drop Attacks:
These kind of attack can affect many systems on the internet.Now let me explain the concept behind this attack.Normally the data sent from the source to destination is broken down in to smaller chunks and later combined together in to a larger file at the destination.
For Eg:
Say,a  5000 part ( just a quantity) data which is in single chunk has to be sent in a network.So we can assume that the data is to be broken in to 3 smaller parts for the process.
Chunk A contains data from the 1 to   1500 parts
Chunk B contains data from the 1501 to   3500 parts
Chunk C contains data from the 3501 to   5000 parts
It is important to note that the different chunks does not have any  overlapping ranges.

In the Tear Drop attack the data chunks of overlapping ranges is sent to the target.As the target does not know how to manage or process or combine the data, it will get confused and the system may crash or hang or even reboot.
The data send for attack will be of this way :
(This is not the real data or methodology.I am giving this Eg: to enhance your understanding only)
Chunk A contains data from the 1 to   1500 parts
Chunk B contains data from the 1499 to   3500 parts
Chunk C contains data from the 3499 to   5000 parts
Here you can see the data ranges of the data packets overlap.

Fragmentation Attacks:
This is a variation of the Tear Drop Attacks.Here the attacker sends streams of data packets with identical fragments to the target system.Since the target does not know how to put back the data together it crashes or hangs or reboots.

Chunk A contains data from the 1 to  1500 parts
Chunk A contains data from the 1 to  1500 parts
Chunk C contains data from the 3501 to 5000 parts
Here we are not sending chunk B,instead we are sending only the chunk A twice.

Smurf Attacks :
This is another type of DoS attack.Here in this attack attacker sends infinite number of ping requests to the broadcast address of the target.
A few words on the Broadcast address : This is a IP address which are used by the network admins to sent a data to the entire network.Every node connected to the network will receive the message directed towards the broadcast address.
 So what happens in this attack..?
Each system receiving the ping must reply to it using ICMP replies.Due to the infinite loops thus generated and due to the large number of pings, the target network will crash or restart or hang up.

NB: IRC servers are considered as the primary victim of smurf attacks on the Internet.

Countermeasures against Smurf attacks:
  1. Block all data packets with source address same as any internal system,having the source address as the broadcast address.
  2. Disable the broadcast address.
  3. Always remember that there is no reason why an external system needs to send some data to the broadcast address.
Land Attacks :
In a Land attack, attacker sends a packet to a system where the source IP is set to match the target system’s
IP address. As a result, the system attempts to reply to itself, causing the system to create a loop
which will tie up system resources and eventually may crash the OS.Here the source and the destination IPs are same in the packet sent When the attacker sends infinite malicious packets to the victim the case becomes even worse.
Countermeasures for Land attack :
Filter all data packets having the same source and destination IP's.
NB: Make sure that we do not block the packets having the same source and destination ports by mistake .

SYN Flooding :
The main principle behind this kind of attack lies in the  way each TCP/IP connection is established.Each connection is established in a 3 way handshake process.This is  explained in other posts.

Let us discuss how SYN Flooding exploits this classic 3 way handshake process.
   In the attack , the attacker sends infinite number of connection requests in such a way that the packet orginates from a spoofed IP address.This creates infinite threads in the half open states.

Spoofed IP => SYN packet => Host
Host => SYN/ACK Packet => spoofed address

During this process the host will allocate certain amount of memory for each connection.Here the attacker sends infinite packets.When the whole memory of the target is used up the target may hang or crash or reboot.

3 important scenarios in SYN Flooding.
  1. The spoofed IP address does not Exist :
The data reply packet will travel in the internet until the TTL value reduces to 0 or dropped at the router.But until this time target waits for the ACK from the source IP and space allocated for the connection remains used up.
     2.The spoofed IP address Exists :
When the SYN/ACK reaches the IP it sends an error message and the target on receiving this message will free the allocated memory.
     3.The spoofed IP is inside the target network :
This makes the job very easy for the attacker.This allows the attacker to increase the strain on the network and uses up  all the available network resources.
Loop Back Flooding:
This is one of the oldest examples of the DoS attacks.


The attacker exploits two services in the OS to carry out this attack.He sends infinite data to the "Chargen" service of a victim UNIX system such that the packets are originated from the "echo" service of the same system.

A small Overview about the Chargen and Echo daemons :
These are designed in a way that , what data  received is sent back to the source. They loop it back or reply or send same data to the source.
The echo service sends data to chargen , and chargen in turn sends it back and so on.Thus an infinite loop is created in the target and is eventually DoS attacked.

NB:This type of attack does not affect modern syatems.Almost all systems are patched to this type of attacks.

Tools:


TIPS:
If the the spoofed IP address exists , make sure you DoS attack it before SYN Flooding any network.

Session hijacking:
This is a hacking method that creates a temporary DoS for an end user and the attacker takes over the current session.This is done after the user has established an authenticated session. Session hijacking can also be used to perform a man-in-the-middle attack when the hacker steps between the server and client and sniffs all traffic.

E-mail Forging- Sending spoofed mails

Email spoofing is the art of sending spoofed mails to the target in order to create chaos on the other end.Many criminals make use of this technology to send spoofed mails.This allows the attacker to send the E-mail from the victim's mail account without knowing his or her passwords.

Even these days we can find many vulnerable servers connected to the internet which allows unauthenticated access to its smtp ports.This allows the attacker to send spoofed mails.

The general methodology for sending spoofed mails, using telnet is described below. We can use the same method to send spoofed mails after knowing the vulnerable server.

start > run >cmd telnet 25
help
helo < domain name>
mail from : < sender's mail address>
rcpt to : < victim's mail address>

data
< message>


Countermeasures:
Always use a secure E-mail system like "Pretty Good Privacy"( PGP) for sending mails.
Digitally sign the E-mail's.
DO NOT do transactions blindly believing the E-mail service.
The most important aspect is the awareness of the user that nothing  can be done effectively against E-mail spoofing

Some Eg sites which will allow you to do Email Spoofing:

funmaza- funmailer
link 2

TIPS:
The links I provide is purely for educational purposes.

Even though you send spoofed emails it is easy to track the IP of the person sending the mails. Be Aware of that.

Create Disposable Email ID :To create a disposable email address to protect your privacy online. If you need to give someone your email address, or need to sign up to a website which requires an email address, but you don't wish to reveal your identity then use this free service for receiving emails. Simply signup instantly, give them the disposable email address and you'll be able to read every email they send in complete privacy. ( use it at your own risk) click here to get one.

Wednesday, November 18, 2009

Email Header Finger Printing

When we send an Email, the SMTP server creates a header.Study of the Mail server name reveals the OS of the server. For all this ,we have to analyze the Email Header first. The email header reveals a lot of other sensitive information about the sender including his IP.We will discuss more on this topic on other posts.
Countermeasures :
Change the mail daemon settings 

A sample Email header is shown below :


Delivered-To:XXX @gmail.com
Received: by 10.142.100.4 with SMTP id x4cs39161wfb;
        Tue, 17 Nov 2009 22:37:56 -0800 (PST)
Received: by 10.90.17.29 with SMTP id 29mr1540839agq.79.1258526174775;
        Tue, 17 Nov 2009 22:36:14 -0800 (PST)
Return-Path: 
Received: from mail15-a-ac.linkedin.com (mail15-a-ac.linkedin.com [208.111.169.137])
        by mx.google.com with ESMTP id 30si16545010iwn.121.2009.11.17.22.36.13;
        Tue, 17 Nov 2009 22:36:13 -0800 (PST)
Received-SPF: pass (google.com: domain of s-qKShvR1E_bKJbE3KpcihvgYpqS5pjeiVFRKjniEn-5Sp4jYEI5tJj_@bounce.linkedin.com designates 208.111.169.137 as permitted sender) client-ip=208.111.169.137;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of s-qKShvR1E_bKJbE3KpcihvgYpqS5pjeiVFRKjniEn-5Sp4jYEI5tJj_@bounce.linkedin.com designates 208.111.169.137 as permitted sender) smtp.mail=s-qKShvR1E_bKJbE3KpcihvgYpqS5pjeiVFRKjniEn-5Sp4jYEI5tJj_@bounce.linkedin.com; dkim=pass header.i=communication@linkedin.com
DomainKey-Signature: s=prod; d=linkedin.com; c=nofws; q=dns;
  h=Sender:Date:From:To:Message-ID:Subject:MIME-Version:
   Content-Type:X-LinkedIn-fbl;
  b=LAlAw9S8qrGPLt6phtZNvQ37jeg3yvtYlApfNHApbwizFBIvNvk2D1H6
   r7PxLyDTGK5YmRBn84TgBPD5FB0gt90r9Khp4TnNFIHyM3Sy64uMytmRj
   N4agg6dfvT5H2mO;
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple;
  d=linkedin.com; i=communication@linkedin.com; q=dns/txt;
  s=proddkim; t=1258526173; x=1290062173;
  h=from:sender:reply-to:subject:date:message-id:to:cc:
   mime-version:content-transfer-encoding:content-id:
   content-description:resent-date:resent-from:resent-sender:
   resent-to:resent-cc:resent-message-id:in-reply-to:
   references:list-id:list-help:list-unsubscribe:
   list-subscribe:list-post:list-owner:list-archive;
  z=From:=20LinkedIn=20Communication=20
   in.com>|Sender:=20messages-noreply@bounce.linkedin.com
   |Subject:=20LinkedIn=20Messages,=2011/17/2009|Date:=20Tue
   ,=2017=20Nov=202009=2022:36:03=20-0800=20(PST)
   |Message-ID:=20<2138821644.368566.1258526163419.JavaMail.
   app@ech3-cdn09.prod>|To:=20"Mr.Swaroop=20Krishnan=20S"=20
   |MIME-Version:=201.0;
  bh=HFHniqCRWqBOKiU6PXUVuudYIJ3jsx+QLmyfTd3eFzU=;
  b=SDfsYwsz/HCedRw3aFZ2JkOkKrLzzK2R1gVWv2WDNXhKtr2kM0ioAlZi
   m230bpQm4ZzCi2fwM2yyYbY8GauwKPZav6r23wyGA4hTBwHKLheSmXFI5
   /+urlA2oJGJPlWR;
Sender: messages-noreply@bounce.linkedin.com
Date: Tue, 17 Nov 2009 22:36:03 -0800 (PST)
From: LinkedIn Communication 
To: "Mr.Swaroop Krishnan S" 
Message-ID: <2138821644.368566.1258526163419.JavaMail.app@ech3-cdn09.prod>
Subject: LinkedIn Messages, 11/17/2009
MIME-Version: 1.0
Content-Type: multipart/alternative; 
 boundary="----=_Part_368565_1338859.1258526163416"
X-LinkedIn-fbl: qKShvR1E_bKJbE3KpcihvgYpqS5pjeiVFRKjniEn-5Sp4jYEI5tJj_

------=_Part_368565_1338859.1258526163416
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

OS Fingerprinting -Finding Remote Host's OS

 It is very important for an attacker to know about the OS of the target.Different OS's have different stacks and kernels.The response to same message is different in different OS's so by analyzing these messages we can know about the OS in the host.Attacker sends packets made using the packet generation softwares and the target is forced to respond to it.Thus OS finger printing is done.

The techniques used for this purpose can be classified in to 2 types namely :

1) Active finger printing
2) Passive finger printing

Active fingerprinting :
steps:
A customized data packet is send to the target host.
The response generated is recorded using  the packet sniffer.
The recorded response is studied and compared to known responses and OS is identified.

Fators helping us to identify the OS :

TCP initial window size of the packets.
ACK values of the packets.
Initial Sequence Number(ISN)  values
Heading of overlapped fragments.
ICMP Message quoting method
ICMP Error Message quenching method
ICMP Error Message Echoing integrity

Problem:
The attacker will have to send the packets actively to the target and record its responses.
This method is not anonymous.So it may have tha attacker caught in the act.

That is why we go for Passive Fingerprinting.

TOOLS for active finger printing :

Nmap
Quso
Aping


Passive Fingerprinting :
This method is  anonymous. It is very difficult to identify passive fingerprinting.

The main steps in this method are as  follows :
The attacker uses a sniffer to record the data packets sent by the target.
The various parts of the response is analyzed for particular values which are specific for a particular OS.
Thus the OS of host is found out.The attacker may install the sniffer in a cafe and analyze the packets recieved while someone connects to the same computer.

The main fields studied in the passive method are:
TTL value
The window size
Don't fragment bit
Type of source (TOS)

 Consider the example :
When we recieve a
windows size =9000
TOS =0
DFB =yes
then the host must be running a Win9X or Win NT

Countermeasures:

Change the default values of the parameters studied.
Mislead the attacker by giving values of another OS.
Use ACL for filtering.

Saturday, November 14, 2009

Daemon Banner Grabbing

When an open port is known,we can try to connect to the port.Then we may get some banner which will reveal many information regarding the server or the target.This process is called banner grabbing. Many e-mail, FTP, and web servers will respond to a telnet connection with the name and version of the software. The aids a hacker in fingerprinting the OS and application software.
For example, a Microsoft Exchange e-mail server would only be installed on Windows OS.
 What is it used for.?
Mainly to gather information regarding the daemon name, version and the OS information.
We can also use this for security measures detection.
This also helps in identifying the possible points of entry.But this method is very risky.

Countermeasures :
Edit the default welcome message and ensure taht important info is not shown.
Misguide the attacker by displaying false banners.
Use a long false daemon banner and in the background record the info to trace the attacker.

TOOLS:
Netcat (Unix)
Superscan
SamSpade crawler
Nmap Tool