CVE-2021-27850: Tapestry core Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-mj8x-cpr8-x39h
CWE-922 CWE-502
Published
Advisory Summary

CVE-2021-27850 is a CRITICAL remote code execution vulnerability (CWE-922: Insecure Storage of Sensitive Information) affecting Tapestry core libraries in the Maven ecosystem. The issue involves remote code execution in apache tapestry. Remediation is available by upgrading affected packages to version 5.6.3, 5.7.1.

CVE-2021-27850 at a Glance

CVE Identifier CVE-2021-27850
GHSA Identifier GHSA-mj8x-cpr8-x39h
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-922: Insecure Storage of Sensitive Information
Affected Product Tapestry core
Package Ecosystem Maven
Published Date
Last Updated

How to Fix CVE-2021-27850

To remediate this vulnerability, upgrade all affected Tapestry core 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.tapestry:tapestry-core fixed: 5.6.3
<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-core</artifactId>
    <version>5.6.3</version>
</dependency>
org.apache.tapestry:tapestry-core fixed: 5.7.1
<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-core</artifactId>
    <version>5.7.1</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.tapestry

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=org.apache.tapestry

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

Note: The mvn dependency:tree -Dincludes=org.apache.tapestry 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-922: Insecure Storage of Sensitive Information, where the product stores sensitive information without properly limiting read or write access by unauthorized actors. In Tapestry core, 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 critical unauthenticated remote code execution vulnerability was found all recent versions of Apache Tapestry. The affected versions include 5.4.5, 5.5.0, 5.6.2 and 5.7.0. The vulnerability I have found is a bypass of the fix for CVE-2019-0195. Recap: Before the fix of CVE-2019-0195 it was possible to download arbitrary class files from the classpath by providing a crafted asset file URL. An attacker was able to download the file `AppModule.class` by requesting the URL `http://localhost:8080/assets/something/services/AppModule.class` which contains a HMAC secret key. The fix for that bug was a blacklist filter that checks if the URL ends with `.class`, `.properties` or `.xml`. Bypass: Unfortunately, the blacklist solution can simply be bypassed by appending a `/` at the end of the URL: `http://localhost:8080/assets/something/services/AppModule.class/` The slash is stripped after the blacklist check and the file `AppModule.class` is loaded into the response. This class usually contains the HMAC secret key which is used to sign serialized Java objects. With the knowledge of that key an attacker can sign a Java gadget chain that leads to RCE (e.g. CommonsBeanUtils1 from ysoserial). Solution for this vulnerability: * For Apache Tapestry 5.4.0 to 5.6.2, upgrade to 5.6.3 or later. * For Apache Tapestry 5.7.0, upgrade to 5.7.1 or later.

CVE-2021-27850 Affected Tapestry core Versions

2 component(s)
Fixed Versions:
5.6.35.7.1
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.tapestry:tapestry-core
Maven
≥ 5.4.0
< 5.6.3
5.6.3
org.apache.tapestry:tapestry-core
Maven
≥ 5.7.0
< 5.7.1
5.7.1

References

Frequently Asked Questions

What is CVE-2021-27850?
CVE-2021-27850 is a security vulnerability in Tapestry core involving Remote code execution in Apache Tapestry under CWE-922: Insecure Storage of Sensitive Information.
Which Tapestry core versions are affected?
Affected versions include releases prior to 5.6.3, 5.7.1 across affected packages: org.apache.tapestry:tapestry-core.
What version fixes CVE-2021-27850?
Upgrading to 5.6.3, 5.7.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tapestry-core affected?
Yes, org.apache.tapestry:tapestry-core is affected in releases prior to 5.6.3, 5.7.1. Upgrade your dependency to 5.6.3, 5.7.1 or later.
What CWE is associated with CVE-2021-27850?
CVE-2021-27850 is classified under CWE-922: Insecure Storage of Sensitive Information (The product stores sensitive information without properly limiting read or write access by unauthorized actors.).
How can I check Maven dependencies for CVE-2021-27850?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.tapestry'. 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-mj8x-cpr8-x39h",
  "modified" : "2021-04-19T21:38:56Z",
  "published" : "2021-06-16T17:33:19Z",
  "aliases" : [ "CVE-2021-27850" ],
  "summary" : "Remote code execution in Apache Tapestry",
  "details" : "A critical unauthenticated remote code execution vulnerability was found all recent versions of Apache Tapestry. The affected versions include 5.4.5, 5.5.0, 5.6.2 and 5.7.0. The vulnerability I have found is a bypass of the fix for CVE-2019-0195. Recap: Before the fix of CVE-2019-0195 it was possible to download arbitrary class files from the classpath by providing a crafted asset file URL. An attacker was able to download the file `AppModule.class` by requesting the URL `http://localhost:8080/assets/something/services/AppModule.class` which contains a HMAC secret key. The fix for that bug was a blacklist filter that checks if the URL ends with `.class`, `.properties` or `.xml`. Bypass: Unfortunately, the blacklist solution can simply be bypassed by appending a `/` at the end of the URL: `http://localhost:8080/assets/something/services/AppModule.class/` The slash is stripped after the blacklist check and the file `AppModule.class` is loaded into the response. This class usually contains the HMAC secret key which is used to sign serialized Java objects. With the knowledge of that key an attacker can sign a Java gadget chain that leads to RCE (e.g. CommonsBeanUtils1 from ysoserial). Solution for this vulnerability: * For Apache Tapestry 5.4.0 to 5.6.2, upgrade to 5.6.3 or later. * For Apache Tapestry 5.7.0, upgrade to 5.7.1 or later.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tapestry:tapestry-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.4.0"
      }, {
        "fixed" : "5.6.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tapestry:tapestry-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.7.0"
      }, {
        "fixed" : "5.7.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-27850"
  }, {
    "type" : "WEB",
    "url" : "https://issues.apache.org/jira/browse/TAP5-2663"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r237ff7f286bda31682c254550c1ebf92b0ec61329b32fbeb2d1c8751%40%3Cusers.tapestry.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20210528-0002"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2021/04/15/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502", "CWE-922" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-19T21:38:56Z",
    "nvd_published_at" : "2021-04-15T08:15:00Z"
  }
}