type
status
date
slug
summary
tags
category
icon
password
简介
Spring Security OAuth 是为 Spring 框架提供安全认证支持的一个模块。
漏洞原理
Spring Security OAuth使用whitelabel views 来处理错误时,response_type参数值会被当做Spring SpEL来执行,恶意攻击者通过构造response_type值可以触发远程代码执行漏洞
Spring Security OAuth2使用SpringMVC实现Web接口。该漏洞出现在授权接口 /oauth/authorize,该接口需要登录后才能访问。
代码流程
使用Whitelabel views来处理错误时,程序是通过oauthError.getSummary()来获取错误信息。
请求中的构建的response_type{ }值已经被带入了errorSummary中,然后errorSummary被装入model中,再用SpelView进行渲染。
pelView:
render.helper取{}中的值作为表达式,再用parser.parseExpression来执行
最后触发点replacePlaceholders函数将${xxx}字符串作为表达式执行.
修复
将Spring SpEL的前缀修改为随机字符串
文章来源:https://www.ngui.cc/el/765864.html?action=onClickhttps://blog.csdn.net/sycamorelg/article/details/125522105