Skip to main content

Concurrent sessions

Description

The application does not validate the number of active sessions each user has, thus a user can login more than once at the same time. Furthermore, the application does not notify the user when a session has already been initiated nor when a second one commences from a different location.

Impact

Affect the traceability and non-repudiation of the users actions.

Recommendation

The system must restrict the number of concurrent sessions that a user can establish and at the same it must notify the user when a login from a different location occurs.

Threat

Authenticated attacker from the Internet.

Expected Remediation Time

⌚ 30 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the vulnerability.

Base

  • Attack vector: N
  • Attack complexity: L
  • Privileges required: L
  • User interaction: R
  • Scope: U
  • Confidentiality: N
  • Integrity: L
  • Availability: N

Temporal

  • Exploit code madurity: X
  • Remediation level: X
  • Report confidence: X

Result

  • Vector string: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N/E:X/RL:X/RC:X
  • Score:
    • Base: 3.5
    • Temporal: 3.5
  • Severity:
    • Base: Low
    • Temporal: Low

Code Examples

Compliant code

The server deletes all existing sessions after a successful login from the user and notifies the user about the new login attempt

app.get('/login',(req,res) => {
const userCredentials = req.body.userCredentials;
const sessionToken = req.body.token;
if(isValidLogin(userCredentials) && sessionToken !== getUserToken(userCredentials.userId)){
req.session.destroy();
sendUserNotice(userCredentials.userId);
res.redirect('/profile');
}
});

Non compliant code

After a successful login, the application does not delete existing user sessions

app.get('/login',(req,res) => {
const userCredentials = req.body.userCredentials;
const sessionToken = req.body.token;
if(isValidLogin(userCredentials)){
//Code to handle login without deleting existing session
res.redirect('/profile');
}
});

Requirements