Ettercap - ARP poisoning unsuccessful - arp

Yesterday I successfully performed a MITM attack by ARP poisoning between my router and my Windows7 computer. I used Ettercap on a Linux machine.
However, today, running the same command does not work anymore. It looks like Ettercap cannot reach my computer, which IP is 192.168.0.17.
Here is what I got :
We can see that the only host added to the list is the router one (192.168.0.1)... What I don't understand is that it was working few hours ago.
I noticed also another thing.
using the command
sudo arpspoof -i wlp20s0 -t 192.168.0.17 192.168.0.1
The ARP poisonning DOES work this time. But now the problem is that it is acting like a DDOS on my victim... It completely loses internet connection.
And before it was not, it was working as expected.
So I guess something has changed on my victim computer but I cannot figure what.
Thank you.

IP forwarding is the ability for an operating system to accept incoming network packets on one interface, recognize that it is not meant for the system itself, but that it should be passed on to another network, and then forwards it accordingly.
From https://openvpn.net/faq/what-is-and-how-do-i-enable-ip-forwarding-on-linux/
When you perform MITM packets that don't match your IP are being sent to you and are not passed on correctly so the victim can reach out to the internet. With IP forwarding enabled your computer will reroute the packets correctly and the attacked computer will have access to the internet.
On Linux if I remember correctly:
echo 1 > /proc/sys/net/ipv4/ip_forward
will fo the job.

Arp replies are stored in cache, so first of all do some tricks here:
Remove arp cache from windpws with cmd.
(Cause the first priority is the cache and if host cant find the mac address it will generate an ARP request,then your router will repliy with ARP reply)
issue this command to see arp table:
arp -a
When you do Mitm with arp spoof and your computer looses internet connectivity it might be your DNS misconfiguration.
You ll need to enable dns server.
(If wan to brows web pages)
Try to do it with ettercap and enable arp poision and dns spoof module.

Related

arp -a does not list all devices

I have an app which checks whether a certain IP is on the local network. The IP belongs to a raspberry pi working as a homeautomation device.
Running the command
arp -a
from terminal or from within my app I get a list of all devices on the local network, but my raspberry pi is not always listed. After pinging the device, it appears on the list every time.
Any ideas what is going wrong?
That's the way ARP works. ARP entries are created only when they're needed. The first time you need to communicate with an IP on the local network, your device broadcasts an ARP query, then caches the response. There's nothing that proactively fills in the cache for all IPs on the LAN.
In addition, old entries may be removed from the cache if they haven't been used in a while.

At which layer of OSI model an ARP request is made by host computer?

In order to get the MAC address of destination's computer, the host computer sends an ARP request. At which layer ARP request is made?
It's a link layer as described in ARP article on wiki. It's really helpful to see packet structure by yourself, so I encourage you to install wireshark on your PC, to start sniffing network and to ping non existing IP address in your subnet. Filtering by "arp" will show you something like this:

Programmatically get IP of directly connected device

