Server Name Indication (SNI) is an extension to the Transport Layer Security (TLS) computer networking protocol by which a client indicates which hostname it is attempting to connect to at the start of the handshaking process.This allows a server to present one of multiple possible certificates on the same IP address and TCP port number and hence allows multiple secure (HTTPS) websites (or any other service over TLS) to be served by the same IP address without requiring all those sites to use the same certificate Read more
SNI bug hosts can be in various forms. They can be a packet host, a free CDN host, government portals, zero-rated websites, social media (subscription), and a variety of other sites. They also do a fantastic job of getting over your Internet service provider's firewall.
If you have a subscription to zoom.us
and want to visit Zoom, your ISP's firewall will scan every time your SSL handshake to determine if the SNI is "zoom.us", and if it does, the firewall will enable you to keep that connection free fo charge. When you have a subscription to access internet, this is what happens.
What if we can modify our SNI and gain access to different sites? Yes! we can. However, SNI verification will fail, and the connection will be terminated by host. But we still can use our own TLS connection(with changed SNI) and use a proxy through it access the internet.
-
Open Ports :
- Ensure that ports
22
and443
are open on your server.
- Ensure that ports
-
Install
stunnel
:sudo apt-get install stunnel4 -y
-
Create
stunnel.conf
File- Navigate to the
/etc/stunnel
directory and create thestunnel.conf
file :sudo nano /etc/stunnel/stunnel.conf
- Navigate to the
-
Edit
stunnel.conf
- Add the following configuration to
stunnel.conf
:client = no [stunnel] accept = 443 connect = 127.0.0.1:22 cert = /etc/stunnel/stunnel.pem
- Add the following configuration to
-
Create SSL Certificates :
- Generate an SSL certificate file (
stunnel.pem
) and place it in the/etc/stunnel
directory.openssl genrsa -out key.pem 2048 openssl req -new -x509 -key key.pem -out cert.pem -days 1095 cat key.pem cert.pem >> /etc/stunnel/stunnel.pem
- Generate an SSL certificate file (
-
Restart
stunnel
:/etc/init.d/stunnel4 restart
-
Clone the repository :
git clone https://github.com/kirula0626/sni-injector.git
-
Add your SNI host and ssh host to
settings.ini
:[ssh] #Host must be your Server Public IP address #example host = 10.29.22.33 host = [SERVER_PUBLIC_IP] [sni] #example server_name = facebook.com server_name = <SNI>
-
Install the Requirements :
- To Requirements need
python
andpip
pip install -r requirements.txt
- To Requirements need
-
Edit the
ssh_tunnel.sh
Script :- Auto login and manual login. Uncomment wanted method.
#-Auto login with password #sshpass -p [SERVER_SSH_PASSWORD] ssh -C -o "ProxyCommand=nc -X CONNECT -x 127.0.0.1:9092 %h %p" [SERVER_USERNAME]@[SERVER_PUBLIC_IP] -p 443 -v -CND 1080 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null #-Manual login #ssh -C -o "ProxyCommand=nc -X CONNECT -x 127.0.0.1:9092 %h %p" [SERVER_USERNAME]@[SERVER_PUBLIC_IP] -p 443 -CND 1080 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
- For Auto login need
sshpass
tool :apt-get install sshpass
- Auto login and manual login. Uncomment wanted method.
-
Run
ssh_tunnel.sh
script -
Install
Proxychains
:apt-get install proxychains4
- Edit
proxychains
conf file :sudo nano /etc/proxychains4.conf
- At the end, add this line :
socks5 127.0.0.1 1080
- Edit
-
Check
Proxychains
:proxychains4 curl ifconfig.me
- output must be Public Server IP
-
Use :
- Active proxy on Browser : Add SOCKS Host :
127.0.0.1
Port :1080
and SelectSOCKSv5
or
- Open using
proxychains4
:
proxychains4 firefox
- Active proxy on Browser : Add SOCKS Host :
-
Clone the repository :
git clone https://github.com/kirula0626/sni-injector.git
-
Add your SNI host and ssh host to
settings.ini
:[ssh] #Host must be your Server Public IP address #example host = 10.29.22.33 host = [SERVER_PUBLIC_IP] [sni] #example server_name = facebook.com server_name = <SNI>
-
Install the Requirements :
- To Requirements need
python
andpip
pip install -r requirements.txt
- To Requirements need
-
Install
Nmap
:- Windows don't have
nc
.Nmap
providesncat
- Nmap : Windows Download Page
- Windows don't have
-
Auto / Manual Method :
- Manual Method
- Run `socks5_tunnel.py' file :
python socks5_tennel.py
- Run
ssh
:- Windows don't have
sshpass
. Manual Method usingssh
. To establish connection type[SERVER_SSH_PASSWORD]
ssh -C -o "ProxyCommand=ncat --verbose --proxy 127.0.0.1:9092 %h %p" [SERVER_USERNAME]@[SERVER_PUBLIC_IP] -p 443 -CND 1080 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
- Windows don't have
- Run `socks5_tunnel.py' file :
- Automation Method :
- Create ssh key-pair.
- Create client side ssh key-pair.
ssh-keygen -t rsa
- Copy to rsa public key to serve's authorized_keys
scp C:\Users\[CLIENT_USER]\.ssh\id_rsa.pub [SERVER_USERNAME]@[SERVER_PUBLIC_IP]:/home/[SERVER_USER]/.ssh/authorized_keys
- New user must enter
[SERVER_USERNAME]
and[SERVER_PUBLIC_IP]
to prompt. It will save for future logins.ssh_tunnel.exe
- Manual Method
6.Use :
- Active proxy on Browser (
firefox
) : Add SOCKS Host :127.0.0.1
Port :1080
and SelectSOCKSv5
or - Add socks5 to Windows
Control Panel --> Network and Internet --> Internet Options --> Connection Tab
Lan Settings --> Inside Proxy Server Tik the radio box --> Advanced
socks : 127.0.0.1 : 1080 --> Ok
Tip : If you not using proxy make sure to untikInside Proxy Server radio box