Joseph Beeton, a security researcher from Contrast Security, has disclosed a 0-day vulnerability in the Quarkus Java framework. The flaw, which is tracking as CVE-2022-4116, got a score of 9.8 on the CVSS scale and is considered critical in severity. As per the security researcher, the flaw exists only in the development version of the framework, which allows attackers to silently execute code on the victim’s machine running developer release of Quarkus’s User Interface and a malicious JavaScript simultaneously on the same browser. Considering its severity and implications, we published this post that help you learn how to fix CVE-2022-4116, a 0-day vulnerability in Quarkus Java Framework.
Before we go ahead and see how to fix CVE-2022-4116, let’s see a short note about Quarkus Java Framework and its development environment because it is a must to learn about the development environment preflight request and JavaScript to understand the flaw. Please, don’t skip the below section where we tried to explain them. If you are interested only in learning how to fix the flaw, then you may skip these sections and directly jump into the final section.
Quarkus is an open-source Java framework designed to be a Kubernetes-native, cloud-native, and developer productivity-focused application platform. It builds upon the familiar technologies of the Java ecosystem, such as Eclipse Microprofile and Apache Tomcat, to enable developers to create applications that have excellent performance characteristics while being more productive than ever before. Quarkus also uses GraalVM for its Ahead of Time (AOT) compilation capabilities which allows for extremely fast startup times, reducing both development cycle time and operational expenditure.
Quarkus has a development mode with dev UI that allows developers to rapidly develop, build, deploy, and debug their applications in a fast-iterative cycle. By leveraging live coding techniques, changes made during development are instantly reflected in the running application without having to manually recompile it every time. This makes it much easier for developers to experiment quickly with different ideas and features. Additionally, Quarkus Dev Mode provides an enhanced debugging experience for developers. By running their applications in the same JVM as their IDE, breakpoints can be set and variables monitored from within the IDE itself – making it easier to quickly identify and fix issues.
Quarkus dev mode has some security caveats. To make the development version more flexible than the production version and considering development mode is safe from internet attackers as the dev mode is designed to run only on the developer’s machine and bound to localhost, some security features like Cross-Site Request Forgery (CSRF) token, authentication and/or other security controls were skipped by design. It is allowed to modify the properties just by sending a POST request with the content type of application/x-www-form-urlencoded.
This is a critical severity vulnerability with a CVSS score of 9.8 out of 10. The flaw actually lies in the User Interface of the development release of the framework. The flaw allows attackers to carry out remote code execution attacks on the victim machine running Dev UI and malicious JavaScript at the same time on the same browser.
Associated CVE ID | CVE-2022-4116 |
Description | A 0-Day vulnerability in Dev UI of Quarkus Java Framework |
Associated ZDI ID | – |
CVSS Score | 9.8 Critical |
Vector | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Impact Score | – |
Exploitability Score | – |
Attack Vector (AV) | Network |
Attack Complexity (AC) | Low |
Privilege Required (PR) | None |
User Interaction (UI) | None |
Scope | Unchanged |
Confidentiality (C) | High |
Integrity (I) | High |
availability (a) | High |
A preflight request is an HTTP request sent to a server from the browser before a Cross Origin Resource Sharing (CORS) request is made. It enables browsers to securely determine whether or not to perform the actual request by providing servers with information about what kind of operation and data will be requested.
Preflight requests are a part of CORS, and they help prevent malicious or accidental data loss. A preflight request will typically issue an HTTP OPTIONS request header to the server, which contains methods, headers, and other information that is used by the browser to determine if the actual request should be made.
If the response from the server indicates that the actual request can be made safely, then the browser will continue with the request. Without preflight requests, an attacker can make malicious or accidental requests that could potentially cause data loss or other harm. Preflight requests are a crucial part of making cross-origin requests secure and reliable.
The preflight request is usually sent ahead of the actual request, but it may also be sent at the same time as the actual request. Additionally, some browsers are capable of caching preflight requests and their associated responses so that they don’t have to be sent every time a cross-origin resource is requested. This can improve performance in certain scenarios where the same cross-origin requests are being made multiple times.
Overall, preflight requests are an important part of securely making cross-origin requests, and they can help protect against data loss and other malicious activities. They should always be used when making cross-origin requests in order to ensure the safety of users’ data.
JavaScripts are designed to make requests only to the domain from where the script is originally downloaded. They are not allowed to make a request to other domains, including the localhost (request to the same host on which the script is running). If JavaScript is needed to make a request to the different domain only through the preflight requests.
“By compromising websites used by developers — for example, by simply injecting JavaScript into advertisements served on those sites or by launching a phishing attack that gets the developer to open a web browser on a compromised page — it is possible to reach out via non-pre-flighted HTTP requests to those services bound to localhost. It can be done by exploiting common misconfigurations in the Spring framework.”
– By Joseph Beeton, Senior Application Security Researcher, Contrast Security
This Spring framework flaw lets an attacker carry out remote code execution attacks on the victim machine running Dev UI and malicious JavaScript at the same time on the same browser. This attack doesn’t need manual interaction to exploit the vulnerability. It just needs someone who is running Quarkus in developer mode to go to a website containing the malicious JavaScript, as the JavaScript can be executed on page load by continually attempting to hit localhost or both.
RedHat fixed the flaw in 2.14.2.Final or 2.13.5.Final. We recommend upgrading Quarkus Java Framework to one of these versions to fix the 0-Day vulnerability in Quarkus Java Framework. If you are not in a position to upgrade anytime soon, there is a workaround.
Use a random path for the Quarkus Dev UI by moving all the non-application endpoints to a random root.
%dev.quarkus.http.non-application-root-path=<your random string>
The Dev UI is then available at the following URL: http://localhost:8080/<your random string>/dev/.
We hope this article helped in understanding how to fix CVE-2022-4116, a 0-day vulnerability in Quarkus Java Framework. Please share this post and help to secure the digital world. Visit our social media page on Facebook, LinkedIn, Twitter, Telegram, Tumblr, Medium & Instagram, and subscribe to receive updates like this.
You may also like these articles:
Arun KL is a cybersecurity professional with 15+ years of experience in IT infrastructure, cloud security, vulnerability management, Penetration Testing, security operations, and incident response. He is adept at designing and implementing robust security solutions to safeguard systems and data. Arun holds multiple industry certifications including CCNA, CCNA Security, RHCE, CEH, and AWS Security.
“Knowledge Arsenal: Empowering Your Security Journey through Continuous Learning”
"Cybersecurity All-in-One For Dummies" offers a comprehensive guide to securing personal and business digital assets from cyber threats, with actionable insights from industry experts.
BurpGPT is a cutting-edge Burp Suite extension that harnesses the power of OpenAI's language models to revolutionize web application security testing. With customizable prompts and advanced AI capabilities, BurpGPT enables security professionals to uncover bespoke vulnerabilities, streamline assessments, and stay ahead of evolving threats.
PentestGPT, developed by Gelei Deng and team, revolutionizes penetration testing by harnessing AI power. Leveraging OpenAI's GPT-4, it automates and streamlines the process, making it efficient and accessible. With advanced features and interactive guidance, PentestGPT empowers testers to identify vulnerabilities effectively, representing a significant leap in cybersecurity.
Tenable BurpGPT is a powerful Burp Suite extension that leverages OpenAI's advanced language models to analyze HTTP traffic and identify potential security risks. By automating vulnerability detection and providing AI-generated insights, BurpGPT dramatically reduces manual testing efforts for security researchers, developers, and pentesters.
Microsoft Security Copilot is a revolutionary AI-powered security solution that empowers cybersecurity professionals to identify and address potential breaches effectively. By harnessing advanced technologies like OpenAI's GPT-4 and Microsoft's extensive threat intelligence, Security Copilot streamlines threat detection and response, enabling defenders to operate at machine speed and scale.