11

是否有任何理由(安全性?)为什么有人应该重命名ASP.NET 会话 Cookie 名称,或者它只是 ASP.NET 的一个毫无意义的选项?

4

6 回答 6

15

如果您有多个应用程序在同一服务器上的同一域下运行,您可能希望为每个应用程序设置单独的会话 cookie 名称,这样它们就不会共享相同的会话状态,或者更糟的是还会相互覆盖。

另请参阅Forms Auth cookie 名称的注释:

指定用于身份验证的 HTTP cookie。如果多个应用程序在单个服务器上运行并且每个应用程序都需要唯一的 cookie,则必须在每个 Web.config 文件中为每个应用程序配置 cookie 名称。

于 2009-08-18T08:17:21.660 回答
2

1)它可能(稍微)减慢正在(随便)寻找它的人的速度。

2) 您可能想要隐藏您正在运行 ASP.NET 的事实

于 2009-08-18T08:05:00.343 回答
2

下面的链接提供了有关为什么应重命名会话 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”。”

于 2015-11-25T07:11:11.667 回答
2
于 2019-10-02T07:15:59.723 回答
1

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.

3.1. The "__Secure-" prefix

If a cookie's name begins with "__Secure-", the cookie MUST be:

  1. Set with a "Secure" attribute
  2. Set from a URI whose "scheme" is considered "secure" by the user agent.

The following cookie would be rejected when set from any origin, as the "Secure" flag is not set

Set-Cookie: __Secure-SID=12345; Domain=example.com

While the following would be accepted if set from a secure origin
(e.g. "https://example.com/"), and rejected otherwise:

Set-Cookie: __Secure-SID=12345; Secure; Domain=example.com

3.2. The "__Host-" prefix

If a cookie's name begins with "__Host-", the cookie MUST be:

  1. Set with a "Secure" attribute
  2. Set from a URI whose "scheme" is considered "secure" by the user agent.
  3. Sent only to the host which set the cookie. That is, a cookie named "__Host-cookie1" set from "https://example.com" MUST NOT contain a "Domain" attribute (and will therefore be sent only to "example.com", and not to "subdomain.example.com").
  4. Sent to every request for a host. That is, a cookie named "__Host-cookie1" MUST contain a "Path" attribute with a value of "/".

The following cookies would always be rejected:

Set-Cookie: __Host-SID=12345 Set-Cookie: __Host-SID=12345; Secure Set-Cookie: __Host-SID=12345; Domain=example.com
Set-Cookie: __Host-SID=12345; Domain=example.com; Path=/
Set-Cookie: __Host-SID=12345; Secure; Domain=example.com; Path=/

于 2020-04-20T07:13:42.790 回答
0

我认为这主要是口味问题。有些人/公司希望控制其网络应用程序的各个方面,并且可能只是使用另一个名称来与其他 cookie 名称保持一致。例如,如果您在整个应用程序中使用非常短的单字符参数名称,您可能不喜欢像 ASPSESSID 这样的会话 cookie 名称。

安全原因可能适用,但在我看来,通过默默无闻的安全性相当薄弱。

于 2009-08-18T08:19:04.777 回答