GMs*_*soF 8 security cookies session spring spring-security
泛洪攻击: 简而言之,黑客可以不断攻击服务器(没有cookie)来强制Java容器继续创建新会话.
我正在使用Spring Security来管理会话.我意识到jsessionid在登录前不断创建,这不是我想要的.
所以我做了:
1)在Spring安全配置中:
sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER)
Run Code Online (Sandbox Code Playgroud)
2)在jsp中禁用会话创建.因为我使用的是apache tile,因为它使用的是动态include,所以我必须在所有jsp片段中禁用会话创建.这非常乏味.
<%@page session="false"%>
Run Code Online (Sandbox Code Playgroud)
乍一看,这很好,但有一个场景我仍然创建了会话.
让我们说在登录之前,我访问了一个只有在经过身份验证后才能访问的URL,Spring会将我重定向到登录页面.
在重定向之前,响应已经指示设置一个新cookie,即已创建的会话.
我的问题:
1)会话泛滥攻击是一个严重的问题吗?我应该真的照顾它吗?
2)有没有更好的方法来处理这个问题?任何最佳做法?
3)我的代码发生了什么?它实际应该工作,我怀疑cookie是由Spring创建的,虽然我已经设置了它SessionCreationPolicy.NEVER.我无法设置它Stateless,登录后我还需要会话.
我更关注会话攻击实际上与DDOS相比,我也在.maximumSessions(1)Spring中设置了防止多次登录.但上述问题在登录前发生.请帮忙.谢谢.
你的观点看起来很有道理,如果不处理的话可能会成为一个严重的问题。我发现这个主题已经有一个悬而未决的问题。但有一种解决方法可以控制这种行为。
public class ApiSecurityConfig extends WebSecurityConfigurerAdapter {
public HttpSessionRequestCache getHttpSessionRequestCache() {
HttpSessionRequestCache httpSessionRequestCache = new HttpSessionRequestCache();
httpSessionRequestCache.setCreateSessionAllowed(false);
return httpSessionRequestCache;
}
@Override
protected void configure(final HttpSecurity http) throws Exception {
http.requestCache().requestCache(getHttpSessionRequestCache());
}
Run Code Online (Sandbox Code Playgroud)
请参阅以下链接了解更多详细信息。
https://github.com/spring-projects/spring-security/issues/4242
| 归档时间: |
|
| 查看次数: |
575 次 |
| 最近记录: |