Using C I am trying to discover the IP of a locally connected device without knowing any information about the device.
[ my box ]--eth0--------------[ unknown device ]
I can't seem to find a way to arp/broadcast to get the IP of the device. I understand that if I use multicast the device itself has to be a member of the group. When I arp or arp-scan they ask me to assign my eth0 interface an IP but I don't have one assigned, I can put one if I need to but I am unsure what it needs to be set to in order to discover anything.
Example: I have a Linksys wireless IP camera and I want to find the IP/Subnet. Without knowing its subnet/netmask I wouldn't know what to set my eth0 to.
I have written a C program to parse the arp table in Linux but I cannot seem to get the IP from the locally connected device in it. As mentioned above, I cannot use these tools without setting eth0 to something.
I think Your best chance to find something is by capturing all incoming network traffic, especially while unknown device is booting (using tcpdump, wireshark or something similar). Just filter out traffic, which is sent from my box.
Most likely You'll see DHCP requests and maybe ARP requests. If device is using DHCP, the easyest solution would be to run DHCP server on eth0 (so You can assign IP to this device).
If for some reason You need to program in C (and network capture gives expected results), libpcap may be usefull.
If evrything else fails, You can try to dicover unknown IP using fake ARP packets (so You don't need to change IP on eth0) and capturing any responses.

Finding all connected computers to network and getting their IP adresses - Windows C

just as title says.
Let's assume this situation:
I have a network and I need to know IP adresses and everything else related of all computers connected to mantain socket sending via Winsock under Windows.
Is there better way than looping throught IP Adresses range and sending something like:
"Are You there?" and waiting for answer from client?
Performing an ARP scan would tell you which devices are active on the network, regardless of device type or operating system. So this would include PCs, laptops, phones, routers, and any other devices with a NIC. This is the most reliable way of scanning for live hosts on a network.
ARP is the protocol that translates IP addresses into MAC addresses, or vice versa. It allows routing devices to translate between the logical network and the physical network. When you send a packet to, say, 192.168.1.99, your system first sends out an ARP request for 192.168.1.99, saying something along the lines of "Who has 192.168.1.99? Tell [my MAC]". Other devices on the network see this packet, and the owner of that IP address will reply "Hi [MAC], I'm 192.168.1.99, my MAC is 00:12:34:56:78:90".
You can (ab)use this protocol to discover network devices. If you know you're on 192.168.1.x, you send ARP requests for 192.168.1.1 through 192.168.1.254, and record the results. Every reply you get indicates a live system at the defined IP address.
Keep in mind that not all your users will be on 192.168.1.0/24, so you'll need to check the current network configuration first.
As far as doing this in C goes, it's not a simple task. However, you can take a look at this example which implements ARP scanning.
An alternative to the ARP scan suggested by #Polynomial is the PING scan.
Same concept, PING each address in your subnet, and record the results.
Just as an ARP scan may give you false positives (because there is a router saying "I'll deal what that address" whether there is a device on it or not), so too, PING can give you false negatives (as some systems disable the ICMP/PING command).
There is a tool called fping that implements this kind of PING scan in a massively parallel way. Fping is originally a *NIX program, but there are Windows versions out there. You should be able to find the source to peruse if you want to learn the gory details.

ARP reply packet does not update ARP cache on Ubuntu

So after I have played with the Network Spoofer developed by Digitalsquid (http://digitalsquid.co.uk/netspoof/), I have been trying to get a better understanding of its internal working by writing a c program that does something similar.
My program currently takes in 4 parameters - source ip, source mac, victim ip, and victim mac - and send an ARP reply packet with them. When testing the program on my home network, I would do something like setting the source ip to be the router's ip, source mac to be something bogus, victim ip to be my laptop's ip, and victim mac to be my laptop's wireless card mac.
The problem is, although I can see the packet being sent/received from monitoring the wireless card using tcpdump (ie. I would see something like "01:43:23.656745 ARP, Ethernet (len 6), IPv4 (len 4), Reply rouer-ip is-at bogus-mac-address, length 28", which is just what I expected), the ARP cache entry for the router stays the same (ie. still has the correct mac address).
I am not quite sure what the problem here is, and why I couldn't poison my ARP cache. I read somewhere that it could be my OS, Ubuntu 12.04, dropping the unsolicited ARP packets, so I tried to set /proc/sys/net/ipv4/conf/wlan0/arp_accept to 1 - no luck. I also tried to turn IP forwarding on (setting /proc/sys/net/ipv4/ip_forward to 1) as suggested by another article, and still had no luck.
I would really appreciate if somebody can give me some pointers/hints as to what the problem might be. Also, please correct me if I had a mistake in my understanding - I am quite new in the realm of c programming and ARP spoofing.
Thanks!
JY
Its good to take these arguments(source ip,source mac,target ip and target mac),but you are not giving correct values to it.
suppose A=the victim
and B=Gateway/Router/Switch in your network
ARP spoofing is actually convincing both A and B
You need to be more active in sending ARP request/reply to both A and B by giving your MAC address to be desired node.
So that whatever A/B sends will come to you first.
IP and MAC address fields are basically updated in CAT(content Addressable Memory) table of switch which keeps on updating time to time.
So when you are sending ARP Reuest to A(i.e Router/Gateway/Switch):-
Source IP=Victim's IP i.e A
Source MAc=your MAC(hackers MAC) so that data may come to your system
Destination IP=Rouer's IP
Detination MAC will be blank in case of ARP request

Resources