CVE-2022-4147: Quarkus CORS filter allows simple GET and POST requests with an invalid Origin to proceed
Summary
CVE-2022-4147: Quarkus CORS filter allows simple GET and POST requests with an invalid Origin to proceed. Affects io.quarkus:quarkus-vertx-http across 2 version ranges.
< 2.13.5.Final
>= 2.14.0.CR1, < 2.14.2.Final
Fixed in 2.13.5.Final or 2.14.2.Final, depending on the release line you run. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The Quarkus Vert.x HTTP package is an open-source library that provides support for building reactive applications in Java. It offers a lightweight and efficient runtime for developing cloud-native microservices. The package includes a CORS (Cross-Origin Resource Sharing) filter that allows or restricts cross-origin requests based on specified rules. CORS is an important security mechanism that prevents malicious websites from making unauthorized requests to a server. However, a vulnerability has been discovered in the Quarkus CORS filter that allows simple GET and POST requests with an invalid Origin to proceed, bypassing the intended security restrictions.
Vulnerability Detail
The vulnerability in the Quarkus CORS filter allows simple GET and POST requests with an invalid Origin to proceed. This means that an attacker can send requests from a different domain than the one allowed by the server, potentially leading to unauthorized access or data leakage. The issue specifically affects simple GET or POST requests made with XMLHttpRequest, which are requests that have no event listeners registered on the object returned by the XMLHttpRequest upload property and have no ReadableStream object used in the request. The vulnerability has a CVSS score of 7.5, indicating a high severity level.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
< 2.13.5.Final2.13.5.Final -
>= 2.14.0.CR1, < 2.14.2.Final2.14.2.Final
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
If upgrading to a fixed version is not immediately feasible, a temporary workaround can be implemented by manually validating the Origin header in the application code. This can be done by checking the value of the Origin header in each incoming request and comparing it against a whitelist of allowed origins. If the Origin header is found to be invalid or not present, the request should be rejected or handled accordingly. Here is an example of how this validation can be implemented in Java using the Quarkus framework:
import io.vertx.ext.web.handler.CorsHandler;
CorsHandler corsHandler = CorsHandler.create()
.allowOrigin("https://example.com")
.allowMethods(HttpMethod.GET, HttpMethod.POST);
// Apply the CORS handler to the desired routes
router.route().handler(corsHandler);
In this example, the allowOrigin method is used to specify the allowed origin(s) as a whitelist. Requests with an invalid or unauthorized origin will be rejected.
Conclusion
The Quarkus Vert.x HTTP package is vulnerable to a security issue that allows simple GET and POST requests with an invalid Origin to proceed. This can potentially lead to unauthorized access or data leakage. It is crucial for developers to upgrade to a fixed version of the package (2.14.2.Final or 2.13.5.Final) to mitigate the vulnerability. If immediate upgrading is not possible, implementing a manual validation of the Origin header can serve as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for io.quarkus:quarkus-vertx-http →
FAQ
The vulnerability allows simple GET and POST requests with an invalid Origin to proceed, potentially leading to unauthorized access or data leakage. It can be exploited by an attacker to bypass the intended security restrictions and make requests from a different domain than the one allowed by the server.
The vulnerability affects versions 2.14.0.CR1 and earlier, as well as versions 0 and later. It has been fixed in versions 2.14.2.Final and 2.13.5.Final.
CORS (Cross-Origin Resource Sharing) is a security mechanism that allows or restricts cross-origin requests. It is important because it prevents malicious websites from making unauthorized requests to a server, thereby protecting sensitive data and resources.
You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply enter your project's pom.xml file and the playground will analyze it in real-time to identify any open-source vulnerabilities, including CVE-2022-4147.
Yes, a temporary workaround is to manually validate the Origin header in the application code. By checking the value of the Origin header in each incoming request and comparing it against a whitelist of allowed origins, you can reject or handle requests with invalid or unauthorized origins.
Related vulnerabilities
Recent vulnerabilities recorded for io.quarkus:quarkus-vertx-http.