INDOhack

ZONANYA HACKER DITO

Subscribe
Add to Technorati Favourites
Add to del.icio.us
24 September 2009

LAN HACKING _


This is the second post on lan hacking it is advanced part of lan hacking check the basic post on sniffing the lan for passwords and chat conversations
ARP – What is it?
ARP stands for the “Address Resolution Protocol”, and is acclimated to acquisition the networks hosts Concrete Addresses (MAC addresses) aback alone the arrangement band abode is available.
The arrangement band is the third band in the OSI model, and responds to carriage band requests (4th layer) and easily out annual requests to the abstracts articulation band (2nd layer). Arrangement layers are amenable for the alteration of packets from the antecedent up to the destination, and accommodate affection of annual alternating the way. Arrangement layers are said to be both connection-oriented and connectionless, as there are situations of both scenarios, aback the end user has to acquire the affiliation in a connection-oriented situation, or the affiliation is artlessly fabricated in a connectionless situation. Aural the arrangement layer, there are abounding adapted protocols, such as IPv4/IPv6, which includes things like ICMP (Internet Ascendancy Bulletin Protocol) and DVMRP (Distance Vector Multicast Routing Protocol), as able-bodied as things like IPSec (Internet Agreement Security), and IPX (Internetwork Packet Exchange).
ARP is not apprenticed to absolute the accouterments abode from IP addresses only, but can be (and is) acclimated with any agreement from the arrangement layer. However, because of the acceptance and body of IP based Ethernet connections, ARP is usually acclimated to boldness an IP abode to the Accouterments (MAC) address, however, it is not belted to IP over Ethernet, and is acclimated in things like Token Rings and Wireless Networks. ARP is acclimated about in four adapted situations, being:
1.Two PC’s on the aforementioned network
2.Two PC’s on adapted networks application a router to connect
3.When a router sends a packet through addition router to a host
4.When a router accelerate a packet on the aforementioned arrangement to a host
The aboriginal bearings is acclimated artlessly for LAN, and the aftermost three about for WAN (Internet mainly).
ARP has two capital formats; appeal and reply. A appeal is acclimated for archetype aback a host, such as 10.1.1.2 with a MAC of 00:11:22:33:44:55, needs to accelerate a packet on to a anew affiliated applicant 10.1.1.3, the MAC of which is as yet unknown. 10.1.1.2 will again accelerate an ARP appeal to acquisition out this information. A acknowledgment would again be issued to 10.1.1.2 absolute 10.1.1.3’s MAC address. The appeal absolute 10.1.1.2’s IP and MAC is accessible for all on the arrangement to view, and accordingly accumulation the information; however, the acknowledgment is alone accessible to the ‘requestee’. There are additionally ARP probes, which are acclimated aback a applicant joins a network. Already joined, it charge advertisement an ARP delving to actuate if it’s IP abode is already in use or not. ARP is acclimated because computers on an Ethernet arrangement can alone acquaint with anniversary added already they apperceive the MAC abode of the applicant they are aggravating to acquaint with. ARP is buried in a table which maps the admission amid an IP abode and their accompanying MAC address. A simple affairs which can be acclimated to appearance this (on Windows) is PacketCreator 2.1, beneath the ARP tab. Linux has a added avant-garde affairs for this – Arpwatch (ftp://ftp.ee.lbl.gov/arpwatch.tar.gz). This affairs generates and annal logs of anniversary IP and it’s accomplish and the time it was assigned, in adjustment to ascertain ARP Poisoning, and will accelerate an email aloft apprehension of ARP poisoning.

ARP Poisoning?
ARP contagion is additionally accepted as ARP spoofing, and is acclimated to become what is accepted as the “Man in the Middle”. This agency that an antagonist can use this on a arrangement (Ethernet or wireless) to alter all cartage through them passively, which will acquiesce audience accustomed internet service, with the barring of casual all abstracts through the antagonist aboriginal and thereby acknowledgment all such secrets to that antagonist unwittingly. The antagonist additionally has the befalling to either adapt the packets as they canyon through in adjustment the change the information, or artlessly stop any traffic, which is accepted as a DoS (Denial of Service). The basal aim of ARP contagion is to actualize affected ARP letters which will map the added IP’s to the attackers MAC abode in the cache’s of the client. For example, lets acquire the aperture 10.1.1.1 has a MAC abode of 0E:33:FB:G3:G2:11, 10.1.1.2 has a MAC of 00:02:FE:G1:1B:CC, and 10.1.1.3 has a MAC of 00:11:22:33:44:55. If 10.1.1.2 was bold the attack, it would accelerate out ARP letters advertence that 10.1.1.1 and 10.1.1.3 was on MAC 00:02:FE:G1:1B:CC, and accordingly all cartage destined for either IP abode would be beatific to that concrete MAC abode as that cartage is transported over the arrangement layer. At this stage, it is up to the antagonist on 10.1.1.2 whether he assiduously 10.1.1.3’s cartage on to 10.1.1.1, or whether he prevents it from accepting there, or alters it on the way. A Denial of Annual could additionally be performed by sending an ARP bulletin allegorical the audience of fresh (but non-existent) MAC abode has been assigned to the absence gateway.
Setup Of Attack
For this tutorial, we will be application “BackTrack”, a Linux live-CD with a aegis focus (a customised adaptation of which is amid on the Hakin9 CD as Hakin9.live), which includes the accoutrement that will be using: Ettercap, Driftnet and Wireshark. Basically, arch over to Remote-Exploit.org – Supplying abhorrent aegis articles to the world and grab yourself a archetype of BackTrack. I’m activity to acquire you are all accustomed with the process, so grab your favourite burner, bake the ISO, and cossack from the CD, selecting the absence advantage from the CD’s Cossack Menu.
Ettercap Configuration
Once your desktop KDE affair is loaded, we will be application Ettercap to accomplish the MiTM attack, but to do so, we will acquire to set up Ettercap to use IPTables to advanced traffic. To do so, accessible up a terminal affair and blazon the afterward (everything afterwards the #)
Quote:
bt ~ # echo 1 > /proc/sys/net/ipv4/ip_forward
This enables IP forwarding. Then, blazon the following:
Quote:
bt ~ # kedit /usr/local/etc/etter.conf
This will accessible up a fresh window aural which is a argument book that holds all the agreement settings for Ettercap. Attending for the afterward curve in the file, and uncomment them by removing the hashes (except for the one abutting to “if”, again save it and abutting it:
Quote:
# if you use iptables:
#redir_command_on = “iptables -t nat -A PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”
#redir_command_off = “iptables -t nat -D PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”
to this:
Quote:
# if you use iptables:
redir_command_on = “iptables -t nat -A PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”
redir_command_off = “iptables -t nat -D PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”
We are now accessible to advance to the advance stage.

Becoming the MiTM
Now that Ettercap is set up, acceptable the MiTM is a almost simple action for the best basal attack. This advance will artlessly accomplish us the MiTM, and acquiesce us to appearance passwords that are transferred through the arrangement to such protocols HTTP, SSH plaintext, FTP, TELNET, POP3, etc. Accessible up addition terminal session, and blazon the following:
Quote:
bt ~ # sudo ettercap -Tq -M arp:remote /$IP/ -P autoadd
And alter $IP with an IP Abode ambit of your arrangement which includes the absence aperture and a few clients. Such as, for example, a arrangement which includes a router to the internet which is the absence aperture (10.1.1.1), and four audience including yourself (10.1.1.2-5). The easiest way would be artlessly to put the IP ambit as 10.1.1.1-5, and Ettercap will add in any added audience that accompany the network.
The “-p autoadd” about-face is optional, and apparently isn’t brash on above networks for accident of DoS’ing (Denial of Service) the clients, as it automatically adds in any added audience by audition the ARP requests that are beatific aback and forth, and free which audience exists and which don’t, and abacus any that do exist. At this point, Ettercap will browse through the IP Addresses that you acquire specified, bulk out which MAC abode they are on, and again accelerate out the affected ARP packets as declared earlier, pinpointing anniversary IP abode to the distinct MAC abode of you PC, casual actually all cartage through it. This enables us to watch aggregate that happens, as able-bodied as adapt any packets that arise through, but we will awning that in a little while.
First, you will apprehension in that aforementioned window that annihilation abundant is accident – that is because no apparent argument passwords are actuality anesthetized through the network. In adjustment to actuate if your advance has worked, go to addition PC on the aforementioned network, and try to login to commodity like a forum, or your hotmail account, or similar. Annihilation that does not acquire an https should work. You will apprehension that whenever you try to login to a website aback a MiTM advance is actuality performed, it will ask you whether you appetite to acquire a certificate. The advance works on the base that best bodies will artlessly acquire the certificate, cerebration annihilation added of it, and best bodies will. So aback you are testing if your advance worked, artlessly acquire the affidavit and watch your abracadabra go to work. If you are anytime application addition PC on a accessible network, and you see such a prompt, be absolute alert as to whether you acquire it or not. Appraise it and see who it was active by, etc., in adjustment to actuate if the affidavit is accepted or not. At this point, you could artlessly sit aback and watch the passwords be collected, or alpha up driftnet to appearance all the pictures actuality beheld over the network:

Quote:
bt ~ # cd /usr/local/driftnet-0.1.6/ && driftnet -i eth0
When abandonment Ettercap, accomplish abiding to columnist the letter “q” instead of the archetypal “Ctrl+C”, because that will Re-ARP all the clients. If you artlessly columnist Ctrl+C, again there will be a massive DoS, and no audience will acquire the internet or arrangement admission until they brace their arrangement position. You can additionally columnist “p” whilst Ettercap is sniffing, and you actuate added congenital plugins.
Now we can move assimilate some added absorbing propositions: manipulating the packets.
Manipulating the Packets
The possibilities of packet abetment are endless, apprenticed alone by your creativity, and the time you are accommodating to absorb exploring the adapted protocols and how they assignment and there relations with entering cartage and outbound cartage on the network. Ettercap comes with its own congenital in clarify creator, as able-bodied as a few of it’s own pre-made packets. Building your own clarify requires a basal adeptness of how programming languages work, or the adeptness to analyse and actuate how the Ettercap filters work, which is almost simple if you are acclimated to analysing data/packet streams with programs such as Wireshark. Accessible a fresh console, and type:
Quote:
bt ~ # kedit filter.pic
Then archetype and adhesive the afterward into the window that comes up:
Quote:
if (ip.proto == TCP && tcp.dst == 80) {
if (search(DATA.data, “Accept-Encoding”)) {
replace(”Accept-Encoding”, “Accept-Rubbish!”);
msg(”Modified Accept-Encoding!\n”);
}
}
if (ip.proto == TCP && tcp.src == 80) {
replace(”img src=”/, “img src=”http://img405.imageshack.us/img405/328/hacked28hi.png” “);
replace(”IMG src=”/, “img src=”http://img405.imageshack.us/img405/328/hacked28hi.png” “);
msg(”Replaced the picture.\n”);
}
if (ip.proto == UDP && udp.src == 80) {
replace(”img src=”/, “img src=”http://img405.imageshack.us/img405/328/hacked28hi.png” “);
replace(”IMG src=”/, “img src=”http://img405.imageshack.us/img405/328/hacked28hi.png” “);
msg(”Replaced the picture.\n”);
}
Save this, and again abutting Kedit. In that aforementioned animate session, run the afterward command to about-face the cipher into a clarify that is clear by
Ettercap:
Quote:
bt ~ # etterfilter filter.pic -o filter.ef
You will see a few things happen, and again the clarify will be created. Basically, the cipher is adequately simple. The “if (ip.proto == TCP && tcp.dst/src == 80)” basically tells Ettercap to alone pay absorption to the TCP agreement packets on either the destination to anchorage 80, or the antecedent from anchorage 80 (which is all web accompanying traffic), and again to chase the instructions that arise afterwards that – actuality to chase that packet for a string, again alter it with what you would like that cord to read. You will additionally apprehension that in replacing the strings, we charge accumulate the breadth of the two strings the aforementioned – be accurate to accomplish abiding you do this, or it won’t work. Now to accomplish this clarify run during your MiTM attack, we charge use a hardly adapted Ettercap command. The command to use is (assuming you adored the clarify in the /root folder):
bt ~ # sudo ettercap -T -q -F filter.ef -M arp:remote /$IP/ -P autoadd
Now move to addition computer, and cross to a website, and see a lot of pictures actuality replaced with the angel you specified! This can be actually funny. Alternatively, you can see the images actuality replaced by watching the achievement of your animate session. The clarify we created won’t assignment with actually every website because of the abounding assorted means of including images, but it will assignment with abounding of them.
Applying this aforementioned principal, you can for archetype bulk out the anchorage of a Messenger program, and adapt the approachable packets to accommodate words of your own – for archetype replacing commodity like “How are you” with commodity like “I abhorrence you!” (notice still the aforementioned bulk of characters – this is capital in accepted packet manipulation, however, is not all-important in our angel filter, as we are abacus to what is already there [via the use of the slashes], not modifying). Explore, and acquire fun with this.

Information Gathering
This area demonstrates how almost accessible it is to apprehend and accumulate advice by application the MiTM attack. Imagine if your neighbour apprehend absolutely what you beatific through your MSN logs, who to, and when. If you gave them continued enough, they could bulk out almost how you speak, and again alike log in as you and impersonate you to get added information. bold you are still the MiTM as in antecedent steps, accessible up Wireshark, and alpha capturing. This is done by activity to KDE Menu > BackTrack > Privelege Escalation > Wireshark, again bang Abduction > Interfaces, and bang “Start” on the interface you appetite to abduction the cartage on (in our case – ath0), and again delay about for a while as it captures information. If you are testing this in your own lab, go to your added PC and accessible up MSN, assurance in, and alpha talking to addition (all whilst Wireshark is capturing data).
Once you’ve chatted to a few bodies for a while, admission in the clarify area (near the top of the Wireshark window) “msnms” authoritative abiding it’s in lower case, again bang “Apply”. You will apprehension a cardinal of packets, best of which are useless, but if we attending closely, we can annihilate a few of these. The ones you would appetite to booty apprehension of are the ones with the “MSG” in advanced of them in the “Info” section. If it helps, you can bang on one of the MSG packets, and again bang Analyze > Chase TCP Streams, area you can again annal through all the conversations and apprehend what you charge to, or book it out and highlight the absolute conversation.
Another somewhat easier to use, but still buggy (and Beta) affairs that can be acclimated is one alleged “Imsniff”, accessible on sourceforge. To use this program, artlessly download and abstract the .tgz file, again in the terminal, cd into the “linux” directory, and run “build” by application ./build in the terminal. This will body Imsniff according to your arrangement devices. Again run:
bt ~ # imsniff -cd /root/chatlogs eth0
The acumen we run Imsniff on eth0 is because it is advised for eth0 by default, but the README in the /docs/ binder describes how to adapt it for wireless connections. You can additionally use the imsniff.conf.sample book to accomplish your own auto agreement binder for this. The alone bug I acquire encountered so far is that sometimes it won’t actualize the folders for anniversary MSN annual you are sniffing, and as such – no logs are recorded. To action this, artlessly actualize a binder aural your defined binder for that MSN contact, and again logs will be created aural there.
Another accessible ambush that you can do with Wireshark is abduction any SIP buzz calls that canyon through that network. Again, alpha a abduction process, again delay for a SIP alarm to be fabricated and completed, again stop the capturing. Now, artlessly go to Statistics > VoIP Calls, and from actuality it will account all calls made, duration, starting time, etc., and you can again comedy and accept to these calls from here. Imagine what your neighbour ability apprehend if they were application your wireless.
Further Possibilities:
Evidently, actuality a MiTM, there can be amaranthine possibilities as to the things you can do. If you can apprehend all packets and dispense all packets – again what’s to stop you authoritative the network? There are a few added basics that we haven’t covered in this article, and that would be more good larboard for you to analyze yourself. One of these possibilities is sniffing SSL (Secure Socket Layer) traffic, such as defended logins for sites like Hotmail (Secure Version), Banks, Online Stores, etc. It is above the ambit of this article, but the basics abaft it accommodate arising your own SSL Affidavit instead of accepting the company’s SSL affidavit issued, all the while bluffing the DNS requests, and capturing all packets with wireshark. These are again decrypted with SSLDump into a animal reable form, area any passwords can be apprehend by you. Obviously, this can acquire badly adverse furnishings to your boilerplate user who doesn’t appraise certificates.
Another achievability is re-directing all cartage to a assertive website. This can acutely be acclimated for fun – but what if addition acclimated this to accomplishment your PC? If they scanned your computer with Nmap, and ample out what casework and versions you were running, they could again bulk out if you had annihilation accommodating and actualize a webpage (that is locally hosted) through Metasploit, and again get Ettercap to alter all cartage to the folio – whereupon they will be exploited and you will acquire Root ascendancy of their system. You can angel how adverse this can be.
One added added achievability is that of added admission into the network. Imagine this – a applicant computer is accurate with the server based on it’s arrangement abode or fingerprint. This arrangement abode is again baseborn by you with your MiTM attack, appropriately authoritative you arise like that applicant to the server. The server would again accord you the priveleges of that applicant area you commonly would not acquire priveleges – addition ample aegis blackmail for administrators. These are aloof a few added account for possibilities that can be accomplished through Ettercap – you are alone apprenticed by your imagination, so acquire a comedy about and bulk some things out.