{"id":"CVE-2021-27850","published":"2021-04-15T07:40:11Z","modified":"2024-08-03T21:33:15Z","title":"Bypass of the fix for CVE-2019-0195","vendor":"Apache Software Foundation","product":"Apache Tapestry","tier":"core","eol":null,"affectedVersions":[{"vendor":"Apache Software Foundation","product":"Apache Tapestry","versions":["Apache Tapestry 5.5.0","Apache Tapestry 5.7.0",">= Apache Tapestry 5.4.5, < Apache Tapestry 5.4.0*",">= Apache Tapestry 5.6.2, < Apache Tapestry 5.6.0*"]}],"description":{"text":"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.1, upgrade to 5.6.2 or later. * For Apache Tapestry 5.7.0, upgrade to 5.7.1 or later.","provenance":"source","from":"CVE.org"},"summary":null,"cvss":null,"epss":{"score":0.9356,"percentile":0.99841,"date":"2026-10-30","provenance":"source"},"kev":null,"vulncheckKev":{"dateAdded":"2023-12-03","exploitedFirstSeen":"2023-12-03","ransomware":false,"evidence":[{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2023-12-03&host_type=src&vulnerability=cve-2021-27850","date":"2023-12-03"},{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2023-12-05&host_type=src&vulnerability=cve-2021-27850","date":"2023-12-05"},{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2023-12-06&host_type=src&vulnerability=cve-2021-27850","date":"2023-12-06"},{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2023-12-19&host_type=src&vulnerability=cve-2021-27850","date":"2023-12-19"},{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2023-12-24&host_type=src&vulnerability=cve-2021-27850","date":"2023-12-24"},{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2024-01-14&host_type=src&vulnerability=cve-2021-27850","date":"2024-01-14"},{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2024-01-22&host_type=src&vulnerability=cve-2021-27850","date":"2024-01-22"},{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2024-01-24&host_type=src&vulnerability=cve-2021-27850","date":"2024-01-24"},{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2024-01-27&host_type=src&vulnerability=cve-2021-27850","date":"2024-01-27"},{"url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2024-01-28&host_type=src&vulnerability=cve-2021-27850","date":"2024-01-28"}],"evidenceTotal":620,"provenance":"source"},"exploited":true,"otx":{"pulseCount":0,"pulses":[],"provenance":"machine"},"cwes":[{"id":"CWE-200","name":"Exposure of Sensitive Information to an Unauthorized Actor"},{"id":"CWE-502","name":"Deserialization of Untrusted Data"}],"references":[{"url":"https://lists.apache.org/thread.html/r237ff7f286bda31682c254550c1ebf92b0ec61329b32fbeb2d1c8751%40%3Cusers.tapestry.apache.org%3E","tags":["x_refsource_MISC"]},{"url":"http://www.openwall.com/lists/oss-security/2021/04/15/1","tags":["mailing-list","x_refsource_MLIST"]},{"url":"https://security.netapp.com/advisory/ntap-20210528-0002/","tags":["x_refsource_CONFIRM"]}],"techniques":[],"reports":[],"affected":[{"ecosystem":"Maven","package":"org.apache.tapestry:tapestry-core","vulnerableRanges":[">=5.4.0, <5.6.3",">=5.7.0, <5.7.1"],"patched":["5.6.3","5.7.1"],"from":["GHSA-mj8x-cpr8-x39h"],"provenance":"source"}],"advisories":[{"id":"GHSA-mj8x-cpr8-x39h","url":"https://github.com/advisories/GHSA-mj8x-cpr8-x39h","severity":"CRITICAL","ecosystem":"Maven","package":"org.apache.tapestry:tapestry-core","vulnerableRanges":[">=5.4.0, <5.6.3"],"patched":["5.6.3"],"provenance":"source","from":"GHSA"},{"id":"GHSA-mj8x-cpr8-x39h","url":"https://github.com/advisories/GHSA-mj8x-cpr8-x39h","severity":"CRITICAL","ecosystem":"Maven","package":"org.apache.tapestry:tapestry-core","vulnerableRanges":[">=5.7.0, <5.7.1"],"patched":["5.7.1"],"provenance":"source","from":"GHSA"}],"euvd":{"id":"EUVD-2021-1359","url":"https://euvd.enisa.europa.eu/vulnerability/EUVD-2021-1359","exploited":false,"exploitedSince":null,"provenance":"source"},"exploits":[],"exploitSources":{"pocGithub":{"count":4,"skipped":0,"earliest":"2021-06-25","earliestUrl":"https://github.com/kahla-sec/CVE-2021-27850_POC","repos":[{"name":"kahla-sec/CVE-2021-27850_POC","url":"https://github.com/kahla-sec/CVE-2021-27850_POC","stars":5,"created":"2021-06-25"},{"name":"dorkerdevil/CVE-2021-27850_POC","url":"https://github.com/dorkerdevil/CVE-2021-27850_POC","stars":3,"created":"2021-06-26"},{"name":"Ovi3/CVE_2021_27850_POC","url":"https://github.com/Ovi3/CVE_2021_27850_POC","stars":2,"created":"2021-07-02"},{"name":"novysodope/CVE-2021-27850","url":"https://github.com/novysodope/CVE-2021-27850","stars":0,"created":"2022-07-07"}]},"metasploit":[{"name":"Apache Tapestry HMAC secret key leak","module":"auxiliary/gather/cve_2021_27850_apache_tapestry_hmac_key","type":"auxiliary","disclosureDate":"2021-04-15","url":"https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/gather/cve_2021_27850_apache_tapestry_hmac_key.rb"}],"nuclei":[{"id":"CVE-2021-27850","name":"Apache Tapestry - Remote Code Execution","severity":"critical","path":"http/cves/2021/CVE-2021-27850.yaml","url":"https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-27850.yaml"}],"first":{"date":"2021-04-15","source":"Metasploit","url":"https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/gather/cve_2021_27850_apache_tapestry_hmac_key.rb"},"provenance":"source"},"exploitRefs":[],"flow":[],"timeline":[{"date":"2021-04-15","kind":"published","label":"Published (CVE.org)","url":"https://www.cve.org/CVERecord?id=CVE-2021-27850","provenance":"source"},{"date":"2021-04-15","kind":"exploit-public","label":"First public exploit: Metasploit; later: PoC-in-GitHub 2021-06-25","url":"https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/gather/cve_2021_27850_apache_tapestry_hmac_key.rb","provenance":"source"},{"date":"2023-12-03","kind":"exploited-reported","label":"Exploitation first reported (VulnCheck KEV evidence)","url":"https://dashboard.shadowserver.org/statistics/honeypot/vulnerability/map/?day=2023-12-03&host_type=src&vulnerability=cve-2021-27850","provenance":"source"}],"speed":{"daysToPublicExploit":0,"firstExploitFrom":"Metasploit","daysToKev":null},"priority":{"score":60.0,"factors":[{"name":"In a KEV catalog","points":35.0,"detail":"listed in VulnCheck KEV"},{"name":"Recent KEV listing","points":0.0,"detail":"added 1063 days ago"},{"name":"Known ransomware use","points":0.0,"detail":"not known"},{"name":"EPSS percentile","points":19.97,"detail":"percentile 0.9984"},{"name":"Named in threat reports","points":0.0,"detail":"0 reports"},{"name":"Public exploit code","points":5.0,"detail":"4 PoC-in-GitHub repos; 1 Metasploit module; 1 nuclei template"},{"name":"Mentioned in OTX pulses","points":0.0,"detail":"0 pulses"},{"name":"CVSS severity","points":0.0,"detail":"no CVSS"},{"name":"End-of-life product","points":0.0,"detail":"supported or unknown"}]},"lineage":{"familyId":"fam-apache-tapestry-cve-2019-0195","parents":[{"from":"CVE-2019-0195","to":"CVE-2021-27850","relation":"bypass","confidence":"high","kind":"lineage","evidence":[{"kind":"text","provenance":"source","relation":"bypass","quote":"The vulnerability I have found is a bypass of the fix for CVE-2019-0195.","from":"CVE.org","in":"CVE-2021-27850"}]}],"packageHistory":[{"cve":"CVE-2019-0207","published":"2019-09-16","fixed":"5.4.5","kev":false},{"cve":"CVE-2019-10071","published":"2019-09-16","fixed":"5.4.5","kev":false},{"cve":"CVE-2020-13953","published":"2020-09-30","fixed":"5.6.0","kev":false,"link":{"from":"CVE-2020-13953","to":"CVE-2021-27850","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"Maven:org.apache.tapestry:tapestry-core","fromFixed":"5.6.0","toFixed":"5.6.3","daysApart":197}]}},{"cve":"CVE-2021-27850","published":"2021-04-15","fixed":"5.7.1","kev":false},{"cve":"CVE-2021-30638","published":"2021-04-27","fixed":"5.7.2","kev":false,"link":{"from":"CVE-2021-27850","to":"CVE-2021-30638","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"Maven:org.apache.tapestry:tapestry-core","fromFixed":"5.6.3","toFixed":"5.6.4","daysApart":12}]}},{"cve":"CVE-2022-31781","published":"2022-07-13","fixed":"5.8.2","kev":false}],"package":"Maven:org.apache.tapestry:tapestry-core"}}