CVE-2021-25748: K8s.io/ingress nginx Ingress-nginx `path` Sanitization Can Be Vulnerability

MODERATE
Advisory Identifier: GHSA-863x-868h-968x
CVSS 6.5
CWE-20
Published
Advisory Summary

CVE-2021-25748 is a MODERATE (CVSS 6.5) ingress-nginx `path` sanitization can be vulnerability (CWE-20: Improper Input Validation) affecting K8s.io/ingress nginx libraries in the Go ecosystem. The issue involves ingress-nginx `path` sanitization can be bypassed with newline character. Remediation is available by upgrading affected packages to version 1.2.1.

CVE-2021-25748 at a Glance

CVE Identifier CVE-2021-25748
GHSA Identifier GHSA-863x-868h-968x
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-20: Improper Input Validation
Affected Product K8s.io/ingress nginx
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:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).

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

How to Fix CVE-2021-25748

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

k8s.io/ingress-nginx fixed: 1.2.1
Upgrade k8s.io/ingress-nginx to 1.2.1
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 k8s.io/ingress-nginx

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-25748, inspect your project dependencies for K8s.io/ingress nginx:

inspect dependencies for k8s.io/ingress-nginx

Analyze the terminal output to locate any version of K8s.io/ingress nginx in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.1), 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In K8s.io/ingress nginx, 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

A security issue was discovered in ingress-nginx where a user that can create or update ingress objects can use a newline character to bypass the sanitization of the `spec.rules[].http.paths[].path` field of an Ingress object (in the `networking.k8s.io` or `extensions` API group) to obtain the credentials of the ingress-nginx controller. In the default configuration, that credential has access to all secrets in the cluster.

CVE-2021-25748 Affected K8s.io/ingress nginx Versions

1 component(s)
Fixed Versions:
1.2.1
Product / Package Ecosystem Affected Versions Fixed Version
k8s.io/ingress-nginx
Go
< 1.2.1
1.2.1

References

Frequently Asked Questions

What is CVE-2021-25748?
CVE-2021-25748 is a security vulnerability in K8s.io/ingress nginx involving Ingress-nginx `path` sanitization can be bypassed with newline character under CWE-20: Improper Input Validation.
Which K8s.io/ingress nginx versions are affected?
Affected versions include releases prior to 1.2.1 across affected packages: k8s.io/ingress-nginx.
What version fixes CVE-2021-25748?
Upgrading to 1.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is k8s.io/ingress-nginx affected?
Yes, k8s.io/ingress-nginx is affected in releases prior to 1.2.1. Upgrade your dependency to 1.2.1 or later.
What is the CVSS score of CVE-2021-25748?
CVE-2021-25748 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2021-25748?
CVE-2021-25748 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Go dependencies for CVE-2021-25748?
Run the dependency tree command: 'inspect dependencies for k8s.io/ingress-nginx'. 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-863x-868h-968x",
  "modified" : "2023-06-02T23:35:19Z",
  "published" : "2023-05-24T18:30:26Z",
  "aliases" : [ "CVE-2021-25748" ],
  "summary" : "Ingress-nginx `path` sanitization can be bypassed with newline character",
  "details" : "A security issue was discovered in ingress-nginx where a user that can create or update ingress objects can use a newline character to bypass the sanitization of the `spec.rules[].http.paths[].path` field of an Ingress object (in the `networking.k8s.io` or `extensions` API group) to obtain the credentials of the ingress-nginx controller. In the default configuration, that credential has access to all secrets in the cluster.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "k8s.io/ingress-nginx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-25748"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kubernetes/ingress-nginx/issues/8686"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kubernetes/ingress-nginx/pull/8623"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/kubernetes/ingress-nginx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kubernetes/ingress-nginx/releases/tag/controller-v1.2.1"
  }, {
    "type" : "WEB",
    "url" : "https://groups.google.com/g/kubernetes-security-announce/c/avaRYa9c7I8"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-05-24T21:55:34Z",
    "nvd_published_at" : "2023-05-24T17:15:09Z"
  }
}