GHSA-53v4-42fg-g287 BIT-activemq-2022-41678 CVE-2022-41678
Apache ActiveMQ Deserialization of Untrusted Data vulnerability
- Severity
- 8.8 / 10
- High · CVSS 3.1
- Exploit chance (EPSS)
- 85.81%
- Chance of exploitation in the next 30 days. Higher than 99.73% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Fix
5.16.6- Upgrade org.apache.activemq:apache-activemq to this version or later
Description
Once an user is authenticated on Jolokia, he can potentially trigger arbitrary code execution.
In details, in ActiveMQ configurations, jetty allows org.jolokia.http.AgentServlet to handler request to /api/jolokia
org.jolokia.http.HttpRequestHandler#handlePostRequest is able to create JmxRequest through JSONObject. And calls to org.jolokia.http.HttpRequestHandler#executeRequest.
Into deeper calling stacks, org.jolokia.handler.ExecHandler#doHandleRequest is able to invoke through refection.
And then, RCE is able to be achieved via jdk.management.jfr.FlightRecorderMXBeanImpl which exists on Java version above 11.
1 Call newRecording.
2 Call setConfiguration. And a webshell data hides in it.
3 Call startRecording.
4 Call copyTo method. The webshell will be written to a .jsp file.
The mitigation is to restrict (by default) the actions authorized on Jolokia, or disable Jolokia. A more restrictive Jolokia configuration has been defined in default ActiveMQ distribution. We encourage users to upgrade to ActiveMQ distributions version including updated Jolokia configuration: 5.16.6, 5.17.4, 5.18.0, 6.0.0.
Affected versions
Maven
| Package | Vulnerable | Fixed in |
|---|---|---|
| org.apache.activemq:apache-activemq | < 5.16.6 |
5.16.6 |
| org.apache.activemq:apache-activemq | >= 5.17.0, < 5.17.4 |
5.17.4 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
org.apache.activemq:apache-activemq Maven → 5.16.6
- maven
<dependency><groupId>org.apache.activemq</groupId><artifactId>apache-activemq</artifactId><version>5.16.6</version></dependency>- gradle
implementation("org.apache.activemq:apache-activemq:5.16.6")
Severity breakdown
CVSS 3.1 8.8
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Weakness
CWE-287: Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
How to prevent it
- Architecture and Design: Use an authentication framework or library such as the OWASP ESAPI Authentication feature.
CWE-502: Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.
How to prevent it
- Architecture and Design, Implementation: If available, use the signing/sealing features of the programming language to assure that deserialized data has not been tainted. For example, a hash-based message authentication code (HMAC) could be used to ensure that data has not been modified.
- Implementation: When deserializing data, populate a new object rather than just deserializing. The result is that the data flows through safe input validation and that the functions are safe.
- Implementation: Explicitly define a final object() to prevent deserialization.
- Architecture and Design, Implementation: Make fields transient to protect them from deserialization. An attempt to serialize and then deserialize a class containing transient fields will result in NULLs where the transient data should be. This is an excellent way to prevent time, environment-based, or sensitive variables from being carried over and used improperly.
- Implementation: Avoid having unnecessary types or gadgets (a sequence of instances and method invocations that can self-execute during the deserialization process, often found in libraries) available that can be leveraged for malicious ends. This limits the potential for unintended or unauthorized types and gadgets to be leveraged by the attacker. Add only acceptable classes to an allowlist. Note: new gadgets are constantly being discovered, so this alone is not a sufficient mitigation.
- Architecture and Design, Implementation: Employ cryptography of the data or code for protection. However, it's important to note that it would still be client-side security. This is risky because if the client is compromised then the security implemented on the client (the cryptography) can be bypassed.
- Operation: Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
References
Advisories
Packages
Other links
- github.com/apache/activemq/pull/958
- github.com/apache/activemq/commit/5c8d457d9
- github.com/apache/activemq/commit/6120169e563b55323352431dfe9ac67a8b4de6c2
- github.com/apache/activemq/commit/bf65929fd
- github.com/apache/activemq/commit/d8ce1d9ff
- activemq.apache.org/security-advisories.data/CVE-2022-41678-announcement.txt
- lists.apache.org/thread/7g17kwbtjl011mm4tr8bn1vnoq9wh4sl
- lists.debian.org/debian-lts-announce/2024/10/msg00027.html
- security.netapp.com/advisory/ntap-20240216-0004
- openwall.com/lists/oss-security/2023/11/28/1
- openwall.com/lists/oss-security/2023/11/28/1
- security.netapp.com/advisory/ntap-20240216-0004
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-hf52-78x8-6w3w Apache ActiveMQ Broker, Apache ActiveMQ, Apache ActiveMQ All have an Exposure of Sensitive Information Through Metadata vulnerability | Medium | Also affects org.apache.activemq:apache-activemq |
| GHSA-99qx-5qqr-4j95 Apache ActiveMQ has an Incorrect Default Permissions vulnerability | High | Also affects org.apache.activemq:apache-activemq |
| GHSA-cpw7-g3p5-qrfq Apache ActiveMQ server has an incomplete authorization workflow | Medium | Also affects org.apache.activemq:apache-activemq |
| GHSA-v853-w46p-fv2h Apache ActiveMQ Broker, Apache ActiveMQ All, Apache ActiveMQ have a Code Injection issue | High | Also affects org.apache.activemq:apache-activemq |
| GHSA-hg6c-8mvr-jqc9 Apache ActiveMQ Broker, Apache ActiveMQ All, Apache ActiveMQ have a Code Injection issue | High | Also affects org.apache.activemq:apache-activemq |
| GHSA-8wm6-6fqh-phmc Apache ActiveMQ, Apache ActiveMQ Web have a Cross-site Scripting issue | Medium | Also affects org.apache.activemq:apache-activemq |
| GHSA-mr6m-xj7v-3cv3 Apache ActiveMQ Vulnerable to Code Injection | High | Also affects org.apache.activemq:apache-activemq |
| GHSA-2jp3-2923-9h52 Apache ActiveMQ Vulnerable to Cross-site Scripting | Medium | Also affects org.apache.activemq:apache-activemq |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor