Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust crate hyper to 0.14 [SECURITY] - abandoned #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jun 6, 2022

Mend Renovate

This PR contains the following updates:

Package Type Update Change
hyper (source) dependencies minor 0.12 -> 0.14
hyper (source) dev-dependencies minor 0.12 -> 0.14

GitHub Vulnerability Alerts

CVE-2021-32715

Summary

hyper's HTTP/1 server code had a flaw that incorrectly parses and accepts requests with a Content-Length header with a prefixed plus sign, when it should have been rejected as illegal. This combined with an upstream HTTP proxy that doesn't parse such Content-Length headers, but forwards them, can result in "request smuggling" or "desync attacks".

Vulnerability

The flaw exists in all prior versions of hyper, if built with rustc v1.5.0 or newer.

Example:

GET / HTTP/1.1
Host: example.com
Content-Length: +3

abc

This request gets accepted and hyper reads the body as abc. The request should be rejected, according to RFC 7230, since the ABNF for Content-Length only allows for DIGITs. This is due to using the FromStr implementation for u64 in the standard library. By differing from the spec, it is possible to send requests like these to endpoints that have different HTTP implementations, with different interpretations of the payload semantics, and cause "desync attacks".

In this particular case, an upstream proxy would need to error when parsing the Content-Length, but not reject the request (swallowing its own error), and forwarding the request as-is with the Content-Length still included. Then the upstream proxy and hyper would disagree on the length of the request body. The combination of these factors would be extremely rare.

Read more about desync attacks: https://portswigger.net/research/http-desync-attacks-request-smuggling-reborn

Impact

To determine if vulnerable, all these things must be true:

  • Using hyper as an HTTP server. While the lenient decoder also exists in the client, a vulnerability does not exist around responses.
  • Using HTTP/1. The HTTP/2 code uses a stricter parser.
  • Using a vulnerable HTTP proxy upstream to hyper. If an upstream proxy correctly rejects the illegal Content-Length header, OR can parse the length with the plus sign, the desync attack cannot succeed.

Patches

We have released the following patch versions:

  • v0.14.10 (to be released when this advisor is published)

Workarounds

Besides upgrading hyper, you can take the following options:

  • Reject requests manually that contain a plus sign prefix in the Content-Length header.
  • Ensure any upstream proxy handles Content-Length headers with a plus sign prefix.

Credits

This issue was initially reported by Mattias Grenfeldt and Asta Olofsson.

CVE-2021-32714

Summary

hyper's HTTP server and client code had a flaw that could trigger an integer overflow when decoding chunk sizes that are too big. This allows possible data loss, or if combined with an upstream HTTP proxy that allows chunk sizes larger than hyper does, can result in "request smuggling" or "desync attacks".

Vulnerability

Example:

GET / HTTP/1.1
Host: example.com
Transfer-Encoding: chunked

f0000000000000003
abc
0

hyper only reads the rightmost 64-bit integer as the chunk size. So it reads f0000000000000003 as 3. A loss of data can occur since hyper would then read only 3 bytes of the body. Additionally, an HTTP request smuggling vulnerability would occur if using a proxy which instead has prefix truncation in the chunk size, or that understands larger than 64-bit chunk sizes.

Read more about desync attacks: https://portswigger.net/research/http-desync-attacks-request-smuggling-reborn

Impact

To determine if vulnerable to data loss, these things must be true:

  • Using HTTP/1.1. Since HTTP/2 does not use chunked encoding, it is not vulnerable.
  • Using hyper as a server or client. The body would be improperly truncated in either case.
  • Users send requests or responses with chunk sizes greater than 18 exabytes.

To determine if vulnerable to desync attacks, these things must be true:

  • Using an upstream proxy that allows chunks sizes larger than 64-bit. If the proxy rejects chunk sizes that are too large, that request won't be forwarded to hyper.

Patches

We have released the following patch versions:

  • v0.14.10 (to be released when this advisory is published)

