Skip to content

bug: cookie is not set if the host address is localhost:4320#632

Open
m-fedosov wants to merge 1 commit into
digininja:masterfrom
m-fedosov:fix_weak_id
Open

bug: cookie is not set if the host address is localhost:4320#632
m-fedosov wants to merge 1 commit into
digininja:masterfrom
m-fedosov:fix_weak_id

Conversation

@m-fedosov

Copy link
Copy Markdown

This solution is better than #631 since it sets a cookie even on a subdomain

@m-fedosov

Copy link
Copy Markdown
Author

Let's pull this one into master

@digininja

digininja commented May 18, 2024 via email

Copy link
Copy Markdown
Owner

@m-fedosov

Copy link
Copy Markdown
Author

Hmm, I don't see any comments.

@digininja

digininja commented May 19, 2024 via email

Copy link
Copy Markdown
Owner

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;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't you setting it if it is localhost?

The default according to the manual should be an empty string, not false.

Would it make sense to do an equals check and reverse the two value fields? That would read better to me.

@digininja

Copy link
Copy Markdown
Owner

I hadn't clicked enough save buttons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants