gpt4 book ai didi

java - 防止 java 中的 session 固定

转载 作者:行者123 更新时间:2023-12-04 20:46:17 25 4
gpt4 key购买 nike

我有一个用 java 编写的 Web 应用程序。我们不在身份验证过程中使用 session 。运行了应用程序扫描,发现我们有可能受到 session 固定攻击。我想知道当我们不使用 session 时,您如何修复或防止 session 固定? FORTIFY 扫描报告是这样说的

The following changes were applied to the original request:
• Added parameter 'Cookie_abcxyz.com-443' with the following value 'R3777273810'
• Removed cookie 'Cookie_abcxyz.com-443'

Request/Response:
GET / HTTP/1.1
Content-Length: 43
Accept: */*
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: myportal.abcxyz.com
Cookie_abcxyz.com-443=R3777273810
HTTP/1.1 200 OK
Set-Cookie: Cookie_abcxyz.com-443=R3777273810; path=/
Content-Length: 11211
Date: Mon, 13 Feb 2012 17:08:14 GMT
Server: abcxyz
Cache-Control: no-cache
Content-type: text/html

最佳答案

We don't use sessions in authentication process.... I am wondering when we are not using session

这无关紧要。我假设您对服务器使用 session 管理。此错误报告表明您没有验证 session 标识符的查询字符串。
在此处查看有关如何受到攻击的一些示例:Session Fixation

更新:
我怀疑你没有使用标准容器。我不能告诉你你实际应该做什么,因为你没有输入任何代码,但从你的描述和你得到这样一个发现问题的报告的事实是您允许重写 URL,攻击者可以使用它通过传入已知 session ID 来“窃取” session 。
从广义上讲,您应该做的是在用户登录后使当前 session 无效并当场创建一个新 session 。因此,已经“被盗”的 ID 不能再使用。

由于您在帖子中提供的信息太少,您应该花一些时间研究以下内容,以确定您的代码中有问题的部分:
OWASP 1
OWASP 2
OWASP 3
Java Secure session SO
ASP as well
Interesting paper on session fixation
Some HTTP utilities from OWASP that you could perhaps use
Session fixation in Java
Secure Session Management

关于java - 防止 java 中的 session 固定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9569915/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com