|
Post by waffloid on Jun 8, 2017 19:28:49 GMT
(Check out SQL Injection #1 and #2 for context)
DIFFICULTY: Expert LANGUAGE: Lua
After a recent surge in account theft, the website owners have again decided to increase the security. The passwords can be a string of any size. The passwords are stored in an encrypted state in user_data and require decryption to be used. Your objective is to have the verify function return true.
As long as you only edit below the line, the way you accomplish this does not matter, as long as you do not override the verify function
do local sub = string.sub
global_key = 2 local private_key = math.random(3) local timeout = 2 -- can only use valid twice before returning nil local user_data = { Waffloid = { password='ilikechicken'..math.random(11), cash_balance=40735 } } for user,data in pairs(user_data) do data.password = data.password:rep(global_key+private_key) -- encrypts password end function valid(user,pass) local user = user_data[user] if user then local rep_key = global_key+private_key local success= pcall(function() local bin = pass + user end) if not success and timeout ~= 0 then -- should error or else something is fishy timeout = timeout + 1 -- OOPS return sub(user.password,1,#user.password/(rep_key))==pass end end end end
----- ONLY EDIT BELOW THIS LINE
|
|
|
Post by cntkillme on Jun 12, 2017 10:38:46 GMT
Ah yes. This was definitely my favorite of the 3. Although it took the longest for me to solve the answer was by far the simplest. My solution will be posted in a day or whatever. These are fun challenges, more people need to try them.
|
|
|
Post by Bit on Jun 12, 2017 20:34:36 GMT
Fun fact, this one wasn't made by the creator of the other two and has a vulnerability present in the past ones.
|
|
|
Post by cntkillme on Jun 13, 2017 10:35:16 GMT
Your method of solving them was cheating IMO.
Anyways here's my second solution: global_key = math.huge valid("Waffloid", "")
|
|