会话没有过期?
也许我的问题很愚蠢,但它让我发疯,你看我有这个应用程序,即使我使用了 Session.Abandon()、Session.Clear() 和 Session.Removeall(),它的会话在注销后也不会过期。我一直在互联网上搜索,但到目前为止没有运气,我真的希望能得到一些帮助。假设我有用户 X,如果我执行以下操作,任何人都可以使用 X 的帐户登录:
1- 使用 X 的用户名和密码登录。 2-获取会话“.ASPXFORMSAUTH”信息。 3-从X的帐户注销 4- 例如,使用 firefox“添加 cookie 功能”添加会话“.ASPXFORMSAUTH”及其值。 5-输入 URL 并单击 Enter 页面刚刚打开,它真的让我抓狂!
提前致谢
Probably my question is stupid but it is driving me crazy, you see I have this application its session is not expiring after logging out even though I have used Session.Abandon(), Session.Clear(), and Session.Removeall(). I have been searching all over the internet but no luck so far and I really wish I can get some help. Say I have user X if I do the following any one can login with X's account:
1- Login with X's username and password.
2- Take Session ".ASPXFORMSAUTH" info.
3- Logout from X's account
4- Add the Session ".ASPXFORMSAUTH" with its value using fire fox "add cookie function" for example.
5- type the URL and click enter
the page just opens up and it is really driving me CRAZY!!
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还需要调用 FormsAuthentication.SignOut()
You also need to call FormsAuthentication.SignOut()
在这种情况下,会话中有一个附加标志(例如“ACTive”),可以在注销期间将其设置为 false。基于此,您可以将用户重定向到登录或您想要的任何其他常规页面。
我不确定是否有定义的方法来处理这个问题,但我会做我所说的事情。
用户已经使用 FormsAuthentication.Signout() 注销的场景,并尝试使用相同的 cookie(他以某种方式访问了它)来攻击系统以访问网站的经过身份验证的部分。
在这种情况下,微软的建议还建议使用持久性机制来记录/跟踪用户注销,并在后续的虚假请求中使用该信息将其重定向到登录页面(并再次清除 cookie)。
参考:阅读中的第 3 点备注部分
In this case, you have an additional flag in Session (like "ACtive") which can be set to false during logout. Based on this, you can rediect the user to login or any other general page you want to..
I am not sure if there is defined way to handle this, but I would do something like I said.
Scenario where the user is already logged out by using FormsAuthentication.Signout() and is trying to hack the system by using the same cookie (he somehow got access to it) to access a authenticated part of the website.
In such a scenario recommendations from Microsoft also suggests to use a persistence mechanism to log / track the user signout and use the information to redirect him to login page (and clear cookie again) in subsequent fake requests.
Reference: Read bulleted point 3 in Remarks section