安全性如何ASP.NET身份会话cookie? [英] How secure is ASP.NET Identity session cookie?

查看:107
本文介绍了安全性如何ASP.NET身份会话cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当然饼干可以被窃取和会话劫持,但如何安全是会话cookie的加密本身(ASP.NET身份)?难道有现代化的硬件和一点点时间来操作?

Of course cookies can be stolen and sessions hijacked, but how secure is the encryption itself of the session cookies (in ASP.NET Identity)? Could it be manipulated with modern hardware and a little bit of time?

我这么问是因为我想补充索赔标识一组,但如果cookie是真正安全的,这是唯一的安全。否则,攻击者可以注册一个合法的帐户,然后打入其他群体,甚至没有窃取密码。

I'm asking because I would like to add a claim that identifies a group, but this is only secure if the cookie is really secure. Otherwise an attacker could sign up for a legit account and then break into other groups without even stealing passwords.

推荐答案

答更新的用于.NET Framework 4和更高:

Answer updated for .NET Framework 4 and greater:

将machineKey 元素,它的用途:

The machineKey element which is used for:

加密,解密和表单的身份验证数据的验证
  和视图状态数据

encryption, decryption, and validation of forms-authentication data and view-state data

使用AES作为默认解密算法,以128位的最小的密钥长度。

uses AES as the default decryption algorithm, with a minimum key length of 128 bits.

它还使用 HMACSHA256 为验证默认是的 HMAC 了SHA-256。一个HMAC prevents一个长度扩展攻击这是攻击者将数据追加到一个方法即以这样的方式有散列在它的值,该散列仍然验证

It also uses HMACSHA256 as the default for validation which is HMAC over SHA-256. A HMAC prevents a length extension attack which is a way for an attacker to append data to the value that has the hash over it in such a way that the hash still validates.

有针对AES-128没有已知的实际的攻击(不同于192和256,可以从一个遭受相关密钥攻击)和SHA-256是隔靴搔痒被打破,虽然有一个的反对它的姐妹学术攻击SHA-1的的质疑碰撞阻力。抗碰撞性其实并不重要,验证标记值的时候,但它在理论上是朝着打破第二个$一步p $ pimage性。因此,你可以放心你反对使用AES-128和HMAC SHA-256攻击。

There are no known practical attacks against AES-128 (unlike 192 and 256 that can suffer from a related key attack), and SHA-256 is nowhere near being broken, although there is an academic attack against its sister SHA-1 that questions its collision resistance. Collision resistance doesn't really matter when authenticating token values, however it is theoretically one step towards breaking second preimage resistance. Therefore, you can rest assured you are secure against attacks with AES-128 and HMAC SHA-256.

然而,正如任何加密或哈希算法,它都将归结为您的关键安全性如何。自动生成和IsolateApps设置将被罚款,但如果你设置自己的确保它们是由加密安全伪随机数发生器(CSPRNG)生成,并在长度128位。任何低于这意味着你可以通过蛮力攻击(理论上)受到影响。 128位意味着即使使用世界上所有的计算机在您的钥匙永远不会在你的一生完整的分布式蛮力攻击。当然,攻击者可能会试图避开这个由抓住你的钥匙一些其他的方式。保证它的安全。

However, as with any encryption or hash algorithm, it will all boil down to how secure your key is. AutoGenerate and IsolateApps settings will be fine, however if you set your own make sure that they are generated by a cryptographically secure pseudo random number generator (CSPRNG) and are 128bits in length. Anything less than that means you could be compromised by a brute force attack (in theory). 128 bits means that even using every computer in the world in a distributed brute-force attack on your key would never complete in your lifetime. Of course, attackers may try and get round this by grabbing your key some other way. Keep it secure.

这篇关于安全性如何ASP.NET身份会话cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