Skip to content

Default Session Cookie Name

Description

The default session cookie name is used, which can be used by an attacker to fingerprint the server and target attacks accordingly.

Examples

Insecure Code

javascript
const session = require('cookie-session')();
const session = require('express-session')();

Secure Code

javascript
const session = require('cookie-session')({ name: 'custom_session_id' });
const session = require('express-session')({ name: 'custom_session_id' });

Remediation

Change the default session cookie name to a custom value.

Rule Details

FieldValue
IDCODE-0388
CategoryAuth
SeverityMEDIUM
CWECWE-522
ConfidenceHIGH
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityEASY
Tagssession cookie, fingerprinting
OWASPA2:2017-Broken Authentication, A07:2021-Identification and Authentication Failures