CVE-2020-5280: Http4s server 2.12 Local File Inclusion Vulnerability Vulnerability
CRITICALCVE-2020-5280 is a CRITICAL (CVSS 7.6) local file inclusion vulnerability vulnerability (CWE-23: Relative Path Traversal) affecting Http4s server 2.12 libraries in the Maven ecosystem. The issue involves local file inclusion vulnerability in http4s. Remediation is available by upgrading affected packages to version 0.18.26, 0.20.20, 0.21.2.
CVE-2020-5280 at a Glance
Security Impact
CVSS: 7.6
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N).
How to Fix CVE-2020-5280
To remediate this vulnerability, upgrade all affected Http4s server 2.12 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>org.http4s</groupId>
<artifactId>http4s-server_2.12</artifactId>
<version>0.18.26</version>
</dependency>
<dependency>
<groupId>org.http4s</groupId>
<artifactId>http4s-server_2.12</artifactId>
<version>0.20.20</version>
</dependency>
<dependency>
<groupId>org.http4s</groupId>
<artifactId>http4s-server_2.12</artifactId>
<version>0.21.2</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.http4s
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2020-5280, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.http4s
Analyze the terminal output to locate any version of Http4s server 2.12 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.18.26), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.http4s 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-23: Relative Path Traversal, where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory. In Http4s server 2.12, 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-2020-5280 Affected Http4s server 2.12 Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.http4s:http4s-server_2.12
|
Maven |
< 0.18.26
|
0.18.26
|
|
org.http4s:http4s-server_2.12
|
Maven |
≥ 0.19.0
< 0.20.20
|
0.20.20
|
|
org.http4s:http4s-server_2.12
|
Maven |
≥ 0.21.0
< 0.21.2
|
0.21.2
|
References
Frequently Asked Questions
What is CVE-2020-5280?
Which Http4s server 2.12 versions are affected?
What version fixes CVE-2020-5280?
Is http4s-server_2.12 affected?
What is the CVSS score of CVE-2020-5280?
What CWE is associated with CVE-2020-5280?
How can I check Maven dependencies for CVE-2020-5280?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-66q9-f7ff-mmx6",
"modified" : "2021-01-14T17:48:17Z",
"published" : "2020-03-25T17:35:51Z",
"aliases" : [ "CVE-2020-5280" ],
"summary" : "Local file inclusion vulnerability in http4s",
"details" : "### Impact\n\nThis vulnerability applies to all users of:\n* `org.http4s.server.staticcontent.FileService`\n* `org.http4s.server.staticcontent.ResourceService`\n* `org.http4s.server.staticcontent.WebjarService`\n\n#### Path escaping\n\nURI normalization is applied incorrectly. Requests whose path info contain `../` or `//` can expose resources outside of the configured location. Specifically:\n\n* `FileService` may expose any file on the local file system.\n* `ResourceService` may expose any resource on the class path.\n\n#### Prefix matching\n\nWhen the service is configured with a non-empty `pathPrefix` that doesn't end in a slash, any directories whose names are a prefix of `systemPath` (from `FileService`) or `pathPrefix` (from `ResourceService`) are exposed. For example, if `pathPrefix` is `/foo` and `systemPath` is `/bar`, a request to `/foobaz/quux.txt` exposes file `/barbaz/quux.txt`, when only files beneath `/bar` should be available.\n\n#### URI decoding\n\nURI segments are not decoded before resource resolution. This causes resources with reserved characters in their name to incorrectly return a 404. It also may incorrectly expose the rare resource whose name is URI encoded. This applies to `FileService`, `ResourceService`, and `WebjarService`.\n\n### Patches\n\nIn all three services, paths with an empty segment, a `.` segment, or a `..` segment are now rejected with a `400 Bad Request` response. This fixes exposure outside the configured root. Many clients already eliminate dot segments according to the rules in [RFC3986, Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). A middleware that does so at the server level may be considered if there is demand.\n\nIf `pathInfo` is non-empty, and does not begin with `/`, then a 404 response is generated. This fixes the prefix matching exposure.\n\nAll path segments are URI decoded before being passed to the file system or resource path. This allows resolution of resources with reserved characters in the name, and prevents incorrect exposure of resources whose names are themselves URI encoded.\n\n### Workarounds\n\nThe recommended course is to upgrade:\n* v0.18.26, binary compatible with the 0.18.x series\n* v0.20.20, binary compatible with the 0.20.x series\n* v0.21.2, binary compatible with the 0.21.x series\n\nNote that 0.19.0 is a deprecated release and has never been supported.\n\nIf an upgrade is impossible:\n\n* Temporarily copy `FileService.scala`, `ResourceService.scala`, and `WebjarService.scala` from the appropriate release series into your project and recompile with that, changing the package name and reference in your application.\n* Users of a servlet backend can use the servlet container's file serving capabilities.\n\n### Credits\n\nThank you to Thomas Gøytil for the discovery, responsible disclosure, and assistance testing of this vulnerability.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [http4s/http4s](http://github.com/http4s/http4s)\n* Email a maintainer:\n * [Ross A. Baker](mailto:ross@rossabaker.com)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.http4s:http4s-server_2.12"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.18.26"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.http4s:http4s-server_2.12"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.19.0"
}, {
"fixed" : "0.20.20"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.http4s:http4s-server_2.12"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.21.0"
}, {
"fixed" : "0.21.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/http4s/http4s/security/advisories/GHSA-66q9-f7ff-mmx6"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5280"
}, {
"type" : "WEB",
"url" : "https://github.com/http4s/http4s/commit/250afddbb2e65b70ca9ddaec9d1eb3aaa56de7ec"
}, {
"type" : "WEB",
"url" : "https://github.com/http4s/http4s/commit/752b3f63a05a31d2de4f8706877aa08d6b89efca"
}, {
"type" : "WEB",
"url" : "https://github.com/http4s/http4s/commit/b87f31b2292dabe667bec3b04ce66176c8a3e17b"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-23" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2020-03-25T17:34:45Z",
"nvd_published_at" : null
}
}