809
...
Write: begin
...
if (pass_mode) begin
pass_data = { {60{8'h00}}, data_d};
state_d = PassChk;
pass_mode = 1'b0;
...
end
...
The vulnerable code shows an incorrect implementation of the HMAC authentication where it only
uses the least significant 32 bits of the secret message for the authentication (the remaining 480
bits are hard coded as zeros). As a result, the system is susceptible to brute-force attacks where
the attacker only needs to determine 32 bits of the secret message instead of 512 bits, weakening
the cryptographic protocol.
To mitigate, remove the zero padding and use all 512 bits of the secret message for HMAC
authentication [REF-1361].
Example Language: Verilog (Good)
...
logic [512-1:0] data_d, data_q
logic [512-1:0] pass_data;
...
Write: begin
...
if (pass_mode) begin
pass_data = data_d;
state_d = PassChk;
pass_mode = 1'b0;
...
end
...
Observed Examples
Reference Description
CVE-2022-30320 Programmable Logic Controller (PLC) uses a protocol with a cryptographically
insecure hashing algorithm for passwords.
https://www.cve.org/CVERecord?id=CVE-2022-30320
CVE-2005-4900 SHA-1 algorithm is not collision-resistant.
https://www.cve.org/CVERecord?id=CVE-2005-4900
CVE-2020-25685 DNS product uses a weak hash (CRC32 or SHA-1) of the query name,
allowing attacker to forge responses by computing domain names with the
same hash.
https://www.cve.org/CVERecord?id=CVE-2020-25685
CVE-2012-6707 blogging product uses MD5-based algorithm for passwords.
https://www.cve.org/CVERecord?id=CVE-2012-6707
CVE-2019-14855 forging of certificate signatures using SHA-1 collisions.
https://www.cve.org/CVERecord?id=CVE-2019-14855
CVE-2017-15999 mobile app for backup sends SHA-1 hash of password in cleartext.
https://www.cve.org/CVERecord?id=CVE-2017-15999
CVE-2006-4068 Hard-coded hashed values for username and password contained in clientside
script, allowing brute-force offline attacks.
https://www.cve.org/CVERecord?id=CVE-2006-4068
MemberOf Relationships
CWE Version 4.14
CWE-328: Use of Weak Hash
CWE-328: Use of Weak Hash