Some cookies lack Secure or HttpOnly flags, exposing them to interception or JavaScript access.
By Seoxpert Editorial · Published
Cookies without Secure or HttpOnly flags can be exploited by attackers to hijack user sessions or steal sensitive information. This can lead to data breaches, loss of user trust, and potential SEO penalties if user safety is compromised.
Leaving this unresolved increases the risk of session hijacking, XSS, and CSRF attacks.
An automated crawler inspects HTTP response headers to identify cookies missing Secure or HttpOnly attributes.
PHP: Setting Secure and HttpOnly flags
setcookie('sessionid', $value, [
'expires' => time() + 3600,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax'
]);Node.js (Express): Setting Secure and HttpOnly flags
res.cookie('sessionid', value, {
httpOnly: true,
secure: true,
sameSite: 'lax'
});HTTP Header: Correct Set-Cookie example
Set-Cookie: sessionid=abc123; Path=/; Secure; HttpOnly; SameSite=LaxCookies without the Secure flag can be sent over unencrypted HTTP, making them vulnerable to interception by attackers.
The HttpOnly flag prevents JavaScript from accessing the cookie, reducing the risk of theft via XSS attacks.
You can set the Secure flag, but HttpOnly can only be set by the server, not via client-side JavaScript.
At minimum, all session and authentication cookies should have Secure and HttpOnly flags for security.
Run a scan to see if Cookies Missing Secure or HttpOnly Flags affects your pages.
Scan my website →