Sambacry
Last updated
Was this helpful?
Last updated
Was this helpful?
Samba in 4.5.9 version and before that is vulnerable to a remote code execution vulnerability named SambaCry. CVE-2017-7494 allows remote authenticated users to upload a shared library to a writable shared folder, and perform code execution attacks to take control of servers that host vulnerable Samba services. CVE-2007-2447 Script
Let’s write the script in Python3. We need to get pysmb library to authenticate with smb. The exploit script does not need anything more than a RPC Connect Request.
Write a simple POC:
Listen on tun0 with tcpdump and execute script.
We get a ping reply which confirms Arbitrary Code Execution. Replace payload with reverse shell. Generate Shellcode for payload with msfvenom.
Now replace the ping command in Python script with netcat reverse shell payload
Open netcat listener on port 2222 and execute script.
And finally we have the Root Shell!! Lame! :)