I'm trying to confirm an issue I'm experiencing with a host-only (vboxnet0) networking setup. This particular setup is required for a malware analysis tool which automatically configures iptables on the host to allow either VM traffic to go out to the internet or be fully redirected from one VM to another (by rewriting packets) depending on what type of network access the user would like to use as part of the malware analysis.
However, the redirect option appears to be causing issues with host-only networking. tcpdump on the Ubuntu host shows that packets are in fact being rewritten with the selected VM as the new destination. But these rewritten packets never arrive at that VM. I've tried to simplify the setup for debugging purposes by only redirecting DNS requests, normally sent by the Windows VM to 8.8.8.8, to 192.168.56.10 instead.
Setup details are as follows:
- - Ubuntu 16.04 LTS host running virtualbox (version 5.2.6 r120293) with vboxnet0 NIC (192.168.56.1)
- WinXP VM with host-only networking configured (192.168.56.101, default DNS configured as 8.8.8.8 )
- Linux VM with host-only networking configured and running fake inetsim DNS service (192.168.56.10)
IP forwarding is enabled on the Ubuntu host and the following iptables rules are added on the host in order to redirect any DNS requests to the Linux VM (192.168.56.10):
Code: Select all
iptables -t nat -A PREROUTING -p tcp --dport 53 --source 192.168.56.101 -j DNAT --to-destination 192.168.56.10:53
iptables -t nat -A PREROUTING -p udp --dport 53 --source 192.168.56.101 -j DNAT --to-destination 192.168.56.10:53
iptables -A FORWARD -i vboxnet0 -o vboxnet0 --source 192.168.56.101 -j ACCEPT
iptables -A FORWARD -i vboxnet0 -o vboxnet0 --destination 192.168.56.101 -j ACCEPT
Code: Select all
root@cuckoo:/home/cuckoo# tcpdump -nn -i vboxnet0 port 53
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vboxnet0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:53:31.795652 IP 192.168.56.101.1080 > 8.8.8.8.53: 1+ PTR? 8.8.8.8.in-addr.arpa. (38)
11:53:31.795709 IP 192.168.56.101.1080 > 192.168.56.10.53: 1+ PTR? 8.8.8.8.in-addr.arpa. (38)
11:53:33.811505 IP 192.168.56.101.1081 > 8.8.8.8.53: 2+ A? google.com. (28)
11:53:33.811592 IP 192.168.56.101.1081 > 192.168.56.10.53: 2+ A? google.com. (28)
11:53:35.814645 IP 192.168.56.101.1082 > 8.8.8.8.53: 3+ A? google.com. (28)
11:53:35.814743 IP 192.168.56.101.1082 > 192.168.56.10.53: 3+ A? google.com. (28)The submitter of a similar issue posted at https://serverfault.com/questions/66463 ... ostrouting mentions "the problem was in the way VirtualBox emulates the interface and/or network stack, so no amount of flailing on iptables was helping." but does not provide any specific details. So I'm hoping someone from the VirtualBox community might be able to shed some light on this issue and confirm that what I'm trying to accomplish is not possible with host-only networking.
Update: When I set the network card in the Linux VM to promiscuous mode it only captures the original DNS requests from the Windows XP VM to 8.8.8.8 and still not the redirected packets. Please ignore the timestamp differences in the screenshots as the Ubuntu host and Linux VM are configured with a different timezone.
Ubuntu host tcpdump (original DNS requests + redirected requests): Linux VM tcpdump (promiscuous mode lets us capture the original DNS request leaving the Windows XP VM. But even now we're not able to capture the redirected requests):