Skip to content

[Bug] UDP requests mapping from tun0 to eth0 #262

Description

@engageub

Verify steps

  • Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
  • I have searched on the issue tracker for a related issue.

Version

Docker latest version

What OS are you seeing the problem on?

Linux

Description

A script has been created which uses tun2socks containers to redirect the proxy requests Internet Income.
The DNS requests are bypassed through port 53 of UDP for the applications to work. Most of the applications require only UDP for DNS queries but Mysterium unlike others requires UDP to establish connections and send data for monitoring.
The problem here is that the application uses the same network interfaces are tun2socks container . So the default interface is eth0 and the IP address is assigned from that interface to Mysterium application.
TCP requests work fine. But UDP requests are not being validated correctly by the application.
A Dante socks5 server was created which serves with both UDP and TCP. Running the commands through terminal works fine with UDP but not through mysterium application. It seems to be validating the destination IP address or the protocol itself.
There are no errors or warnings in Tun2socks container for UDP since the requests are successfully going to the remote server.
To understand further ubuntu container was created over tun2socks network. tcpdump and tshark were installed to capture and analyse the packets going through this container.

This command was run and traffic was captured through tun0 and eth0 interfaces.

nslookup google.com 1.1.1.1

With proxy UDP eth0 interface

 1   0.000000  172.17.0.13 ? 194.113.194.54 UDP 80 38556 ? 1199 Len=38
 2   0.381092 194.113.194.54 ? 172.17.0.13  UDP 96 1199 ? 38556 Len=54
 3   2.291440  172.17.0.13 ? 194.113.194.54 UDP 80 37672 ? 28168 Len=38
 4   2.605092 194.113.194.54 ? 172.17.0.13  UDP 108 28168 ? 37672 Len=66

With proxy UDP tun0 interface

    1   0.000000   198.18.0.1 ? 1.1.1.1      DNS 56 Standard query 0x0d43 A google.com
    2   2.201513      1.1.1.1 ? 198.18.0.1   DNS 72 Standard query response 0x0d43 A google.com A 142.251.32.110
    3   2.205195   198.18.0.1 ? 1.1.1.1      DNS 56 Standard query 0x4530 AAAA google.com
    4   4.402915      1.1.1.1 ? 198.18.0.1   DNS 84 Standard query response 0x4530 AAAA google.com AAAA 2607:f8b0:4006:81d::200e

Without proxy eth0 interface (bypassed port 53)

   1   0.000000  172.17.0.13 ? 1.1.1.1      DNS 70 Standard query 0x06b3 A google.com
    2   0.001929      1.1.1.1 ? 172.17.0.13  DNS 86 Standard query response 0x06b3 A google.com A 142.250.67.78
    3   0.002173  172.17.0.13 ? 1.1.1.1      DNS 70 Standard query 0x365c AAAA google.com
    4   0.004239      1.1.1.1 ? 172.17.0.13  DNS 98 Standard query response 0x365c AAAA google.com AAAA 2404:6800:4007:810::200e

Without proxy tun0 interface
No packets were present since the firewall was bypassed in this case.

With respect to the above outputs the DNS queries were successful in Mysterium application only when firewall is bypassed for port 53. So, it seems to be validating the destination IP address or protocol or something else.
If you look at the destination address for eth0 with and without proxy they are different.
The first one which uses proxy to redirect is using the IP address of the socks5 proxy whereas the bypassed port shows 1.1.1.1
Usually if the default network is eth0, the request first goes to this interface before going to the other interfaces outside this.
If a connection has to be done through socks5 proxy with a request it should be like this
Source Address-->Destination Address-->Socks5 Proxy-->Internet

But the eth0 interface which is default interface shows the following
Source Address-->Socks5Proxy
Socks5Proxy-->Source Address

In addition to the above the requests are being shown as UDP instead of DNS for eth0 interface through proxy.

The tun0 interface shows the destination IP address for 1.1.1.1 which is similar to the eth0 without proxy.

Is it possible to change the default interface to tun0 interface since it shows the correct destination similar to eth0 without proxy or is it possible to clone an interface to achieve this.
The requests are being invalidated when using UDP over eth0 interface by the application which the application shows as timeout since it did not receive the packet it was expecting.

CLI or Config

No response

Logs

No response

How to Reproduce

  1. Visit https://github.com/engageub/InternetIncome
  2. Download the script and install as mentioned
  3. Create Dante Socks5 server or any other server which supports UDP
  4. Enable logs in the properties.conf file to see the errors in the application logs
  5. Note that port 53 is bypassed by default in the code.
  6. You may comment and uncomment to see the difference why the application fails to connect over DNS queries over proxy.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions