News for hackers. Stuff that matters.

Spot Bug in this Lua Code

key = "SuperSecretKey@007"

password = "lol!0!b00m"

token = sha1.hmac(key,password)

if (sha1.hmac(key,user_input) == token) then

print ("Login Success")

else

print ("Login Failed")

end

Assume that "user_input" is a variable that comes from the user.

( 2 comments | on HN )
Re:Spot Bug in this Lua Code by J_Darnley on Saturday November 21, 2015 @08:49AM (#10606779)
You aren't using any locals. sha1 is not defined anywhere. :)
Re:Spot Bug in this Lua Code by ato42 on Saturday November 21, 2015 @08:36AM (#10606760)
is the bug induced by user_input ? one could submit a function in there