-->

Include an encrypted password in a URL? Possible?

2019-08-02 19:04发布

问题:

We have a typical web-based login system. We want customers to have the ability to generate a "login link" that doesn't ever expire and includes their password. We want to therefore create a link which includes their password in encrypted form. NOTE: I know the best way is a lookup table where each link has a unique key... I won't go into why that won't work for us; it won't.

I'm not familiar with public key encryption.. Maybe that's what I need?

Here's what I'm thinking. This still might not be enough, so please let me know:

Definition: user-password refers to the user's password that we want in encrypted form in the link.

We cannot use one encryption key for all user-passwords because it may be possible to derive the encryption key by generating tons of links, so...

  • Use a standard form of symmetric encryption.

  • The server has a text file with 1000 complex encryption keys.

  • When a link is generated (using the PHP script that has that list), one of the 1000 encyption keys is chosen to encrypt their plaintext password (chosen in sequence, not at random to prevent the same from being chosen close to the same time).

  • Before encrypting the user's password, add something like "s345lm34l5k342342343534432324sdfs" to the start of it, to "salt" it. (Ex: password1 becomes s345lm34l5k342342343534432324sdfspassword1). "Salting" makes it harder to decrypt against dictionary attacks. This salt is kept private. But, of course, there's the risk it can be compromised and it's one salt for all passwords, so...

  • In addition, there's a second randomly generated salt added to the password. This salt is encrypted with a single strong password. Because both the salt and the password encrypting it is a random pattern of bytes, it makes it harder to determine the salt.

  • The link maker tool only lets you generate 15 links every 10 minutes, and then locks out the IP.

  • The link maker tool doesn't not generate links unless the user/password provided to it is actual a functioning user/password combination. That way, if someone is just try to generate links to determine the encryption info, it won't work. Still, theoretically, they could obtain a valid user/password and try to brute force.

Is this secure?

回答1:

No, because the encrypted password has become the password. Have you tried SSL? SSL should solve your problems, you can just use a plain URL on HTTP level.