Skip to content

Dashboard hardening: session cookie missing Secure/SameSite and no HSTS header #1520

Description

@rauldpm

Summary

Two small HTTP hardening gaps on the Wazuh dashboard (443), grouped here because they'd likely be addressed together: the authentication session cookie is set without the Secure and SameSite attributes, and the dashboard does not send a Strict-Transport-Security header (the manager API does). Neither is exploitable on its own, but both are cheap to close and are standard expectations for an HTTPS-only console.

Affected version

Wazuh dashboard 5.0.0 (dev packages built from the 5.0.0 branch, which carries the agent–manager HTTPS changes), served over TLS on 443 (server.ssl.enabled: true).

Steps to reproduce

# 1) Session cookie flags — log in and inspect Set-Cookie
curl -sk -D - -o /dev/null -X POST -H 'Content-Type: application/json' -H 'osd-xsrf: 1' \
  -d '{"username":"<user>","password":"<pass>"}' https://<DASHBOARD_IP>/auth/login | grep -i set-cookie

# 2) HSTS — inspect response headers
curl -sk -D - -o /dev/null https://<DASHBOARD_IP>/app/login | grep -i strict-transport-security

Expected behaviour

  • The security_authentication session cookie should carry Secure (HTTPS-only app) and an explicit SameSite attribute.
  • The dashboard should send Strict-Transport-Security on its responses, consistent with the API.

Actual behaviour

  • Session cookie is set as security_authentication=<...>; HttpOnly; Path=/ — no Secure, no SameSite.
  • No Strict-Transport-Security header is returned on 443 (the manager API on 55000 does send it).

Impact

  • Missing Secure: the session cookie can be transmitted over a plaintext channel if a request is ever downgraded to HTTP, exposing it to interception.
  • Missing SameSite: weaker CSRF defense-in-depth (the osd-xsrf token still applies, so this is layered, not sole, protection).
  • Missing HSTS: leaves a downgrade / SSL-strip window on first or subsequent visits.

Suggested fix / mitigation

  • Set the security-plugin cookie flags in opensearch_dashboards.yml: opensearch_security.cookie.secure: true and opensearch_security.cookie.isSameSite: Strict (or Lax).
  • Emit Strict-Transport-Security from the dashboard responses (e.g. max-age=31536000; includeSubDomains), matching the API's posture.

Notes

Positive observations: the cookie is already HttpOnly, the dashboard sets X-Frame-Options: sameorigin and a Content-Security-Policy, and failed logins return 401. The CSP does allow unsafe-eval/unsafe-inline, which appears inherent to OpenSearch Dashboards and is out of scope here.

Context

Identified as part of black-box penetration-testing tasks against a 5.0 deployment

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions