Is Forms Authentication Ticket safe enough?
O

2

9

When a user logs in based on default Forms Authentication method, the server creates a cookie containing encrypted data (using Machine Key as key for encryption).

It means that if someone find/guess/access Machine Key for the server, he will be logged in to the web application.

I've developed some applications which are on 4 servers. So, I hard-coded the same Machine Key for all the servers in machine.config and I can't use Auto Generate mode.

  1. Is it possible to brute force the Machine Key?
  2. Is there any other methods? (I don't want to use Windows and Passport)
  3. And is Forms Authentication Ticket safe enough? (i.e. acceptable for e-banking applications)
Organogenesis answered 26/3, 2012 at 8:38 Comment(1)
Remember to mark the answer that helped the most :-)Raspings
R
20

ASP.NET forms authentication tickets are encrypted using the Rijndael algorithm. Rijndael was created as a replacement for DES (Data Encryption Standard) which offered unlimited ways to encrypt data and was also susceptible to brute force attacks. A number of DES Challenge were organised in the late 90's by RSA Security to challenge teams to crack DES in order to highlight its inherent vulnerabilities: http://en.wikipedia.org/wiki/DES_Challenges

By comparison Rijndael (also known as Advanced Encryption Standard AES) uses longer keys - 256bits and a double encrption algorithm. To crack a 256 bit Rijndael key (such as the ASP.NET machine key) would require 2^200 operations (about 10^60 - ten with 60 zeros), near impossible to brute force crack. Combine that with the fact that the ASP.NET ticket changes regularly, and when decrypted basically looks like a random string of letters and numbers (so impossible to determine if what you've brute force decrypted is correct or not) you can rest assured nobody will be cracking your forms authentication cookie any time soon.

More info about Rijndael and its possible attacks here:

http://en.wikipedia.org/wiki/Advanced_Encryption_Standard#Known_attacks

Raspings answered 26/3, 2012 at 8:59 Comment(0)
C
1

The first rule of encryption is that the message is only as secure as the key. If someone has access to your key there is no method secure enough.

  1. I doubt it is possible to brute-force the Machine Key in any reasonable time.
  2. I believe Fomrs Authentication is the only true web solution that comes out of the box in ASP.NET. You can implement your own but I doubt it will be more secure.
  3. Safe enough for what? It is hijackable by a man in the middle in non-encrypted connection and vulnerable to XSRF attacks if you turn off event validation (in Web Forms) or don't use the security tokens (MVC). Otherwise it is secure safe for exploits that are discovered and fixed all the time in all technologies.
Crowder answered 26/3, 2012 at 8:45 Comment(3)
Why would brute forcing the machine key require that the servers are brought down? Brute force is basically checking every possible combination to try to guess the machine key.Raspings
I believe this will require sending the cookie to the server? Or not? Anyway the machine key is really long and can't be brute forced easily.Crowder
Rijndael is just an algorithm, it can be run on any machine. If you can GUESS the machine key by checking every possible combination for the machine key then you can crack the ticket on any computer. The server already knows the machine key so it doesn't need to guess it when the ticket is sent back.Raspings

© 2022 - 2024 — McMap. All rights reserved.