views:

95

answers:

5

My university has a portal which students use to register for classes. If you want to get into a full class, you have to keep checking the portal, and sign up when the class has an opening.

I wrote a tool that can check for openings and register automatically, but it needs the students university username and password. These passwords are tied to email accounts, network shares, server logins, and most every other university service.

Is there any way to do this securely?

A: 

You could encrypt the password strings when you store them and then decrypt them when you need to try logging in. Simply generate a symmetric key and use that to encrypt and decrypt the passwords for storage and retrieval (respectively).

Jack
And where do you store the key?
Martin v. Löwis
I could, but wouldn't the decryption code have to be sitting on my server right along with the encrypted passwords?
ABentSpoon
@ABentSpoon: Martin's asserting that storing encrypted passwords (along with the encryption key), is no more secure than just storing the passwords - and he's right. And yes, you can't "hide" your decryption code - the algorithms are well-understood.
Michael Petrotta
A: 

You can't store them entirely secure because you'd need to be able to encrypt and decrypt so one-way hash algorithms like MD5, SHA-1, SHA-2 wouldn't suffice. You could look into something like DES or Triple-DES encryption.

Taylor Leese
So where do you store the symmetric key for DES or Triple-DES?
Martin v. Löwis
Good question. That's why I said it's not entirely secure.
Taylor Leese
I'd say that encrypting the password with a different one doesn't improve security at all.
Martin v. Löwis
+3  A: 

In security, the most important thing is the "threat model". What kind of attack do you fear?

  • somebody may steal the computer where this program runs on: put the computer in a locked room.
  • somebody may hack into the computer and read it from memory: use firewalls and other protection against remote attacks
  • other users may read the hard disk where the password is stored: only store the password in memory (which would require re-entering it every time you start the program)
  • the super user may read the password even if it is in memory: only run the program on a computer where you trust the superuser.

etc.

Martin v. Löwis
Storing the encryption key in memory sounds like a pretty good idea. I'm not sure how much extra security it would really provide, but it would at least trip up an attacker for a little while, perhaps long enough to detect the attack and stop the servie.
ABentSpoon
If you ever needed to restart the service then you wouldn't be able to decrypt the passwords though. That's the biggest problem I see with this rather than the lack of security.
Taylor Leese
+1  A: 

Unfortunately, this is not really possible -- at least not the way you want to do it -- unless the university provides a key-based authentication API. You could always ask them nicely, but they'll probably be too busy to help. If you give your users full disclosure and keep your server secure, it should be enough.

Actually, there is one way to do it through the web without storing passwords -- you could use a Java or Flash app. Unfortunately your users would need to leave the browser open while the app does its work, but this way you wouldn't need to store the information.

Brett Coburn
I suppose I could even have them download a client which would run in the background.I think the full disclosure and general security is the way to go though. It will be running on my slicehost account, which I assume should be relatively secure...
ABentSpoon
A: 

I do not think there is. As Martin pointed out one way encryption won't do it for you. Also this will create a maintenance nightmare for you - every time a user changes password you will have to update your data.

I think to make it really work you have to change the design: find a way to do the registration without the user password, i.e. talk to the owners of the app if they would give you an account through which you can do registration on behalf of somebody else

mfeingold