خرید بک لینک

Hello,

I found a neat vm containing ubuntu 12.04 called CERT Tapioca for network checks using the man in the middle technique. My goal is to route traffic of an android device through it.
It is set up to have an inteet coection through NAT on eth0, which is working as intended.
Another device eth1 is set up for incoming coections. (It's bridged to a wireless access point/hostednetwork on a Windows 7 host.)
Here's the configuration

Code:

auto eth1
iface eth1 inet static
address 192.168.56.1
netmask 255.255.255.0
I've also set up a dhcp for that device which is working as intended.

Code:

option domain-name "mitm.proxy";
option domain-name-servers 192.168.56.1;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.56.0 netmask 255.255.255.0 {
  option broadcast-address 192.168.56.255;
  option routers 192.168.56.1;
  range 192.168.56.100 192.168.56.200;
  }
Now here's the part that isn't working: Through iptables I should be able to forward all kinds of packets from eth1 to eth0. Looking at the interfaces with wireshark shows me that there's plenty of dns requests on eth1 but none of them are forwarded to eth0 or answered.
For the sake of simplicity I'll just post the direct routing rules without mitmproxy in the middle.

Code:

# Flush rules
iptables -F
iptables -t nat -F PREROUTING
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.56.0/24 -j MASQUERADE
iptables -A FORWARD -o eth0 -i eth1 -s 192.168.56.0/24 -m cotrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -m cotrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
As can be seen by the output of iptables -nvL there are no packets forwarded. It detects INPUT and OUTPUT packages, though.

Code:

fuzz@ubufuzz:~$ sudo iptables -nvL
Chain INPUT (policy ACCEPT 13 packets, 2834 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  eth1   eth0    192.168.56.0/24      0.0.0.0/0            ctstate NEW
    0     0 ACCEPT     all  --  eth0   eth1    0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  eth1   eth0    0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 7 packets, 2372 bytes)
 pkts bytes target     prot opt in     out     source               destination

Code:

fuzz@ubufuzz:~$ sudo iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT 5 packets, 1148 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 5 packets, 1148 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 3 packets, 988 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 3 packets, 988 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MASQUERADE  all  --  *      eth0    0.0.0.0/0            0.0.0.0/0
net.ipv4.ip_forward=1 in /etc/sysctl.conf is set.

Does anybody have an idea why this isn't working?

برچسب: نویسنده: استخدام کار تاريخ: جمعه 7 خرداد 1395 ساعت: 16:16

صفحه بندی