CVE-2021-3810: Code server Inefficient Regular Expression Complexity Vulnerability

HIGH
Advisory Identifier: GHSA-49x3-8228-3w3m
CVSS 7.5
CWE-1333
Published
Advisory Summary

CVE-2021-3810 is a HIGH (CVSS 7.5) inefficient regular expression complexity vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Code server libraries in the npm ecosystem. The issue involves inefficient regular expression complexity in code-server. Remediation is available by upgrading affected packages to version 3.12.0.

CVE-2021-3810 at a Glance

CVE Identifier CVE-2021-3810
GHSA Identifier GHSA-49x3-8228-3w3m
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Code server
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2021-3810

To remediate this vulnerability, upgrade all affected Code server dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

code-server fixed: 3.12.0
npm install code-server@3.12.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls code-server

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2021-3810, inspect your project dependencies using npm:

npm ls code-server

Analyze the terminal output to locate any version of Code server in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.12.0), your application is affected.

Note: The npm ls code-server command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Code server, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

code-server is vulnerable to Inefficient Regular Expression Complexity

CVE-2021-3810 Affected Code server Versions

1 component(s)
Fixed Versions:
3.12.0
Product / Package Ecosystem Affected Versions Fixed Version
code-server
npm
< 3.12.0
3.12.0

References

Frequently Asked Questions

What is CVE-2021-3810?
CVE-2021-3810 is a security vulnerability in Code server involving Inefficient Regular Expression Complexity in code-server under CWE-1333: Inefficient Regular Expression Complexity.
Which Code server versions are affected?
Affected versions include releases prior to 3.12.0 across affected packages: code-server.
What version fixes CVE-2021-3810?
Upgrading to 3.12.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is code-server affected?
Yes, code-server is affected in releases prior to 3.12.0. Upgrade your dependency to 3.12.0 or later.
What is the CVSS score of CVE-2021-3810?
CVE-2021-3810 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-3810?
CVE-2021-3810 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check npm dependencies for CVE-2021-3810?
Run the dependency tree command: 'npm ls code-server'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-49x3-8228-3w3m",
  "modified" : "2021-09-20T18:59:46Z",
  "published" : "2021-09-20T20:18:39Z",
  "aliases" : [ "CVE-2021-3810" ],
  "summary" : "Inefficient Regular Expression Complexity in code-server",
  "details" : "code-server is vulnerable to Inefficient Regular Expression Complexity",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "code-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.12.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-3810"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cdr/code-server/commit/ca617df135e78833f93c8320cb2d2cf8bba809f5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cdr/code-server"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.dev/bounties/38888513-30fc-4d8f-805d-34070d60e223"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-09-20T18:59:46Z",
    "nvd_published_at" : "2021-09-17T07:15:00Z"
  }
}