惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

O
OpenAI News
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
The Hacker News
The Hacker News
罗磊的独立博客
L
LINUX DO - 热门话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Attack and Defense Labs
Attack and Defense Labs
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
博客园 - 聂微东
The Last Watchdog
The Last Watchdog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Latest news
Latest news
美团技术团队
Hacker News: Ask HN
Hacker News: Ask HN
J
Java Code Geeks
V
Visual Studio Blog
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 【当耐特】
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security
L
Lohrmann on Cybersecurity
Security Archives - TechRepublic
Security Archives - TechRepublic
S
Security Affairs
T
Threatpost
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
博客园 - 三生石上(FineUI控件)
V
V2EX
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Jina AI
Jina AI
雷峰网
雷峰网
Know Your Adversary
Know Your Adversary
有赞技术团队
有赞技术团队
V2EX - 技术
V2EX - 技术
Scott Helme
Scott Helme
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
H
Hacker News: Front Page
月光博客
月光博客
小众软件
小众软件

博客园 - floerggyy

vs下调试多个c项目联调 C语言locale介绍 C语言宏定义总结 原码、反码、补码 Endian的由来及big-edian 和little-endian 转载 zip文件格式 C 语言 相关资源 精选 zlib usage 一段垃圾的代码(附malloc,calloc和realloc使用小结) Stdcall and DLL tools of MSVC and MinGW 转载 关于gcc的dlltool和dllwrap工具 技术转载(鼠标点击X窗口关闭IE的同时清空session,最基本的就是处理用户重复登陆需要用到,我想这个的关键在于如何捕捉到关闭IE这个动作,之后再根据自身的需要使用session.invalidate()或者session.removeAttribute( "xxx ")) dotnet oracle摘自msdn 被遗忘了的生日 这处站点真NB!! 数学表达式逻辑表达式混合计算 Are you a vender or manager? hotmail 附件上传何以如此霸道
did you fix these bugs
floerggyy · 2005-10-09 · via 博客园 - floerggyy

Section A: E

Section A: Existing design/functionality

xisting Functionality

1. Security Issue: If a user clicks on a particular URL to any XXX site and then logs on, then any subsequent clicks on the same URL will open additional IE windows and automatically log on using the former user/password. The only way I have seen to inhibit this behavior is to open a dummy instance of IE (which will load whatever default home page the user has set) and then execute the URL again. This seems to break the IE session sequence.

Suppose I send you an email with XXX web site URL, You click the URL and login the system. The second time click will automatically login the system.

Please fix this problem.

上文是我几个月前收到的一封Mail中的一个小片段。(略去了其中的敏感信息)

测试发现在普通网页中含有超链接类似于http://localhot/yourAppSite/default.aspx

或在word2003 文档(其它版本的word我没有测试,估计也可能存在这个安全缺陷)均存在上述问题。编写HttpModule跟踪截获Request后发现,这两种安全缺陷居然在Request的次数不同。不过可以肯定的是这两种Request中都带有认证标识Cookie。那就禁用cookie吧,如何禁用?如果你不太了解asp.net安全机制的话,建议仔细阅读MSDN ^_^

web.config文件中有如下元素,如图

cookieless.JPG
不但要知道如何修正错误最好还能知道为什么这样修正错误。我们先来粗略地看看为什么
cookieles设为true后就cookie可以被禁用了。良好的代码阅读能力是必备。查看下

SessionModule.JPG
System.Web.SessionState.SessionStateModule的实现,在它的init方法中有如下代码。如图

再看看System.Web.SessionState.SessionStateSectionHandler.Config的实现

sessionConfig.JPG

.

这下就明白为什么这样改了吧?:)

Fix了这个安全缺陷后请仔细全面地测试下(三年养成一个好习惯J),你会发现有通过上述非正常方式登陆两次,同时打开两个界面,当一个logout后另一个再logout可能会有些小的毛病(UI显示问题)通过简单的加几句JS就可以修正了。具体要根据各自项目的界面风格之类的而论,这里我就不详述了(加几句JS很简单J

很好,我已经通过了第一关,可惜我无意中犯了大忌。因为我在fix这个安全缺陷的时候可能会导致另一个重大隐患的产生。这个隐患出现在一个月前的另外一个项目中。

为什么我的会话状态偶尔会丢失?

症状:为什么有时登录成功后又自动退出重新登录?为什么有时进行页面间跳转时会自动退出重新登录?我的会话状态为什么时而有效时而无效?

前一个月我有将近20天的时间一直被这个问题所困惑,检查过所写的每一行代码若干次。无论是cache类还是context类我都检查的几乎要把它们吞掉!得到的结论是――我的代码没有问题!OS的问题?Framework的问题?我开始怀疑MicrosoftMSDN上、在ASP.NET上,均找到了导致这个问题的原因。

先看看MSDN上的描述吧

The drawback of using cookieless sessions is that the session state is lost if an absolute URL is invoked. When cookies are used, you can clear the address bar, go to another application, and then return to the previous one and retrieve the same session values. If you do this when session cookies are disabled, the session data is lost. For example, the following code breaks the session:

<a runat="server" href="/code/page.aspx">Click</a>

If you need to use absolute URLs, resort to a little trick and manually add the session ID to the URL. You use the ApplyAppPathModifier method on the HttpResponse class.

<a runat="server" 
    href=<% =Response.ApplyAppPathModifier("/code/page.aspx")%> >Click</a>

The ApplyAppPathModifier method takes a string representing a URL and returns an absolute URL, which embeds session information.

看来我的结论是半对J,我的代码有问题,应用cookieless也有缺陷