2026-07-10 15:26 UTC
Why not? Because that's the same as the prefix of an empty string.
If you know the prefix and can choose the inputs based on how you interact with the protocol, you can choose an input that, synthetically, has that prefix.
Replies (2)
-
@soatok@furry.engineer 2026-07-10 15:35
Let's try something a bit more impactful. $user = $db->getUser(['username' => $request->username]); $cookie = 'username=' . $request->username; // put pw check here if ($user->isAdmin()) { $cookie .= '&admin=1'; } $cookieMac = hash_hmac('sha256', $hashInput, SECRET_KEY); setcookie('login', $cookieMac . $cookie); And let's assume there are no character restrictions on usernames during registration. Can you see how to forge an &admin=1 cookie?
-
@mvaneerde@tooting.ch 2026-07-10 15:31
@soatok@furry.engineer also worth establishing either a fixed length for the prefix, or a delimiter between the prefix and the payload (which delimiter cannot be used in any prefix)