how to hijack a tcp connection|hacking tcp sessions

Hijacking a tcp connection requires just a little bit knowledge about IP spoofing and ACK numbers.┬áIP spoofing is a simple technique in which the attacker/hacker replaces the IP address of the sender i.e sends some data by confusing the receiver.ACK or SEQ numbers are used by the web servers to distinguished between different sessions and to check that whether the user’s session is still active or not.In fact hijacking a tcp connection is not a difficult task;here is the simple description so that you can understand the basic steps.

So the tcp connection-session can be hijacked in the following simple steps –

step1 : Try to learn more and more about that victim-Z and the web server-F before proceeding to the next step.If you are monitoring the connection in a wireless network then you can also use wire-shark or other advanced network traffic monitor tools.(You can also use a Linux based operating system “Linux-back track-4” specially designed for hackers and penetration testing,because it contains all the required tools by default.)

step2 : The web server-F sends an echo back to the victim-Z and the victim acknowledges the data packet.

step3 : Now you can send the spoofed packet to the web server-F.

Step4 : Then the web server-F responds to you and you can start verifying ACK/SEQ numbers and the web server believes that the session is going on with the victim-Z.Now you have hijacked the session of the victim-Z.

Step5 : So you can continue the use of that session and web server will returned the requested information by checking the ACK number..and the connection will be continue until the FIN flag is changed to terminate.

what is ip fragment attacks|IP fragmentation hacks

IP Fragment

IP fragments is useful in keeping tracks of the different parts of a datagram in TCP/IP suite.When the data packets arrived at the destination field then it is used to reassemble the datagrams.The identification value of all the IP fragments are same so the fragmentation offset is used to indicates the actual position of the current fragment in actual datagram packet.

Hacking/attacking IP fragments

In general the ip fragments do not coincides but a hacker can create ip fragments packets artificially,in order to forge the firewalls or routers.Suppose the second fragment of the datagram packet is inserted to the sequence by the hacker and the offset value of the second packet is less than the length of the first fragment.Then this situation may results in the overriding some bytes of the first segment on the time of reassembly at end computer.So this defected ip fragments may be responsible for the improper functioning (or crash) of the operating system.This is known as ip fragment attacks.A simple example of the ip fragmentation attack is the ping of death attack which sends the ip fragments that create the larger packets then the maximum allowed length at end computer.

What is sniffing|sniffers?

Sniffing is the simple process in which the network interface card is used to receive and monitor data that is not intended for that machine.The device or software that does sniffing are known as sniffer or more simply a network analyzer.Sniffing programs are very useful in gathering sensitive information like telnet username and password,ftp username and password.,credit card numbers,bank account details..and so on.Hence sniffing techniques are widely used by the attackers and hackers to monitor the key information that the hacker is interested in.In a network all the NIC(Network Interface card) have the unique mac(Media Access Control) address.In general the NIC responds to that packets only which contains its own mac address in the frames destination field or the broadcast address in the destination field.Network Interface cards also supports a mode known as promiscuous mode,in which it can receive all data packets and traffic that travels across the network.In promiscuous mode NIC generates a hardware interrupt to the CPU every packet’s frame they encounter(instead of the only the frames having the mac address or broadcast address)s.So the sniffer puts the NIC in to the promiscuous mode and capture/monitor the data packets traveling around the network by passing the all traffic to the operating systems TCP/IP stack.Hence a sniffer or network analyzer is also helpful in troubleshooting the networks and used by the network administrators.

Why sniffing threatens network security?

The sensitive information that can be collected by sniffers are :
1. Passwords(eg.ftp,telnet,pop,imap.. loging password)
2. Bank account numbers
3. Any other Private data
4. Low level Protocol Information

Some common Sniffing softwares(sniffers)

* dsniff
* Esniff.c
* TCPDump
* sniffit

How to spoof dns cache?dns cache poisoning/hacking

Spoofing DNS Cache:

DNS i.e domain name system is distributed database with a hierarchical structure used to translate the human friendly host names into the IP address,in TCP/IP Network.So when a computer wants to communicate with then it first sends a query to the local DNS server and the dns server checks its databases to find the corresponding ip address.If the local server fails then it tries to communicate with the other remote dns servers,and finally
it returns the corresponding IP address to the users computer(If there is no problem on servers).After this events the users computer and local dns server(if failed to resolve) updates its database so that in future it can use that ip address-host name maps without any further queries with the other dns servers.There are many available methods for spoofing the dns cache but the simple concept is to alter the corresponding map between the host name and IP address in the dns cache of the victim computer or dns server.
Two simple methods to poison the dns cache –

1. Hacker sends a dns query to the local dns and before the local dns server gets the true result fr0m the remote server,the local dns server is flooded by the fake reply(By hacker),thus the local dns cache gets spoofed.

2. In this method the hacker poison the host names by their fake website IP address,so when the user sends the request to the infected dns server,then it maps to the fake website.

dns cache spoofing and poisoning
How to protect the dns by spoofing/poisoning
Use Open DNS : It will protect you fr0m the dns cache spoofing as well as other benefits.For more info :
credit : CpGlobal

Hacking ARP(Address Resolution Protocol)

What is ARP?

ARP i.e Address Resolution Protocol is a lower level(in TCP/IP stack)protocol which is used to convert IP address to MAC(Media Access Control) address.IP addresses are dynamic(In general) but mac addresses ,a link layer address, are almost static as they are allocated by the NIC(Network Interface Card) manufacturer.Hence ARP is used to associates a relation between these IP addresses with static hardware address(MAC).

How The ARP works?

Whenever a router or switch or computer recieves a data packet with the destination IP address,then the device uses its ARP table to to look up the corresponding MAC address.Suppose,if the packet’s IP address does not have a corresponding MAC address in the ARP table,then the device will send an ARP broadcast request on that local network to find out the MAC address for the IP address.At this point,the computer which owns the IP address will take an appropriate response(or simply ARP reply) to the arp broadcast request packets.When the device,that sent the arp broadcast request request,gets the responsse then it stores that mac address to IP address in its cache memory.Now if the another packets arrives there for the same IP then it sends it to the mac address(just cached),without repeating the arp broadcast request and arp-replay process again.

How to hack ARP/Abuse ARP/Poison ARP

In this process the main critical point is that there is no authantication mechanism used here to verify that whether the ARP reply is coming fr-o-m the same computer that owns the IP address, or not.Using this loophole in the arp mechanism,it can be hacked easily if attacker sends fake request to abuse the device.Another problem is that suppose a computer sends an ARP reply without any broadcast request then it caches this mac to IP address for the future use.Hence arp can be hacked or attacked or abused in two ways –
1.First Method : In this method the hacker first listen for the arp broadcast requests and takes appropriate responses with their MAC address.This method is not so usefull and efficient due to the reason that the hacker has not only to wait for the victims arp broadcast request but also to send the replay before the true host reply.
2.Second Method : The second method to poison the network is to send arp reply to target device,so the target device will update its IP-MAC table in cache memory with the recieved mac address.Hence this method is simple and more effective than the first one.