CVE-2022-21700: Micronaut http Memory Leak Vulnerability
MODERATECVE-2022-21700 is a MODERATE (CVSS 5.3) memory leak vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Micronaut http libraries in the Maven ecosystem. The issue involves memory leak in micronaut-core. Remediation is available by upgrading affected packages to version 3.2.7.
CVE-2022-21700 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2022-21700
To remediate this vulnerability, upgrade all affected Micronaut http dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http</artifactId>
<version>3.2.7</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=io.micronaut
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2022-21700, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=io.micronaut
Analyze the terminal output to locate any version of Micronaut http in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.2.7), your application is affected.
Note: The mvn dependency:tree -Dincludes=io.micronaut command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Micronaut http, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-21700 Affected Micronaut http Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
io.micronaut:micronaut-http
|
Maven |
< 3.2.7
|
3.2.7
|
References
Frequently Asked Questions
What is CVE-2022-21700?
Which Micronaut http versions are affected?
What version fixes CVE-2022-21700?
Is micronaut-http affected?
What is the CVSS score of CVE-2022-21700?
What CWE is associated with CVE-2022-21700?
How can I check Maven dependencies for CVE-2022-21700?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2457-2263-mm9f",
"modified" : "2022-01-19T19:56:29Z",
"published" : "2022-01-21T23:19:36Z",
"aliases" : [ "CVE-2022-21700" ],
"summary" : "Memory leak in micronaut-core",
"details" : "### Impact\n\nSending an invalid Content Type header leads to memory leak in `DefaultArgumentConversionContext` as this type is erroneously used in static state.\n\n### Patches\n\nThe problem is patched in Micronaut 3.2.7 and above.\n\n### Workarounds\n\nThe default content type binder can be replaced in an existing Micronaut application to mitigate the issue:\n\n```java\npackage example;\n\nimport java.util.List;\nimport io.micronaut.context.annotation.Replaces;\nimport io.micronaut.core.convert.ConversionService;\nimport io.micronaut.http.MediaType;\nimport io.micronaut.http.bind.DefaultRequestBinderRegistry;\nimport io.micronaut.http.bind.binders.RequestArgumentBinder;\nimport jakarta.inject.Singleton;\n\n@Singleton\n@Replaces(DefaultRequestBinderRegistry.class)\nclass FixedRequestBinderRegistry extends DefaultRequestBinderRegistry {\n\n public FixedRequestBinderRegistry(ConversionService conversionService,\n List<RequestArgumentBinder> binders) {\n super(conversionService, binders);\n }\n\n @Override\n protected void registerDefaultConverters(ConversionService<?> conversionService) {\n super.registerDefaultConverters(conversionService);\n conversionService.addConverter(CharSequence.class, MediaType.class, charSequence -> {\n try {\n return MediaType.of(charSequence);\n } catch (IllegalArgumentException e) {\n return null;\n }\n });\n }\n}\n```\n\n### References\n\nCommit that introduced the vulnerability https://github.com/micronaut-projects/micronaut-core/commit/b8ec32c311689667c69ae7d9f9c3b3a8abc96fe3\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* Open an issue in [Micronaut Core](https://github.com/micronaut-projects/micronaut-core/issues)\n* Email us at [info@micronaut.io](mailto:info@micronaut.io)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "io.micronaut:micronaut-http"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.2.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/micronaut-projects/micronaut-core/security/advisories/GHSA-2457-2263-mm9f"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21700"
}, {
"type" : "WEB",
"url" : "https://github.com/micronaut-projects/micronaut-core/commit/b8ec32c311689667c69ae7d9f9c3b3a8abc96fe3"
}, {
"type" : "WEB",
"url" : "https://github.com/micronaut-projects/micronaut-core"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-01-19T19:56:29Z",
"nvd_published_at" : "2022-01-18T23:15:00Z"
}
}