Skip to content

In-depth lesson · Cross-site WebSocket hijacking

Typical fixes

Every point the Cross-site WebSocket hijacking reports back under this heading, best-backed first, each with the reports it is seen in.

Back to the lesson 1 to 7 of 7
  1. Validate the Origin header on every WebSocket handshake and reject connections from unexpected origins.

    Seen in 8 reports
  2. Do not set authentication cookies with SameSite None; use a stricter attribute so cross-site connections do not carry the session.

    Seen in 1 report
  3. Do not issue WebSocket tokens or streams before user authentication, and do not hard-code tokens in client-side source.

    Seen in 1 report
  4. Authenticate and authorise connections to local debug adapter ports and do not accept HTTP framing as debug messages.

    Seen in 1 report
  5. Validate the Origin header on state-changing notebook requests and take the CSRF token only from a header or body field, not a request parameter.

    Seen in 1 report
  6. Validate the CSRF token before applying any state change and do not commit the update when the token is invalid.

    Seen in 1 report
  7. Require the current password when creating or updating a security question and answer.

    Seen in 1 report