重命名 ASP.NET 会话 Cookie 名称的原因?
是否有任何原因(安全?)为什么有人应该重命名 ASP.NET 会话 Cookie 名称,或者这只是 ASP.NET 的一个毫无意义的选项?
is there any reason (safety?) why someone should rename the ASP.NET Session Cookie Name or is it just a senseless option of ASP.NET?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果您有多个应用程序在同一台服务器上的同一域下运行,您可能希望每个应用程序都有单独的会话 cookie 名称,这样它们就不会共享相同的会话状态,或者更糟的是仍然会相互覆盖。
另请参阅 Forms Auth cookie 名称:
If you have several applications running under the same domain on the same server, you may well want to have seperate session cookie names for each one, so that they aren't sharing the same session state or worse still overwriting each other.
See also the notes for the Forms Auth cookie name:
1)它可能(稍微)减慢正在(随意)寻找它的人的速度。
2) 您可能想隐藏您正在运行 ASP.NET 的事实
1) It might (slightly) slow someone down who is (casually) looking for it.
2) You might want to hide the fact that you are running ASP.NET
以下链接提供了有关为何应重命名会话 cookie 的更多信息。
https://www.owasp.org/index.php/Session_Management_Cheat_Sheet
"使用的名称会话 ID 不应具有过多的描述性,也不应提供有关 ID 的用途和含义的不必要的详细信息
最常见的 Web 应用程序开发框架使用的会话 ID 名称可以轻松识别 [0],例如 PHPSESSID (PHP), JSESSIONID (J2EE)、CFID & CFTOKEN (ColdFusion)、ASP.NET_SessionId (ASP .NET) 等。因此,会话 ID 名称可能会泄露 Web 应用程序使用的技术和编程语言,
建议更改默认值 。 Web 开发框架的会话 ID 名称改为通用名称,例如“id”。”
Below link provides more information about why session cookies should be renamed.
https://www.owasp.org/index.php/Session_Management_Cheat_Sheet
"The name used by the session ID should not be extremely descriptive nor offer unnecessary details about the purpose and meaning of the ID.
The session ID names used by the most common web application development frameworks can be easily fingerprinted [0], such as PHPSESSID (PHP), JSESSIONID (J2EE), CFID & CFTOKEN (ColdFusion), ASP.NET_SessionId (ASP .NET), etc. Therefore, the session ID name can disclose the technologies and programming languages used by the web application.
It is recommended to change the default session ID name of the web development framework to a generic name, such as “id”."
使用 Cookie 前缀,您可以向 Cookie 添加安全属性通过特殊的方式命名。 因此,在这种情况下,重命名 ASP.NET 会话 cookie 确实会对安全性产生影响:
__Secure-...
cookie 只能从安全 (HTTPS) 站点写入。__Host-...
cookie 只能从同一安全域写入。 因此不是来自子域或不安全 (HTTP) 站点。With cookie prefixes, you can add a security attribute to your cookie by naming it a special way. So in that case renaming your ASP.NET session cookie does have an impact on security:
__Secure-…
cookies can only be written from secure (HTTPS) sites.__Host-…
cookies can only be written from the same, secure domain. So not from subdomains or insecure (HTTP) sites.根据以下规范,https://datatracker. ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00,现代浏览器实现的,前缀用于使事情更安全。
According to the following specification, https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00, that modern browsers implement, the prefixes are used to make things more secure.
我认为这主要是品味问题。 有些人/公司希望控制其网络应用程序的各个方面,并且可能只是使用另一个名称来与其他 cookie 名称保持一致。 例如,如果您在整个应用程序中使用非常短的单字符参数名称,您可能不喜欢像 ASPSESSID 这样的会话 cookie 名称。
安全原因可能适用,但在我看来,通过模糊实现安全性相当薄弱。
I think its mainly a matter of taste. Some people/companies want control every aspect of their web apps and might just use another name for consistency with other cookie names. For example, if you use very short one-character parameter names throughout your app you might not like session cookie names like ASPSESSID.
Security reasons might apply but security through obscurity is rather weak in my opinion.