views:

1365

answers:

11

The HR department at the company that I am currently working for has requested that I provide a system for storing employee social security numbers in our company database. The reason for this is to streamline payroll completion, as we use in-house software for employee timesheets but have to integrate with third-party software for our actual payroll system. This is a relatively small company (20-30 employees), and we'd only be storing current employees' SSN's (so a breach would only have limited impact), but I would still like to bank on security.

I would like to know if there is any convention out there for storing information as sensitive as social security numbers. I'm not very skilled in encryption, and I understand that there are several encryption techniques that I could resort to, but I was wondering if there was one way in particular that was best suited for this type of situation. Would AES be my best bet?

As for current software, we're running MySQL and our web interface is written in PHP and running on an IIS server.

A: 

I'm not sure if you can do this in MySQL, but you could have an insert / update trigger on the table that encrypts the data as it's saved to the database, and then have a view on the table that automatically decrypts the SSN.

Note that this only deals with encrypting the data on disk; you'd want to look into transport-layer encryption as well to protect the data on the wire (again, if MySQL supports that).

Edited to add: After reading Marcin's answer, I realized that I didn't mention the key management issue. Anyone who has access to the trigger or view definitions also has access to the encryption key, so if MySQL has the ability to hide trigger and view definitions, you'd want to look into that as well. Of course, including the encryption key with the encrypted data is inherently insecure in the first place, so this isn't a perfect solution.

Graeme Perrow
+1  A: 

Well, you haven't given any information on what you are going to do with these numbers. If you ever need to retrieve an SSN, then basically there's almost no point in doing anything with this - store it in clear. Any form of encryption where you have the ciphertext and key in the same place is going to only slow down an attacker a little. This only matters to attackers who can't take huge amounts of data, or who can't just take your whole computer, or who are not competent to join the dots. If you are dealing with the latter case, actual access control in the first place is rather more important.

If, however, you get an SSN externally and want to find out whose account that is, you could use a one-way hash to do that.

Marcin
+4  A: 

My recomendation: store your MySQL data on encrypted disks, so that in the event of laptop misplacement, etc, the data cannot be retrieved.

If the database application itself is compromised, of course, nothing can help, as the application itself uses the SSNs. Perhaps that is a design flaw you can correct. I would tend to think in terms of a small, limited application that maps SSN to a (non-SSN) key, and then using that new key as the "user ID" in your database rather than the SSN. I would avoid proliferation of the SSN itself at all costs.

bog
+3  A: 

The best method I've seen for storing sensitive data is public key encryption, and storing the private key somewhere other than the database (say, through an application only available to the head of HR and the CEO):

Then we started storing people’s credit cards…but out on the website we’d immediately encrypt them with a public key. ...

On the backend, we had the private key, and with the right pass-phrase we could temporarily decrypt it, then use it to decrypt a credit card, and charge the card for a DVD.

Max Lybbert
A: 

MySQL has a number of encryption functions that you can use to encode/decode. They should be sufficient for an internal application.

bmatthews68
+1  A: 

There are several current documents stating policy such as the White House memo and the GAO report GAO report.

Beyond that, there is encryption, vpn, and PKI for security.

A: 

You want to use some sort of reversible encryption, the stronger the better, and add some salt to the SSN. Adding salt will make it more difficult for a hacker to reverse the encryption with just the data from the database. The salt should be numeric so as to blend in with the SSN.

Scott
+1  A: 

Social Security numbers fall under "PII" (Personally Identifiable Information)... and you should encrypt them, but it's not required. So, yes AES is perfectly fine... really, anything you do is a plus.

Credit Card numbers fall under "PCI" (Payment Card Industry) compliance, and that is a mess. But in your case, you're ok.

BTW: AES 128 is considered perfectly good enough for Visa, Amex, Discover, etc (PCI).

Timothy Khouri
+3  A: 

I didn't see it mentioned anywhere, but is it necessary for this information to be online? If not, then you've secured one major avenue of attack by simply having this info stored in a database on a computer that's not connected to the internet. Or, if you can get away with having it stored on your LAN somewhere (so HR can have access to it, or whatever), as opposed to production servers, that's still a step in the right direction.

You mentioned that you're at a relatively small company, but it seems like an investment in some cheap hardware wouldn't be too difficult a thing to convince the decision makers of, given the benefits of storing this kind of sensitive info offline. And barring a massive hiring spree in the near future, you don't need a server class computer for storing personal info on ~30 employees by any means.

Wherever you store it, I'd still consider some kind of encryption. AES 256 is the standard for secure these days in most applications and is pretty widely supported. It doesn't sound like it's the sort of application to be under any kind of load, so again, there's no harm in going for a larger key size along with the cheap hardware, from the sounds of it.

As far as implementation goes, if you're comfortable with MySQL - stick with that, they've got the tools you need to do what you want: http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html

In the end, security is all about layers, no single solution is going to be the silver bullet, but you can go a long way by adding some pretty simple, common sense security measures.

Edit: after reading what Graeme said, I feel I should add that most security breaches are an inside job - make sure to protect your data at the disk level, through the database, and over the wire.

mmacaulay
A: 

Don't use the SSN as a primary key or otherwise proliferate their values any more than necessary. Use employee ID numbers or other unique-ID's generated. This will reduce the complexity of the problem.

If at all possible, keep the SSN's in a complete different database instance and do not allow it to be accessed by the day-to-day functions of the external application.

Once you've isolated the SSN, you can use any of the suggested methods to encrypt the data. Encrypting the physical tables and encrypting the stored-fields will make it harder for someone to steal the physical database files or to view SSN's using basic SQL access.

The main concern is to limit access to the SSN table through DB mechanisms, limit OS access, and secure the machine physically. Through the DB, use the most constrained permissions possible. Do not allow web, online, or other "shared" accounts access to the table if at all possible. On OS access, limit logins and directory access to a well known list of users. Turn on any and all auditing possible. As far as physical security, the machine should be in a locked/secured location.

Follow NSA guidelines on computer security where the SSN's are stored and any machine that has access to that machine.

Since you are just a small company, you don't need to worry too much about keeping mailing supplies and funds/insurance for identity monitoring in the event of a breach. Organizations with large numbers of employees and/or customers have faced significant challenges in meeting the legal requirements for breach notification. Finding 26 million envelopes on short notice isn't easy.

James Schek
A: 

My recommendation would be to rely on limiting access. Only have a single account able to actually read (and if necessary write) the table where the SSN's are stored. Use that account from within your application to access the db and block access from every other account.

Matthew Brubaker