CVE-2025-61795: Tomcat Vulnerability In 9.0.46
Hey guys! Let's dive into a critical security vulnerability, CVE-2025-61795, detected in tomcat-embed-core-9.0.46.jar. If you're using Apache Tomcat, especially version 9.0.46, you'll want to pay close attention. This article will break down the vulnerability, its impact, and how to fix it, all in a friendly and easy-to-understand way.
What is CVE-2025-61795?
CVE-2025-61795 is a medium severity vulnerability found in the tomcat-embed-core-9.0.46.jar library, which is a core component of the Apache Tomcat server. This vulnerability relates to an improper resource shutdown or release issue. Basically, it means that Tomcat isn't cleaning up temporary files properly after handling multipart uploads, which can lead to a denial-of-service (DoS) attack. Imagine piling up garbage without ever taking it out – that's kind of what's happening here, and eventually, it can cause the system to crash.
Delving Deeper into the Vulnerability
When Tomcat processes multipart uploads, it sometimes writes temporary copies of the uploaded parts to the disk. Now, under normal circumstances, these temporary files should be deleted as soon as they're no longer needed. However, in the case of an error during the upload process (like exceeding file size limits), these temporary files weren't being cleaned up immediately. Instead, they were left for the garbage collection (GC) process to handle.
The problem? Garbage collection isn't always immediate. It depends on factors like JVM settings, how much memory the application is using, and the overall load on the application. So, if a malicious actor floods the server with faulty multipart uploads, these temporary files can accumulate faster than the garbage collector can clear them. This can lead to disk space exhaustion, effectively causing a Denial of Service (DoS). Think of it like a traffic jam – too many cars (or in this case, temporary files) trying to use the same road (disk space) at the same time, leading to a standstill.
This vulnerability affects a wide range of Apache Tomcat versions, specifically:
- 11.0. 0-M1 through 11.0.11
- 10.1. 0-M1 through 10.1.46
- 9.0. 0.M1 through 9.0.109
- EOL versions 8.5.0 through 8.5.100 (and potentially older EOL versions)
If you're running any of these versions, it’s crucial to take action.
Why is This a Medium Severity Vulnerability?
You might be wondering why this is classified as medium severity. While it doesn't directly compromise the confidentiality or integrity of your data, it can knock your server offline, impacting availability. The CVSS 3 score of 5.3 reflects this, with key metrics including:
- Attack Vector: Network – The vulnerability can be exploited remotely.
- Attack Complexity: High – Exploiting this isn't a walk in the park; it requires some know-how.
- Privileges Required: Low – An attacker doesn't need high-level access to trigger this.
- User Interaction: None – No user action is needed for the attack to work.
- Impact on Availability: High – The primary impact is a potential DoS, making your application unavailable.
Identifying the Vulnerable Library
The specific vulnerable library is tomcat-embed-core-9.0.46.jar. This JAR file is part of the core Tomcat implementation and is often included in Spring Boot applications that use embedded Tomcat servers. To check if you're affected, you need to look at your project's dependencies.
How to Check Your Dependencies
If you are using Maven, you'll typically find this dependency declared in your pom.xml file. You might see it directly or as a transitive dependency brought in by other libraries like spring-boot-starter-web or spring-boot-starter-tomcat. Here’s an example of how it might look in your dependency hierarchy:
spring-boot-starter-web-3.0.1.jar (Root Library)
└── spring-boot-starter-tomcat-2.3.12.RELEASE.jar
└── tomcat-embed-core-9.0.46.jar (Vulnerable Library)
In this case, tomcat-embed-core-9.0.46.jar is a transitive dependency of spring-boot-starter-tomcat. If you see this version (or any of the vulnerable versions listed earlier), you need to take action.
How to Fix CVE-2025-61795: Upgrade Tomcat!
Okay, so you've identified that you're using a vulnerable version of Tomcat. What's the fix? The recommended solution is to upgrade your Tomcat version to one that includes the fix for this vulnerability. Apache Tomcat has released patched versions that address this issue.
Upgrade to a Safe Version
The suggested fix is to upgrade to one of the following versions (or later):
- 11.0.12 or later
- 10.1.47 or later
- 9.0.110 or later
These versions include the necessary fix to ensure temporary files are properly cleaned up after multipart uploads, preventing the DoS vulnerability.
Steps to Upgrade Your Tomcat Version
The exact steps to upgrade your Tomcat version will depend on how you've deployed Tomcat and your application. However, here are the general steps you'll likely need to follow:
-
Identify Your Current Tomcat Version: Before you upgrade, make sure you know which version you're currently running. You can usually find this information in the Tomcat administration interface or by checking the Tomcat server logs.
-
Update Your pom.xml (if using Maven): If you're using Maven, you'll need to update the version number for the
tomcat-embed-coredependency (or thespring-boot-starter-tomcatdependency if you're using Spring Boot) in yourpom.xmlfile. For example, if you're upgrading from 9.0.46 to 9.0.110, you would change the version number accordingly.<dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> <version>9.0.110</version> </dependency>If you're using Spring Boot, you might manage the Tomcat version through the
spring-boot-starter-tomcatdependency. Spring Boot usually provides a consistent and tested set of dependencies, so updating the Spring Boot version can also update the embedded Tomcat version. Check the Spring Boot release notes to see which Tomcat version is included in a particular Spring Boot release. -
Redeploy Your Application: After updating the dependencies, you'll need to rebuild and redeploy your application to apply the changes. This usually involves packaging your application (e.g., creating a WAR file) and deploying it to your Tomcat server.
-
Test Thoroughly: Once you've upgraded and redeployed, it's crucial to test your application thoroughly. Make sure all functionalities are working as expected, especially those involving file uploads. You might want to run some load tests to ensure the fix is working correctly and that the server can handle a high volume of requests without issues.
A Note on Spring Boot
If you're using Spring Boot, upgrading the spring-boot-starter-tomcat dependency or upgrading your Spring Boot version itself is often the easiest way to update the embedded Tomcat version. Spring Boot does a great job of managing dependencies, so this approach can simplify the upgrade process.
Key Takeaways
- CVE-2025-61795 is a medium severity vulnerability affecting Apache Tomcat.
- It can lead to a Denial of Service (DoS) due to improper cleanup of temporary files.
- The vulnerability affects versions 11.0.0-M1 through 11.0.11, 10.1.0-M1 through 10.1.46, 9.0.0.M1 through 9.0.109, and EOL versions 8.5.0 through 8.5.100.
- The fix is to upgrade to Tomcat version 11.0.12 or later, 10.1.47 or later, or 9.0.110 or later.
- If you're using Spring Boot, updating the
spring-boot-starter-tomcatdependency or upgrading Spring Boot itself is often the easiest way to apply the fix.
Staying Secure: Best Practices
Beyond just fixing this specific vulnerability, it's essential to adopt some best practices for maintaining the security of your applications and servers. Here are a few tips:
- Keep Your Software Up-to-Date: This might seem obvious, but it's crucial. Regularly update your Tomcat server, Java runtime, Spring Boot framework, and all other dependencies. Security vulnerabilities are often discovered and patched, so staying up-to-date is one of the best defenses.
- Monitor Security Announcements: Keep an eye on security mailing lists, vulnerability databases (like the National Vulnerability Database), and vendor announcements. This will help you stay informed about potential security issues affecting your software stack.
- Use Dependency Scanning Tools: Tools like Mend (mentioned in the original extract) can help you automatically scan your project dependencies for known vulnerabilities. These tools can alert you to potential issues early in the development process, making it easier to address them.
- Implement a Web Application Firewall (WAF): A WAF can help protect your application from various types of attacks, including those that exploit known vulnerabilities. It acts as a shield between your application and the outside world, filtering out malicious traffic.
- Regular Security Audits: Conducting regular security audits of your application and infrastructure can help identify potential weaknesses and vulnerabilities. Consider hiring a security professional to perform these audits, as they can bring an outside perspective and specialized knowledge.
Final Thoughts
Security is an ongoing process, not a one-time fix. By understanding vulnerabilities like CVE-2025-61795 and taking proactive steps to address them, you can help protect your applications and your users. So, take action today, upgrade your Tomcat version, and keep those servers secure! Remember, a little prevention is worth a whole lot of cure.