views:

279

answers:

3

Hello, I'm running ASP.NET MVC and need a safe way to store credit-card data temporarily (I have a order confirmation page, which posts to an action that actually processes the order). I tried TempData, but it doesn't survive the post. Can I safely use session since it's stored on the server?

Thanks.

+3  A: 

Sessons are insecure (thanks to the commentors for correcting me on this). Not only are they susceptible to a brute-force attack, there are several other vulnerabilities. http://www.dreamincode.net/forums/showtopic61503.htm

If you absolutely must use sessions to store your data, make sure to use a suitable session timeout so that people don't accidentally leave their credit card details on a public computer.

I would strongly recommend, however, that you review the Payment Card Industry Data Security Standard (PCI DSS). https://www.pcisecuritystandards.org/security_standards/pci_dss.shtml

David Pfeffer
+1 (in a big way) for PCI DSS. -1 (in a big way) for "sessions are secure". Sessions are *insecure*. And no, you don't need brute force to steal them. Google ASP.NET session hijacking.
Craig Stuntz
@Craig Thanks for that, I corrected the answer. I had no idea!
David Pfeffer
+1 Thanks, @bytenik. I will be sure to follow those policies.
jchapa
+4  A: 

You really shouldn't even be requesting the numbers until the last step in the process. Additionally, you should be using SSL for the entire span of the process too. If you decide to store them in Session, encrypt them just for an added degree of safety.

Jonathan Sampson
Good advice. I knew that you had to follow certain policies if you persisted the data, but was glad I asked before throwing them in Session State (even using SSL).
jchapa
A: 

Session state will persist the information, but it is not secure. Be aware that any kind of persistence may be violating the terms of service with the bank or credit agency. Most of them have very strict regulations on what you're allowed to do with this information.

Aaronaught
Apparently my answer implied that "sessions are secure". I don't think I said that, and even pointed out that persisting CC's at all is something you shouldn't do, but in any case, I edited to make that point more clear.
Aaronaught