I want to salt a hashed username and password (submitted via http POST) in JS on the client-side with a higher-order time value (< 1 minute resolution) to avoid sending the username and password hash as a constant value that could be used for a log-in attempt via POST fabrication by an unauthorized user (i.e. a sniffer).
我想在客户端使用高阶时间值(<1分钟分辨率)对JS中的哈希用户名和密码(通过http POST提交)进行加密,以避免将用户名和密码哈希作为常量值发送,这可能是用于通过未经授权的用户(即嗅探器)进行POST制作的登录尝试。
This will impose a short expiry on the usefulness of the passed hash.
这将对传递的哈希的有用性施加短暂的到期。
If they inspect the JS and see that it uses this time salt, how much easier will it make the job of breaking the MD5 if they know what the salt is?
如果他们检查JS并看到它使用这个时间盐,如果他们知道盐是什么,它会更容易打破MD5的工作?
Stephen
4 个解决方案
#1
3
The salt doesn't need to be secret. In that sense, your solution is okay.
盐不需要保密。从这个意义上说,你的解决方案是可以的。
MD5 is broken in some applications; this one might be alright, but why not use a hash from the SHA-2 family? For that matter, why not use SSL to provide a confidential channel, and better security?
MD5在某些应用中被打破;这个可能没问题,但为什么不使用SHA-2系列的哈希呢?就此而言,为什么不使用SSL来提供保密通道,以及更好的安全性?
#2
2
The time-based salt will not make MD5 any easier to break. You're still relying on 1) the user having a good password to defeat brute force calculations, and 2) MD5 being a decent hash. That's the basic answer to your question. However, this may not be a good idea anyway. Some comments--
基于时间的盐不会使MD5更容易破碎。你仍然依赖于1)用户有一个好的密码来打败强力计算,2)MD5是一个不错的哈希。这是你问题的基本答案。但是,无论如何,这可能不是一个好主意。一些评论 -
Unless you can ensure the client or server's time are synchronized (or you use Javascript to fake a synchronization), the client would have to send the time it used as salt. The server would have to decide if the time used was close enough to the server's time.
除非您可以确保客户端或服务器的时间是同步的(或者您使用Javascript来伪造同步),否则客户端必须将其用作salt的时间发送出去。服务器必须决定使用的时间是否足够接近服务器的时间。
Even if synchronized, you'd probably have to accept hashes plus or minus a minute or so because of latency on the Internet. Another problem is that if I'm sniffing I could immediately reuse this hash as long as I'm still within this time window.
即使是同步的,由于互联网上的延迟,你可能不得不接受散列加减一分钟左右。另一个问题是,如果我在嗅探我可以立即重用这个哈希,只要我还在这个时间窗口内。
Because of the problems above a better idea is to use a one-time server-assigned salt with the hash since it sounds like you don't want to use SSL. In other words, everytime a login form is sent to the client, the server would generate a random, unique salt string, sending it to the client and keep track that this is an acceptable salt. Then the client uses that as salt with the password. After this is submitted once, the server discards this as an acceptable salt string. No two hashes should ever be the same. The downside of this is you have to keep track of these acceptable salt strings.
由于上面的问题,更好的想法是使用一次性服务器分配的盐与哈希,因为它听起来你不想使用SSL。换句话说,每次将登录表单发送到客户端时,服务器都会生成一个随机的,唯一的盐字符串,将其发送到客户端并跟踪这是一个可接受的盐。然后客户端将其用作密码的盐。在提交一次之后,服务器将其作为可接受的盐字符串丢弃。没有两个哈希应该是相同的。这样做的缺点是你必须跟踪这些可接受的盐串。
#3
1
Their job will become infeasible, since you can't use a rainbow table at all if the hash is salted correctly, and you can't break MD5 in less than a minute, by which time the hash is invalidated anyway.
他们的工作将变得不可行,因为如果哈希值正确,你就不能使用彩虹表,并且你不能在不到一分钟的时间内破坏MD5,到那时哈希无效。
#4
-2
you could use code obfuscation to make the salt harder to find
你可以使用代码混淆来使盐更难找到
#1
3
The salt doesn't need to be secret. In that sense, your solution is okay.
盐不需要保密。从这个意义上说,你的解决方案是可以的。
MD5 is broken in some applications; this one might be alright, but why not use a hash from the SHA-2 family? For that matter, why not use SSL to provide a confidential channel, and better security?
MD5在某些应用中被打破;这个可能没问题,但为什么不使用SHA-2系列的哈希呢?就此而言,为什么不使用SSL来提供保密通道,以及更好的安全性?
#2
2
The time-based salt will not make MD5 any easier to break. You're still relying on 1) the user having a good password to defeat brute force calculations, and 2) MD5 being a decent hash. That's the basic answer to your question. However, this may not be a good idea anyway. Some comments--
基于时间的盐不会使MD5更容易破碎。你仍然依赖于1)用户有一个好的密码来打败强力计算,2)MD5是一个不错的哈希。这是你问题的基本答案。但是,无论如何,这可能不是一个好主意。一些评论 -
Unless you can ensure the client or server's time are synchronized (or you use Javascript to fake a synchronization), the client would have to send the time it used as salt. The server would have to decide if the time used was close enough to the server's time.
除非您可以确保客户端或服务器的时间是同步的(或者您使用Javascript来伪造同步),否则客户端必须将其用作salt的时间发送出去。服务器必须决定使用的时间是否足够接近服务器的时间。
Even if synchronized, you'd probably have to accept hashes plus or minus a minute or so because of latency on the Internet. Another problem is that if I'm sniffing I could immediately reuse this hash as long as I'm still within this time window.
即使是同步的,由于互联网上的延迟,你可能不得不接受散列加减一分钟左右。另一个问题是,如果我在嗅探我可以立即重用这个哈希,只要我还在这个时间窗口内。
Because of the problems above a better idea is to use a one-time server-assigned salt with the hash since it sounds like you don't want to use SSL. In other words, everytime a login form is sent to the client, the server would generate a random, unique salt string, sending it to the client and keep track that this is an acceptable salt. Then the client uses that as salt with the password. After this is submitted once, the server discards this as an acceptable salt string. No two hashes should ever be the same. The downside of this is you have to keep track of these acceptable salt strings.
由于上面的问题,更好的想法是使用一次性服务器分配的盐与哈希,因为它听起来你不想使用SSL。换句话说,每次将登录表单发送到客户端时,服务器都会生成一个随机的,唯一的盐字符串,将其发送到客户端并跟踪这是一个可接受的盐。然后客户端将其用作密码的盐。在提交一次之后,服务器将其作为可接受的盐字符串丢弃。没有两个哈希应该是相同的。这样做的缺点是你必须跟踪这些可接受的盐串。
#3
1
Their job will become infeasible, since you can't use a rainbow table at all if the hash is salted correctly, and you can't break MD5 in less than a minute, by which time the hash is invalidated anyway.
他们的工作将变得不可行,因为如果哈希值正确,你就不能使用彩虹表,并且你不能在不到一分钟的时间内破坏MD5,到那时哈希无效。
#4
-2
you could use code obfuscation to make the salt harder to find
你可以使用代码混淆来使盐更难找到