CVE-2021-21303: Helm.sh/helm/v3 Improper Neutralization Of Special Elements Vulnerability

MODERATE
Advisory Identifier: GHSA-c38g-469g-cmgx
CVSS 6.5
CWE-74
Published
Advisory Summary

CVE-2021-21303 is a MODERATE (CVSS 6.5) improper neutralization of special elements vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Helm.sh/helm/v3 libraries in the Go ecosystem. The issue involves improper neutralization of special elements in output in helm.sh/helm/v3. Remediation is available by upgrading affected packages to version 3.5.2.

CVE-2021-21303 at a Glance

CVE Identifier CVE-2021-21303
GHSA Identifier GHSA-c38g-469g-cmgx
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Helm.sh/helm/v3
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.5

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

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

How to Fix CVE-2021-21303

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

helm.sh/helm/v3 fixed: 3.5.2
Upgrade helm.sh/helm/v3 to 3.5.2
Verify Direct and Transitive Dependencies

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

inspect dependencies for helm.sh/helm/v3

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-21303, inspect your project dependencies for Helm.sh/helm/v3:

inspect dependencies for helm.sh/helm/v3

Analyze the terminal output to locate any version of Helm.sh/helm/v3 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.5.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Helm.sh/helm/v3, 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

Since Helm 2 was released, a well-documented aspect of Helm is that the Helm chart's version number MUST follow the SemVer2 specification. In the past, Helm would not permit charts with malformed versions. At some point, a patch was merged that changed this - On a version parse error, the version number was simply passed along as-is. This provided a vector for malicious data to be injected into Helm and potentially used in various ways. Core maintainers were able to send deceptive information to a terminal screen running the `helm` command, as well as obscure or alter information on the screen. In some cases, we could send codes that terminals used to execute higher-order logic, like clearing a terminal screen. Further, during evaluation, the Helm maintainers discovered a few other fields that were not properly sanitized when read out of repository index files. This fix remedies all such cases, and once again enforces SemVer2 policies on version fields. All users of the Helm 3 should upgrade. Those who use Helm as a library should verify that they either sanitize this data on their own, or use the proper Helm API calls to sanitize the data. ### Patches This issue has been resolved in Helm 3.5.2. While this fix does not constitute a breaking change, as all field formatting is now enforced as documented, it is possible that charts that were mistakenly allowed (but invalid) may no longer be available in search indexes. Specifically, **malformed SemVer versions are no longer supported**. This has always been the documented case, but it is true that malformed versions were allowed. Note that this is the first security release since Helm 2's final deprecation. Helm 2 was not audited for vulnerability to this issue, and should be assumed vulnerable.

CVE-2021-21303 Affected Helm.sh/helm/v3 Versions

1 component(s)
Fixed Versions:
3.5.2
Product / Package Ecosystem Affected Versions Fixed Version
helm.sh/helm/v3
Go
≥ 3.0.0
< 3.5.2
3.5.2

References

Frequently Asked Questions

What is CVE-2021-21303?
CVE-2021-21303 is a security vulnerability in Helm.sh/helm/v3 involving Improper Neutralization of Special Elements in Output in helm.sh/helm/v3 under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Helm.sh/helm/v3 versions are affected?
Affected versions include releases prior to 3.5.2 across affected packages: helm.sh/helm/v3.
What version fixes CVE-2021-21303?
Upgrading to 3.5.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is helm.sh/helm/v3 affected?
Yes, helm.sh/helm/v3 is affected in releases prior to 3.5.2. Upgrade your dependency to 3.5.2 or later.
What is the CVSS score of CVE-2021-21303?
CVE-2021-21303 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N.
What CWE is associated with CVE-2021-21303?
CVE-2021-21303 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2021-21303?
Run the dependency tree command: 'inspect dependencies for helm.sh/helm/v3'. 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-c38g-469g-cmgx",
  "modified" : "2024-05-31T16:48:30Z",
  "published" : "2021-06-23T18:14:40Z",
  "aliases" : [ "CVE-2021-21303" ],
  "summary" : "Improper Neutralization of Special Elements in Output in helm.sh/helm/v3",
  "details" : "\nSince Helm 2 was released, a well-documented aspect of Helm is that the Helm chart's version number MUST follow the SemVer2 specification. In the past, Helm would not permit charts with malformed versions. At some point, a patch was merged that changed this - On a version parse error, the version number was simply passed along as-is. This provided a vector for malicious data to be injected into Helm and potentially used in various ways.\n\nCore maintainers were able to send deceptive information to a terminal screen running the `helm` command, as well as obscure or alter information on the screen. In some cases, we could send codes that terminals used to execute higher-order logic, like clearing a terminal screen.\n\nFurther, during evaluation, the Helm maintainers discovered a few other fields that were not properly sanitized when read out of repository index files. This fix remedies all such cases, and once again enforces SemVer2 policies on version fields.\n\nAll users of the Helm 3 should upgrade.\n\nThose who use Helm as a library should verify that they either sanitize this data on their own, or use the proper Helm API calls to sanitize the data.\n\n### Patches\nThis issue has been resolved in Helm 3.5.2.\n\nWhile this fix does not constitute a breaking change, as all field formatting is now enforced as documented, it is possible that charts that were mistakenly allowed (but invalid) may no longer be available in search indexes. Specifically, **malformed SemVer versions are no longer supported**. This has always been the documented case, but it is true that malformed versions were allowed.\n\nNote that this is the first security release since Helm 2's final deprecation. Helm 2 was not audited for vulnerability to this issue, and should be assumed vulnerable.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "helm.sh/helm/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.5.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/helm/helm/security/advisories/GHSA-c38g-469g-cmgx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21303"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/helm/helm/commit/6ce9ba60b73013857e2e7c73d3f86ed70bc1ac9a"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-c38g-469g-cmgx"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/helm/helm"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/helm/helm/releases/tag/v3.5.2"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2022-1040"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-21T14:30:59Z",
    "nvd_published_at" : "2021-02-05T22:15:00Z"
  }
}