Summary
Local file inclusion vulnerability in http4s
Path escaping
URI normalization is applied incorrectly. Requests whose path info contain ../ or // can expose resources outside of the configured location. Specifically:
FileServicemay expose any file on the local file system.ResourceServicemay expose any resource on the class path.
Prefix matching
When 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.
URI decoding
URI 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.
Workarounds
The recommended course is to upgrade:
- v0.18.26, binary compatible with the 0.18.x series
- v0.20.20, binary compatible with the 0.20.x series
- v0.21.2, binary compatible with the 0.21.x series
Note that 0.19.0 is a deprecated release and has never been supported.
If an upgrade is impossible:
- Temporarily copy
FileService.scala,ResourceService.scala, andWebjarService.scalafrom the appropriate release series into your project and recompile with that, changing the package name and reference in your application. - Users of a servlet backend can use the servlet container's file serving capabilities.
Credits
Thank you to Thomas Gøytil for the discovery, responsible disclosure, and assistance testing of this vulnerability.
For more information
If you have any questions or comments about this advisory:
- Open an issue in http4s/http4s
- Email a maintainer:
Impact
This vulnerability applies to all users of:
org.http4s.server.staticcontent.FileServiceorg.http4s.server.staticcontent.ResourceServiceorg.http4s.server.staticcontent.WebjarService
CVE-2020-5280 has a CVSS score of 7.6 (Critical). The vector is network-reachable, low privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.18.26, 0.20.20, 0.21.2); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
In 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. A middleware that does so at the server level may be considered if there is demand.
If pathInfo is non-empty, and does not begin with /, then a 404 response is generated. This fixes the prefix matching exposure.
All 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.
Frequently Asked Questions
- What is CVE-2020-5280? CVE-2020-5280 is a critical-severity security vulnerability in org.http4s:http4s-server_2.12 (maven), affecting versions < 0.18.26. It is fixed in 0.18.26, 0.20.20, 0.21.2.
- How severe is CVE-2020-5280? CVE-2020-5280 has a CVSS score of 7.6 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of org.http4s:http4s-server_2.12 are affected by CVE-2020-5280? org.http4s:http4s-server_2.12 (maven) versions < 0.18.26 is affected.
- Is there a fix for CVE-2020-5280? Yes. CVE-2020-5280 is fixed in 0.18.26, 0.20.20, 0.21.2. Upgrade to this version or later.
- Is CVE-2020-5280 exploitable, and should I be worried? Whether CVE-2020-5280 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2020-5280 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2020-5280?
- Upgrade
org.http4s:http4s-server_2.12to 0.18.26 or later - Upgrade
org.http4s:http4s-server_2.12to 0.20.20 or later - Upgrade
org.http4s:http4s-server_2.12to 0.21.2 or later
- Upgrade