Skip to content

Commit

Permalink
bug: cookie is not set if the host address is localhost:4320
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Fedosov committed May 11, 2024
1 parent 0773216 commit a07ed10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion vulnerabilities/weak_id/source/high.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
}
$_SESSION['last_session_id_high']++;
$cookie_value = md5($_SESSION['last_session_id_high']);
setcookie("dvwaSession", $cookie_value, time()+3600, "/vulnerabilities/weak_id/", $_SERVER['HTTP_HOST'], false, false);
$domain = ($_SERVER['SERVER_NAME'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false;
setcookie("dvwaSession", $cookie_value, time()+3600, "/vulnerabilities/weak_id/", $domain, false, false);
}

?>
3 changes: 2 additions & 1 deletion vulnerabilities/weak_id/source/impossible.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

if ($_SERVER['REQUEST_METHOD'] == "POST") {
$cookie_value = sha1(mt_rand() . time() . "Impossible");
setcookie("dvwaSession", $cookie_value, time()+3600, "/vulnerabilities/weak_id/", $_SERVER['HTTP_HOST'], true, true);
$domain = ($_SERVER['SERVER_NAME'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false;
setcookie("dvwaSession", $cookie_value, time()+3600, "/vulnerabilities/weak_id/", $domain, true, true);
}
?>

0 comments on commit a07ed10

Please sign in to comment.