Workarounds

Besides upgrading hyper, you can take the following options:

  • Reject requests manually that contain a Transfer-Encoding header.
  • Ensure any upstream proxy rejects Transfer-Encoding chunk sizes greater than what fits in 64-bit unsigned integers.

Credits

This issue was initially reported by Mattias Grenfeldt and Asta Olofsson.

GHSA-f67m-9j94-qv9j

Affected versions of this crate called mem::uninitialized() in the HTTP1 parser to create values of type httparse::Header (from the httparse crate).
This is unsound, since Header contains references and thus must be non-null.

The flaw was corrected by avoiding the use of mem::uninitialized(), using MaybeUninit instead.


Release Notes

hyperium/hyper

v0.14.25

Compare Source

Features
New Contributors

v0.14.24

Compare Source

Bug Fixes
  • body: set an internal max to reserve in to_bytes (4d89adce)
  • server: prevent sending 100-continue if user drops request body (#​3138) (92443d7e)
Features
  • http2: add http2_max_header_list_size to hyper::server::Builder (#​3006) (031425f0)
New Contributors

v0.14.23

Compare Source

Bug Fixes
  • http2: Fix race condition in client dispatcher (#​3041) (2f1c0b72, closes #​2419)
  • dependencies: Really fix compile-time feature for socket2 dependency.
New Contributors

v0.14.22

Compare Source

Bug Fixes

v0.14.21

Compare Source

Bug Fixes
  • client: send an error back to client when dispatch misbehaves () (9fa36382, closes #​2649)
  • http1: fix http1_header_read_timeout to use same future (#​2891) (c5a14e7c)
Features
  • http1: allow ignoring invalid header lines in requests (73dd4746)
  • server: add Server::tcp_keepalive_interval and Server::tcp_keepalive_retries (#​2991) (287d7124)
New Contributors

v0.14.20

Compare Source

Bug Fixes
Features
New Contributors

v0.14.19

Compare Source

Bug Fixes
  • http1: fix preserving header case without enabling ffi (#​2820) (6a35c175)
  • server: don't add implicit content-length to HEAD responses (#​2836) (67b73138)
Features
Breaking Changes
  • ffi (unstable):
    • hyper_clientconn_options_new no longer sets the http1_preserve_header_case connection option by default.
      Users should now call hyper_clientconn_options_set_preserve_header_case if they desire that functionality. (78de8914)

v0.14.18

Compare Source

Bug Fixes
  • ffi: don't build C libraries by default (1c663706)
Features

v0.14.17

Compare Source

Bug Fixes
Features

v0.14.16

Compare Source

Bug Fixes
Features
  • http2: add http2_max_send_buf_size option to client and server (bff977b7)
  • server: add HTTP/1 header read timeout option (#​2675) (842c6553, closes #​2457)

v0.14.15

Compare Source

Bug Fixes
  • client: cancel blocking DNS lookup if GaiFuture is dropped (174b553d
Features
  • http1: add http1_writev(bool) options to Client and Server builders, to allow forcing vectored writes (80627141)
  • upgrade: allow http upgrades with any body type (ab469eb3)

v0.14.14

Compare Source

Bug Fixes
  • client:
    • make ResponseFuture implement Sync (bd6c35b9)
    • remove ipv6 square brackets before resolving (910e0268)
Features
  • h2: always include original h2 error on broken pipe (6169db25)
  • server: Remove Send + Sync requirement for Body in with_graceful_shutdown (1d553e52)

v0.14.13

Compare Source

Bug Fixes
  • client: don't reuse a connection while still flushing (c88011da)
  • server: convert panic to error if Connection::without_shutdown called on HTTP/2 conn (ea3e2282)
Features
  • ffi: add hyper_request_set_uri_parts (a54689b9)
  • lib:
    • Export more things with Cargo features (server, !http1, !http2) (0a4b56ac)
    • Export rt module independently of Cargo features (cf6f62c7)

v0.14.12

Compare Source

Bug Fixes
  • ffi: on_informational callback had no headers (39b6d01a)
  • http1: apply header title case for consecutive dashes (#​2613) (684f2fa7)
  • http2: improve errors emitted by HTTP2 Upgraded stream shutdown (#​2622) (be08648e)
Features

v0.14.11

Compare Source

Bug Fixes
  • client: retry when pool checkout returns closed HTTP2 connection (#​2585) (52214f39)
  • http2:
Features
  • ffi: add hyper_request_on_informational (25d18c0b)

v0.14.10

Compare Source

Bug Fixes
  • http1:
    • reject content-lengths that have a plus sign prefix (06335158)
    • protect against overflow in chunked decoder (efd9a982)
Features
  • ffi: add option to get raw headers from response (8c89a8c1)

v0.14.9

Compare Source

Bug Fixes
  • http1: reduce memory used with flatten write strategy (eb0c6463)

v0.14.8

Compare Source

Features
Performance
  • http2: reduce amount of adaptive window pings as BDP stabilizes (#​2550) (4cd06bf2)

v0.14.7

Compare Source

Bug Fixes
  • http1: http1_title_case_headers should move Builder (a303b3c3)
Features
  • server: implement forgotten settings for case preserving (4fd6c4cb)

v0.14.6

Compare Source

Features

v0.14.5

Compare Source

Bug Fixes
Features

v0.14.4

Compare Source

Bug Fixes
  • build: Fix compile error when only http1 feature was enabled.

v0.14.3

Compare Source

Bug Fixes
  • client: HTTP/1 client "Transfer-Encoding" repair code would panic (#​2410) (2c8121f1, closes #​2409)
  • http1: fix server misinterpretting multiple Transfer-Encoding headers (8f93123e)
Features

v0.14.2

Compare Source

Features

v0.14.1

Compare Source

Bug Fixes
  • http1: fix preserving header case without enabling ffi (#​2820) (6a35c175)
  • server: don't add implicit content-length to HEAD responses (#​2836) (67b73138)
Features
Breaking Changes
  • ffi (unstable):
    • hyper_clientconn_options_new no longer sets the http1_preserve_header_case connection option by default.
      Users should now call hyper_clientconn_options_set_preserve_header_case if they desire that functionality. (78de8914)

v0.14.0

Compare Source

Bug Fixes
Features
Breaking Changes
  • hyper depends on tokio v1 and bytes v1.

  • Custom resolvers used with HttpConnector must change
    to resolving to an iterator of SocketAddrs instead of IpAddrs.
    (b4e24332)

  • hyper no longer emits log records automatically.
    If you need hyper to integrate with a log logger (as opposed to tracing),
    you can add tracing = { version = "0.1", features = ["log"] } to activate them.
    (db32e105)

  • Removed http1_writev methods from client::Builder,
    client::conn::Builder, server::Builder, and server::conn::Builder.

    Vectored writes are now enabled based on whether the AsyncWrite
    implementation in use supports them, rather than though adaptive
    detection. To explicitly disable vectored writes, users may wrap the IO
    in a newtype that implements AsyncRead and AsyncWrite and returns
    false from its AsyncWrite::is_write_vectored method.
    (d6aadb83)

  • The method Body::on_upgrade() is gone. It is
    essentially replaced with hyper::upgrade::on(msg).
    (121c3313)

  • All optional features have been disabled by default.
    (ed2b22a7)

  • The HTTP server code is now an optional feature. To
    enable the server, add features = ["server"] to the dependency in
    your Cargo.toml.
    (bdb5e5d6)

  • The HTTP client of hyper is now an optional feature. To
    enable the client, add features = ["client"] to the dependency in
    your Cargo.toml.
    (4e55583d)

  • This puts all HTTP/1 methods and support behind an
    http1 cargo feature, which will not be enabled by default. To use
    HTTP/1, add features = ["http1"] to the hyper dependency in your
    Cargo.toml.

(2a19ab74)

  • This puts all HTTP/2 methods and support behind an
    http2 cargo feature, which will not be enabled by default. To use
    HTTP/2, add features = ["http2"] to the hyper dependency in your
    Cargo.toml.

(b819b428)

v0.13.9 (2020-11-02)
Bug Fixes
Features
  • client:
    • add HttpConnector::set_local_addresses to set both IPv6 and IPv4 local addrs ( (fb19f3a8)
    • Add accessors to Connected fields (#​2290) (2dc9768d)
v0.13.8 (2020-09-18)
Bug Fixes
Features
v0.13.7 (2020-07-13)
Bug Fixes
  • client: don't panic in DNS resolution when task cancelled (#​2229) (0d0d3635)
Features
  • client: impl tower_service::Service for &Client (#​2089) (77c3b5bc)
  • http2: configure HTTP/2 frame size in the high-level builders too (#​2214) (2354a7ee)
  • lib: Move from log to tracing in a backwards-compatible way (#​2204) (9832aef9)
v0.13.6 (2020-05-29)
Features
  • body: remove Sync bound for Body::wrap_stream (042c7706)
  • http2: allow configuring the HTTP/2 frame size (b6446456)
v0.13.5 (2020-04-17)
Bug Fixes
  • server: fix panic in Connection::graceful_shutdown (fce3ddce)
v0.13.4 (2020-03-20)
Bug Fixes
  • http1: try to drain connection buffer if user drops Body (d838d54f)
Features
  • http2: add HTTP2 keep-alive support for client and server (9a8413d9)
v0.13.3 (2020-03-03)
Features
v0.13.2 (2020-01-29)
Bug Fixes
  • body: return exactly 0 SizeHint for empty body (#​2122) (dc882047)
  • client: strip path from Uri before calling Connector (#​2109) (ba2a144f)
  • http1:
  • http2: don't add client content-length if method doesn't require it (fb90d30c)
Features
  • service: Implement Clone/Copy on ServiceFn and MakeServiceFn (#​2104) (a5720fab)
v0.13.1 (2019-12-13)
Bug Fixes
  • http1: fix response with non-chunked transfer-encoding to be close-delimited (cb71d2cd, closes #​2058)
Features
  • body: implement HttpBody for Request and Response (4b6099c7, closes #​2067)
  • client: expose hyper::client::connect::Connect trait alias (2553ea1a)

v0.13.10

Compare Source

Bug Fixes

v0.13.9

Compare Source

Bug Fixes
Features
  • client:
    • add HttpConnector::set_local_addresses to set both IPv6 and IPv4 local addrs ( (fb19f3a8)
    • Add accessors to Connected fields (#​2290) (2dc9768d)

v0.13.8

Compare Source

Bug Fixes
Features

v0.13.7

Compare Source

Bug Fixes
  • client: don't panic in DNS resolution when task cancelled (#​2229) (0d0d3635)
Features
  • client: impl tower_service::Service for &Client (#​2089) (77c3b5bc)
  • http2: configure HTTP/2 frame size in the high-level builders too (#​2214) (2354a7ee)
  • lib: Move from log to tracing in a backwards-compatible way (#​2204) (9832aef9)

v0.13.6

Compare Source

Features
  • body: remove Sync bound for Body::wrap_stream (042c7706)
  • http2: allow configuring the HTTP/2 frame size (b6446456)

v0.13.5

Compare Source

Bug Fixes
  • server: fix panic in Connection::graceful_shutdown (fce3ddce)

v0.13.4

Compare Source

Bug Fixes
  • http1: try to drain connection buffer if user drops Body (d838d54f)
Features
  • http2: add HTTP2 keep-alive support for client and server (9a8413d9)

v0.13.3

Compare Source

Features

v0.13.2

Compare Source

Bug Fixes
  • body: return exactly 0 SizeHint for empty body (#​2122) (dc882047)
  • client: strip path from Uri before calling Connector (#​2109) (ba2a144f)
  • http1:
  • http2: don't add client content-length if method doesn't require it (fb90d30c)
Features
  • service: Implement Clone/Copy on ServiceFn and MakeServiceFn (#​2104) (a5720fab)

v0.13.1

Compare Source

Bug Fixes
  • http1: fix response with non-chunked transfer-encoding to be close-delimited (cb71d2cd, closes #​2058)
Features
  • body: implement HttpBody for Request and Response (4b6099c7, closes #​2067)
  • client: expose hyper::client::connect::Connect trait alias (2553ea1a)

v0.13.0

Compare Source

Bug Fixes
  • client:
    • fix polling dispatch channel after it has closed (039281b8)
    • fix panic from unreachable code (e6027bc0)
  • dependencies: require correct bytes minimum version (#​1975) (536b1e18)
  • server:
Features
  • body:
    • change Sender::send_data to an async fn. (62a96c07)
    • require Sync when wrapping a dynamic Stream (44413721)
    • add body::aggregate and body::to_bytes functions (8ba9a8d2)
    • replace Chunk type with Bytes (5a598757, closes #​1931)
    • replace the Payload trait with HttpBody (c63728eb)
  • client:
    • impl tower_service::Service for Client (edbd10ac)
    • provide tower::Service support for clients (#​1915) (eee2a728)
    • change connectors to return an impl Connection (4d7a2266)
    • remove Destination for http::Uri in connectors (319e8aee)
    • filter remote IP addresses by family of given local IP address (131962c8)
    • change Resolve to be Service<Name> (9d9233ce, closes #​1903)
    • change Connect trait into an alias for Service (d67e49f1, closes #​1902)
    • change GaiResolver to use a global blocking threadpool (049b5132)
    • Add connect timeout to HttpConnector (#​1972) (4179297a)
  • lib:
    • update to std::future::Future (8f4b05ae)
    • add optional tcp feature, split from runtime (5b348b82)
    • make Stream trait usage optional behind the stream feature, enabled by default (0b03b730, closes #​2034)
    • update Tokio, bytes, http, h2, and http-body (cb3f39c2)
  • rt: introduce rt::Executor trait (6ae5889f, closes #​1944)
  • server:
    • introduce Accept trait (b3e55062)
    • give Server::local_addr a more general type (3cc93e79)
    • change http1_half_close option default to disabled (7e31fd88)
  • service:
    • use tower_service::Service for hyper::service (ec520d56)
    • rename Service to HttpService, re-export tower::Service (4f274399, closes #​1959)
Breaking Changes
  • All usage of async traits (Future, Stream,
    AsyncRead, AsyncWrite, etc) are updated to newer versions.

(8f4b05ae)

  • All usage of hyper::Chunk should be replaced with
    bytes::Bytes (or hyper::body::Bytes).

(5a598757)

  • Using a Body as a Stream, and constructing one via
    Body::wrap_stream, require enabling the stream feature.

(511ea388)

  • Calls to GaiResolver::new and HttpConnector::new no
    longer should pass an integer argument for the number of threads.

(049b5132)

  • Connectors no longer return a tuple of
    (T, Connected), but a single T: Connection.

(4d7a2266)

  • All usage of `hyper::c

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate
Copy link
Contributor Author

renovate bot commented Mar 22, 2023

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@renovate renovate bot changed the title Update Rust crate hyper to 0.14 [SECURITY] Update Rust crate hyper to 0.14 [SECURITY] - abandoned Feb 3, 2024
Copy link
Contributor Author

renovate bot commented Feb 3, 2024

Autoclosing Skipped

This PR has been flagged for autoclosing. However, it is being skipped due to the branch being already modified. Please close/delete it manually or report a bug if you think this is in error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants