SOCKS5

  • In this section, you are going to learn

    • SOCKS5

  • Terminology

#

Version

Ubuntu

Ubuntu 22.04 64 bit

Linux Kernel

6.5.0

  • High Level Protocol Setup

  • Experimental Setup

  • Application

  • Libraries

  • To find the IP address of your Ubuntu machine,use the ifconfig command.

  • From the output of ifconfig command,for example, 10.91.239.13 is used as the Proxy Server IP.

  • This Proxy server IP is used when connecting SOCKS5 PROXY server to a client.

  • Step-1 : Install dante Server on Ubuntu

    test:~$ pwd
    /home/test
    
    test:~$ sudo apt update
    
    test:~$ sudo apt install dante-server
    
  • Step-2 : Edit the Squid Configuration file

    test:~$ sudo nano /etc/danted.conf
    
    logoutput: stderr
    internal: 10.91.239.13 port = 1080
    external: 10.91.239.13
    
    socksmethods: username
    
    user.priviledged: root
    user.unpriviledged: nobody
    
    client pass {
      from: 0.0.0.0/0 to: 0.0.0.0/0
      log: connect disconnect
      }
    
    socks pass {
      from: 0.0.0.0/0 to: 0.0.0.0/0
      log: connect disconnect
      }
    
  • NOTE : 10.91.239.13 is your ubuntu machine IP address from “ifconfig” output

  • NOTE : Comment all the lines in file the above prompt only to save.

  • Step-3 : Add user who can access proxy server

    test:~$ sudo adduser <username>
    
  • ENTER password when prompted.

  • Step-4 : start the danted proxy server

    test:~$ sudo systemctl restart danted
    test:~$ sudo systemctl enable danted
    test:~$ sudo systemctl status danted
    
  • Step-5 : check if server is running

    test:~$ ps -elf | grep -i danted
    
  • NOTE : If server is not running,check logs at “sudo journalctl -u danted” and fix the errors.

  • Step-6 : Allow connection from port 1080 //socks5 port

    test:~$ sudo ufw allow 1080
    
  • Step-7 : To check the listening on port

    test:~$ sudo netstat -tuln | grep 1080
    
    tcp        0      0 0.0.0.0:1080          0.0.0.0:*               LISTEN
    tcp6       0      0 :::1080                :::*                   LISTEN
    
  • Step-1 : Using Curl

    test:~$ curl --proxy socks5://10.91.239.13:1080 --proxy-user rev:p@ssw0rd https://example.com
    
    • Expected output:The HTML source code of the webpage hosted at http://example.com

    • NOTE: 10.91.239.13 is the Proxy Server IP address referenced in the “Setup SOCKS5 Proxy Server on Ubuntu” section above.

    • NOTE : “rev” is username and “p@ssw0rd” is password.

  • Step-2 : Using wget

    test:~$ wget -execute="http_proxy=socks5://rev:p@ssw0rd@10.91.239.13:1080" https://example.com
    
    • Expected output:The HTML content of the webpage at https://example.com

    • NOTE: 10.91.239.13 is the Proxy Server IP address referenced in the “Setup SOCKS5 Proxy Server on Ubuntu” section above.

    • NOTE : “rev” is username and “p@ssw0rd” is password.

  • Step-3 : Using Telnet

    test:~$ telnet 10.91.239.13 1080
    Trying 10.91.239.13...
    Connected to 10.91.239.13.
    Escape Character is '^]'.
    
    • If the connection fails,the output will be something like connection refused or unable to connect.

    • NOTE: 10.91.239.13 is the Proxy Server IP address referenced in the “Setup SOCKS5 Proxy Server on Ubuntu” section above.

  • Step-4 : Using firefox

    1.Open firefox preferences.
    • Open firefox on your machine.

    • In the top-right corner,click on the three horizontal lines(the hamburger menu).

    • Click on settings.

    2.Access Proxy settings
    • Scroll down to the Network Settings Section.

    • Click the settings button next to Network Settings.

    3.Configure the Proxy
    • A new window will appear with various options to configure the Proxy settings.

    • Select Manual Proxy Configuration.

    • SOCKS5 Proxy: Enter the IP address of your proxy server (e.g., 10.91.239.13).

    • Port: Enter the Port number (e.g., 1080).

    • Click OK.

    • Then restart the firefox.

    4.If authentication is there,then however firefox doesnot have a built-in SOCKS5 authentication option.

    • so,you need to use a browser extension (like foxypoxy) that supports socks5 proxy authentication.

      • Steps to install and configure foxypoxy in firefox.

        • open firefox and go to the foxypoxy standard extension page and click on add to firefox button.

        • once installed,you will see the foxypoxy icon appear in firefox toolbar.

      • Click on the foxypoxy icon in the toolbar(the Foxyproxy logo)

        • select options to open Foxyproxy settings and add a new proxy,in the Foxyproxy options tab,click on add the new Foxyproxy button.

        • Enter Proxy settings

          • Proxy type : SOCKS5

          • Proxy IP : 10.91.239.13.

          • Port : 1080

          • Username : rev

          • Password : p@ssw0rd

        • After filling the details,click OK to save the Proxy settings.

        • Then restart the firefox.

    5.Then search on firefox,it loads the webpages in browser.

    6.Check on terminal also.

    test:~$ firefox http://www.example.com
    
    • It load the webpage in browser.

  • Step-5 : Using Chrome

    1.Open chrome on your machine.
    • In the top-right corner,click on the three dots.

    • click on settings.

    2.Scroll down to the system in that click on open your computer proxy settings.

    3.In that proxy tab to click the NetworkProxy ON and below the configuration select manual option.

    4.And enter Proxy server’s IP address and port number in the SOCKS5 host.

    5.After that open the chrome and search http://google.com or https://google.com.

    6.If the Proxy is setup correctly,it loads the webpages.

  • Step-6 : Using netcat

    test:~$ nc -zv 10.91.239.13 1080
    Connection to 10.91.239.13 1080 port [tcp/socks] succeeded!
    
  • NOTE: 10.91.239.13 is the Proxy Server IP address referenced in the “Setup SOCKS5 Proxy Server on Ubuntu” section above.

  • Step-7 : Using ping

    test:~$ ping 10.91.239.13
    PING 10.91.239.13 (10.91.239.13 56(84) bytes of data.
    64 bytes from 10.91.239.13: icmp_seq=1 ttl=64 time=0.092 ms
    64 bytes from 10.91.239.13: icmp_seq=2 ttl=64 time=0.036 ms
    64 bytes from 10.91.239.13: icmp_seq=3 ttl=64 time=0.094 ms
    64 bytes from 10.91.239.13: icmp_seq=4 ttl=64 time=0.105 ms
    64 bytes from 10.91.239.13: icmp_seq=5 ttl=64 time=0.094 ms
    
  • NOTE: 10.91.239.13 is the Proxy Server IP address referenced in the “Setup SOCKS5 Proxy Server on Ubuntu” section above.

  • Frame Sequence

  • Wireshark Capture

  • packet 1

  • packet 2

  • FAQs

  • Reference links