CVE-2023-35926: @backstage/plugin scaffolder backend Backstage Scaffolder Plugin Has Insecure Vulnerability

HIGH
Advisory Identifier: GHSA-wg6p-jmpc-xjmr
CVSS 8.0
CWE-94
Published
Advisory Summary

CVE-2023-35926 is a HIGH (CVSS 8.0) backstage scaffolder plugin has insecure vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting @backstage/plugin scaffolder backend libraries in the npm ecosystem. The issue involves backstage scaffolder plugin has insecure sandbox. Remediation is available by upgrading affected packages to version 1.15.0.

CVE-2023-35926 at a Glance

CVE Identifier CVE-2023-35926
GHSA Identifier GHSA-wg6p-jmpc-xjmr
Severity HIGH
CVSS v3.1 Base Score 8.0
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product @backstage/plugin scaffolder backend
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.0

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

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

How to Fix CVE-2023-35926

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

@backstage/plugin-scaffolder-backend fixed: 1.15.0
npm install @backstage/plugin-scaffolder-backend@1.15.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 @backstage/plugin-scaffolder-backend

How to Check if You Are Affected

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

npm ls @backstage/plugin-scaffolder-backend

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

Note: The npm ls @backstage/plugin-scaffolder-backend 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In @backstage/plugin scaffolder backend, 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

The Backstage scaffolder-backend plugin uses a templating library that requires a sandbox, as it by design allows for code injection. The library used for this sandbox so far has been `vm2`, but in light of several past vulnerabilities and existing vulnerabilities that may not have a fix, the plugin has switched to using a different sandbox library. ### Impact A malicious actor with write access to a registered scaffolder template could manipulate the template in a way that allows for remote code execution on the scaffolder-backend instance. This was only exploitable in the template YAML definition itself and not by user input data. ### Patches This is vulnerability is fixed in version 1.15.0 of `@backstage/plugin-scaffolder-backend`. ### Workarounds Note that the [Backstage Threat Model](https://backstage.io/docs/overview/threat-model) states that scaffolder templates are considered to be a sensitive area that with the recommendation that you control access and perform manual reviews of changes to the scaffolder templates. The exploit is of a nature where it is easily discoverable in manual review.

CVE-2023-35926 Affected @backstage/plugin scaffolder backend Versions

1 component(s)
Fixed Versions:
1.15.0
Product / Package Ecosystem Affected Versions Fixed Version
@backstage/plugin-scaffolder-backend
npm
< 1.15.0
1.15.0

References

Frequently Asked Questions

What is CVE-2023-35926?
CVE-2023-35926 is a security vulnerability in @backstage/plugin scaffolder backend involving Backstage Scaffolder plugin has insecure sandbox under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which @backstage/plugin scaffolder backend versions are affected?
Affected versions include releases prior to 1.15.0 across affected packages: @backstage/plugin-scaffolder-backend.
What version fixes CVE-2023-35926?
Upgrading to 1.15.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @backstage/plugin-scaffolder-backend affected?
Yes, @backstage/plugin-scaffolder-backend is affected in releases prior to 1.15.0. Upgrade your dependency to 1.15.0 or later.
What is the CVSS score of CVE-2023-35926?
CVE-2023-35926 has a CVSS v3.1 base score of 8.0 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2023-35926?
CVE-2023-35926 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check npm dependencies for CVE-2023-35926?
Run the dependency tree command: 'npm ls @backstage/plugin-scaffolder-backend'. 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-wg6p-jmpc-xjmr",
  "modified" : "2023-06-21T22:00:30Z",
  "published" : "2023-06-21T22:00:30Z",
  "aliases" : [ "CVE-2023-35926" ],
  "summary" : "Backstage Scaffolder plugin has insecure sandbox",
  "details" : "The Backstage scaffolder-backend plugin uses a templating library that requires a sandbox, as it by design allows for code injection. The library used for this sandbox so far has been `vm2`, but in light of several past vulnerabilities and existing vulnerabilities  that may not have a fix, the plugin has switched to using a different sandbox library.\n\n### Impact\n\nA malicious actor with write access to a registered scaffolder template could manipulate the template in a way that allows for remote code execution on the scaffolder-backend instance. This was only exploitable in the template YAML definition itself and not by user input data.\n\n### Patches\n\nThis is vulnerability is fixed in version 1.15.0 of `@backstage/plugin-scaffolder-backend`.\n\n### Workarounds\n\nNote that the [Backstage Threat Model](https://backstage.io/docs/overview/threat-model) states that scaffolder templates are considered to be a sensitive area that with the recommendation that you control access and perform manual reviews of changes to the scaffolder templates. The exploit is of a nature where it is easily discoverable in manual review.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@backstage/plugin-scaffolder-backend"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.15.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/security/advisories/GHSA-wg6p-jmpc-xjmr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-35926"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/commit/fb7375507d56faedcb7bb3665480070593c8949a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/backstage/backstage"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/backstage/backstage/releases/tag/v1.15.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-21T22:00:30Z",
    "nvd_published_at" : "2023-06-22T14:15:09Z"
  }
}