GHSA-66q9-f7ff-mmx6

Suggest an improvement
Source
https://github.com/advisories/GHSA-66q9-f7ff-mmx6
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/03/GHSA-66q9-f7ff-mmx6/GHSA-66q9-f7ff-mmx6.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-66q9-f7ff-mmx6
Aliases
Published
2020-03-25T17:35:51Z
Modified
2023-11-08T04:03:53.939487Z
Severity
  • 7.6 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N CVSS Calculator
Summary
Local file inclusion vulnerability in http4s
Details

Impact

This vulnerability applies to all users of: * org.http4s.server.staticcontent.FileService * org.http4s.server.staticcontent.ResourceService * org.http4s.server.staticcontent.WebjarService

Path escaping

URI normalization is applied incorrectly. Requests whose path info contain ../ or // can expose resources outside of the configured location. Specifically:

  • FileService may expose any file on the local file system.
  • ResourceService may 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.

Patches

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.

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, and WebjarService.scala from 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: * Ross A. Baker

Database specific
{
    "nvd_published_at": null,
    "github_reviewed_at": "2020-03-25T17:34:45Z",
    "severity": "CRITICAL",
    "github_reviewed": true,
    "cwe_ids": [
        "CWE-23"
    ]
}
References

Affected packages

Maven / org.http4s:http4s-server_2.12

Package

Name
org.http4s:http4s-server_2.12
View open source insights on deps.dev
Purl
pkg:maven/org.http4s/http4s-server_2.12

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.18.26

Affected versions

0.*

0.10.0-M10
0.15.0
0.15.0a
0.15.1
0.15.1a
0.15.2
0.15.2a
0.15.3
0.15.3a
0.15.4
0.15.4a
0.15.5
0.15.5a
0.15.6
0.15.6a
0.15.7
0.15.7a
0.15.8
0.15.8a
0.15.9
0.15.9a
0.15.10
0.15.10a
0.15.11
0.15.11a
0.15.12
0.15.12a
0.15.13
0.15.13a
0.15.14
0.15.14a
0.15.15
0.15.15a
0.15.16
0.15.16a
0.16.0-M1
0.16.0-M2
0.16.0-M3
0.16.0-RC1
0.16.0-RC2
0.16.0-RC3
0.16.0
0.16.0a-M1
0.16.0a-M2
0.16.0a-M3
0.16.0a-RC1
0.16.0a-RC2
0.16.0a-RC3
0.16.0a
0.16.1
0.16.1a
0.16.2
0.16.2a
0.16.3
0.16.3a
0.16.4
0.16.4a
0.16.5
0.16.5a
0.16.6
0.16.6a
0.17.0-M1
0.17.0-M2
0.17.0-M3
0.17.0-RC1
0.17.0-RC2
0.17.0-RC3
0.17.0
0.17.1
0.17.2
0.17.3
0.17.4
0.17.5
0.17.6
0.18.0-M1
0.18.0-M2
0.18.0-M3
0.18.0-M4
0.18.0-M5
0.18.0-M6
0.18.0-M7
0.18.0-M8
0.18.0-M9
0.18.0
0.18.1
0.18.2
0.18.3
0.18.4
0.18.5
0.18.6
0.18.7
0.18.8
0.18.9
0.18.10
0.18.11
0.18.12
0.18.13
0.18.14
0.18.15
0.18.16
0.18.17
0.18.18
0.18.19
0.18.20
0.18.21
0.18.22
0.18.23
0.18.24
0.18.25

Maven / org.http4s:http4s-server_2.12

Package

Name
org.http4s:http4s-server_2.12
View open source insights on deps.dev
Purl
pkg:maven/org.http4s/http4s-server_2.12

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0.19.0
Fixed
0.20.20

Affected versions

0.*

0.19.0
0.20.0-M1
0.20.0-M2
0.20.0-M3
0.20.0-M4
0.20.0-M5
0.20.0-M6
0.20.0-M7
0.20.0-RC1
0.20.0
0.20.1
0.20.2
0.20.3
0.20.4
0.20.5
0.20.6
0.20.7
0.20.8
0.20.9
0.20.10
0.20.11
0.20.12
0.20.13
0.20.14
0.20.15
0.20.16
0.20.17
0.20.18
0.20.19

Maven / org.http4s:http4s-server_2.12

Package

Name
org.http4s:http4s-server_2.12
View open source insights on deps.dev
Purl
pkg:maven/org.http4s/http4s-server_2.12

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0.21.0
Fixed
0.21.2

Affected versions

0.*

0.21.0
0.21.1