CVE-2021-26296: Myfaces core module Cryptographically Weak CSRF Tokens Vulnerability

HIGH
Advisory Identifier: GHSA-gq67-pp9w-43gp
CWE-330 CWE-352
Published
Advisory Summary

CVE-2021-26296 is a HIGH cryptographically weak csrf tokens vulnerability (CWE-330: Use of Insufficiently Random Values) affecting Myfaces core module libraries in the Maven ecosystem. The issue involves cryptographically weak csrf tokens in apache myfaces. Remediation is available by upgrading affected packages to version 2.0.25, 2.1.19, 2.2.14, 2.3.8.

CVE-2021-26296 at a Glance

CVE Identifier CVE-2021-26296
GHSA Identifier GHSA-gq67-pp9w-43gp
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-330: Use of Insufficiently Random Values
Affected Product Myfaces core module
Package Ecosystem Maven
Published Date
Last Updated

How to Fix CVE-2021-26296

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

org.apache.myfaces.core:myfaces-core-module fixed: 2.0.25
<dependency>
    <groupId>org.apache.myfaces.core</groupId>
    <artifactId>myfaces-core-module</artifactId>
    <version>2.0.25</version>
</dependency>
org.apache.myfaces.core:myfaces-core-module fixed: 2.1.19
<dependency>
    <groupId>org.apache.myfaces.core</groupId>
    <artifactId>myfaces-core-module</artifactId>
    <version>2.1.19</version>
</dependency>
org.apache.myfaces.core:myfaces-core-module fixed: 2.2.14
<dependency>
    <groupId>org.apache.myfaces.core</groupId>
    <artifactId>myfaces-core-module</artifactId>
    <version>2.2.14</version>
</dependency>
org.apache.myfaces.core:myfaces-core-module fixed: 2.3.8
<dependency>
    <groupId>org.apache.myfaces.core</groupId>
    <artifactId>myfaces-core-module</artifactId>
    <version>2.3.8</version>
</dependency>
Verify Direct and Transitive Dependencies

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

mvn dependency:tree -Dincludes=org.apache.myfaces.core

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2021-26296, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.myfaces.core

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

Note: The mvn dependency:tree -Dincludes=org.apache.myfaces.core command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-330: Use of Insufficiently Random Values, where the product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. In Myfaces core module, 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 the default configuration, Apache MyFaces Core versions 2.2.0 to 2.2.13, 2.3.0 to 2.3.7, 2.3-next-M1 to 2.3-next-M4, and 3.0.0-RC1 use cryptographically weak implicit and explicit cross-site request forgery (CSRF) tokens. Due to that limitation, it is possible (although difficult) for an attacker to calculate a future CSRF token value and to use that value to trick a user into executing unwanted actions on an application. Mitigation: Existing web.xml configuration parameters can be used to direct MyFaces to use SecureRandom for CSRF token generation: org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN=secureRandom org.apache.myfaces.RANDOM_KEY_IN_CSRF_SESSION_TOKEN=secureRandom org.apache.myfaces.RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN=secureRandom

CVE-2021-26296 Affected Myfaces core module Versions

4 component(s)
Fixed Versions:
2.0.252.1.192.2.142.3.8
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.myfaces.core:myfaces-core-module
Maven
< 2.0.25
2.0.25
org.apache.myfaces.core:myfaces-core-module
Maven
≥ 2.1.0
< 2.1.19
2.1.19
org.apache.myfaces.core:myfaces-core-module
Maven
≥ 2.2.0
< 2.2.14
2.2.14
org.apache.myfaces.core:myfaces-core-module
Maven
≥ 2.3.0
< 2.3.8
2.3.8

References

Frequently Asked Questions

What is CVE-2021-26296?
CVE-2021-26296 is a security vulnerability in Myfaces core module involving Cryptographically weak CSRF tokens in Apache MyFaces under CWE-330: Use of Insufficiently Random Values.
Which Myfaces core module versions are affected?
Affected versions include releases prior to 2.0.25, 2.1.19, 2.2.14, 2.3.8 across affected packages: org.apache.myfaces.core:myfaces-core-module.
What version fixes CVE-2021-26296?
Upgrading to 2.0.25, 2.1.19, 2.2.14, 2.3.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is myfaces-core-module affected?
Yes, org.apache.myfaces.core:myfaces-core-module is affected in releases prior to 2.0.25, 2.1.19, 2.2.14, 2.3.8. Upgrade your dependency to 2.0.25, 2.1.19, 2.2.14, 2.3.8 or later.
What CWE is associated with CVE-2021-26296?
CVE-2021-26296 is classified under CWE-330: Use of Insufficiently Random Values (The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.).
How can I check Maven dependencies for CVE-2021-26296?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.myfaces.core'. 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-gq67-pp9w-43gp",
  "modified" : "2021-05-07T21:12:38Z",
  "published" : "2021-06-16T17:31:39Z",
  "aliases" : [ "CVE-2021-26296" ],
  "summary" : "Cryptographically weak CSRF tokens in Apache MyFaces",
  "details" : "In the default configuration, Apache MyFaces Core versions 2.2.0 to 2.2.13, 2.3.0 to 2.3.7, 2.3-next-M1 to 2.3-next-M4, and 3.0.0-RC1 use cryptographically weak implicit and explicit cross-site request forgery (CSRF) tokens. Due to that limitation, it is possible (although difficult) for an attacker to calculate a future CSRF token value and to use that value to trick a user into executing unwanted actions on an application.\n\n\nMitigation:\nExisting web.xml configuration parameters can be used to direct\nMyFaces to use SecureRandom for CSRF token generation:\n\norg.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN=secureRandom\norg.apache.myfaces.RANDOM_KEY_IN_CSRF_SESSION_TOKEN=secureRandom\norg.apache.myfaces.RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN=secureRandom",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.myfaces.core:myfaces-core-module"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.25"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.myfaces.core:myfaces-core-module"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.0"
      }, {
        "fixed" : "2.1.19"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.myfaces.core:myfaces-core-module"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.2.0"
      }, {
        "fixed" : "2.2.14"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.myfaces.core:myfaces-core-module"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.3.0"
      }, {
        "fixed" : "2.3.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-26296"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apache/myfaces/commit/cc6e1cc7b9aa17e52452f7f2657b3af9c421b2b2"
  }, {
    "type" : "WEB",
    "url" : "https://issues.apache.org/jira/browse/MYFACES-4373"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r2b73e2356c6155e9ec78fdd8f72a4fac12f3e588014f5f535106ed9b%40%3Cannounce.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20210528-0007"
  }, {
    "type" : "WEB",
    "url" : "http://packetstormsecurity.com/files/161484/Apache-MyFaces-2.x-Cross-Site-Request-Forgery.html"
  }, {
    "type" : "WEB",
    "url" : "http://seclists.org/fulldisclosure/2021/Feb/66"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-330", "CWE-352" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-07T21:12:38Z",
    "nvd_published_at" : "2021-02-19T09:15:00Z"
  }
}