Spring Security OAuth RCE (CVE-2016-4977)

commit:https://github.com/spring-attic/spring-security-oauth/commit/fff77d3fea477b566bcacfbfc95f85821a2bdc2d

 

poc:http://localhost:8080/oauth/authorize?response_type=token&client_id=acme&redirect_uri=${new%20java.lang.ProcessBuilder(new%20java.lang.String(new%20byte[]{99,97,108,99})).start()}

 

通过poc可以看出,poc的目录在/oauth/authorize,可以通过requestmapping的值来找到该方法。

 

 

而在我们传入数据以后,还会经过一个/oauth/error目录,这个目录在WhitelabelErrorEndpoint类的handleError方法。该方法通过创建model,获取错误的值以后进入到OAuth2Exception的getSummary方法获取详细的错误信息后将其返回,使用视图解析和SpelView来渲染。等于说把我们传入的数据原封不动的返回了

 

 

来到SpelView类,该类的构造方法通过PropertyPlaceholderHelper来取${}里的值然后到replacePlaceholders方法里再取值,最后通过SpelExpressionParser类的parseExpression方法执行。

 

 

posted @ 2022-08-29 15:03  Cold灬  阅读(41)  评论(0编辑  收藏  举报