Skip to content

Vulnerability due to insecure default values for session.cookie_secure and session.cookie_httponly #7913

Open
@etkaar

Description

@etkaar

Description

Dear colleagues,

it seems that the default values for the SECURE and HTTPONLY flags of cookies, especially for the PHP session cookie, (PHPSESSID) are not set to true. This opens a hidden vulnerability for serious XSS attacks.

Developers which use setcookie() and explicitly define $secure and $httponly might not be aware (they have done their work and feel safe), that they additionally have to explicitly set these values in session_set_cookie_params() to protect the PHPSESSID cookie from being stolen due to trivial XSS attacks:

session_set_cookie_params(['secure' => true, 'httponly' => true]);

I kindly ask you to confirm this issue and move to secure-per-default for this.

Kind Regards,
etkaar

PHP Version

PHP 7-8

Operating System

No response


See also: #13720 (successful XSS reported)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions