CVE-2021-28162: @theia/messages Command Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-c94v-8fff-73ph
CVSS 6.1
CWE-829
Published
Advisory Summary

CVE-2021-28162 is a MODERATE (CVSS 6.1) command injection vulnerability (CWE-829: Inclusion of Functionality from Untrusted Control Sphere) affecting @theia/messages libraries in the npm ecosystem. The issue involves command injection in @theia/messages. Remediation is available by upgrading affected packages to version 1.0.0.

CVE-2021-28162 at a Glance

CVE Identifier CVE-2021-28162
GHSA Identifier GHSA-c94v-8fff-73ph
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-829: Inclusion of Functionality from Untrusted Control Sphere
Affected Product @theia/messages
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

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

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

How to Fix CVE-2021-28162

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

@theia/messages fixed: 1.0.0
npm install @theia/messages@1.0.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 @theia/messages

How to Check if You Are Affected

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

npm ls @theia/messages

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

Note: The npm ls @theia/messages 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-829: Inclusion of Functionality from Untrusted Control Sphere, where the product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. In @theia/messages, 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

In Eclipse Theia versions up to and including 0.16.0, in the notification messages there is no HTML escaping, so Javascript code can run.

CVE-2021-28162 Affected @theia/messages Versions

1 component(s)
Fixed Versions:
1.0.0
Product / Package Ecosystem Affected Versions Fixed Version
@theia/messages
npm
< 1.0.0
1.0.0

References

Frequently Asked Questions

What is CVE-2021-28162?
CVE-2021-28162 is a security vulnerability in @theia/messages involving Command Injection in @theia/messages under CWE-829: Inclusion of Functionality from Untrusted Control Sphere.
Which @theia/messages versions are affected?
Affected versions include releases prior to 1.0.0 across affected packages: @theia/messages.
What version fixes CVE-2021-28162?
Upgrading to 1.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @theia/messages affected?
Yes, @theia/messages is affected in releases prior to 1.0.0. Upgrade your dependency to 1.0.0 or later.
What is the CVSS score of CVE-2021-28162?
CVE-2021-28162 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2021-28162?
CVE-2021-28162 is classified under CWE-829: Inclusion of Functionality from Untrusted Control Sphere (The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.).
How can I check npm dependencies for CVE-2021-28162?
Run the dependency tree command: 'npm ls @theia/messages'. 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-c94v-8fff-73ph",
  "modified" : "2021-05-07T17:57:37Z",
  "published" : "2021-05-10T15:36:55Z",
  "aliases" : [ "CVE-2021-28162" ],
  "summary" : "Command Injection in @theia/messages",
  "details" : "In Eclipse Theia versions up to and including 0.16.0, in the notification messages there is no HTML escaping, so Javascript code can run.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@theia/messages"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-28162"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/eclipse-theia/theia/issues/7283"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/eclipse-theia/theia/pull/7289"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/eclipse-theia/theia/blob/master/CHANGELOG.md#v100---26032020"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-829" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-07T17:57:37Z",
    "nvd_published_at" : "2021-03-12T22:15:00Z"
  }
}