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

🚨 [security] [ruby] Upgrade puma: 3.12.4 → 4.3.12 (major) #5

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

Conversation

depfu-dev-halfbyte[bot]
Copy link


Welcome to Depfu 👋

This is one of the first three pull requests with dependency updates we've sent your way. We tried to start with a few easy patch-level updates. Hopefully your tests will pass and you can merge this pull request without too much risk. This should give you an idea how Depfu works in general.

After you merge your first pull request, we'll send you a few more. We'll never open more than seven PRs at the same time so you're not getting overwhelmed with updates.

Let us know if you have any questions. Thanks so much for giving Depfu a try!



🚨 Your current dependencies have known security vulnerabilities 🚨

This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!


Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ puma (3.12.4 → 4.3.12) · Repo · Changelog

Security Advisories 🚨

🚨 HTTP Request Smuggling in puma

Impact

When using Puma behind a proxy that does not properly validate that the
incoming HTTP request matches the RFC7230 standard, Puma and the frontend
proxy may disagree on where a request starts and ends. This would allow
requests to be smuggled via the front-end proxy to Puma.

The following vulnerabilities are addressed by this advisory:

  • Lenient parsing of Transfer-Encoding headers, when unsupported encodings
    should be rejected and the final encoding must be chunked.
  • Lenient parsing of malformed Content-Length headers and chunk sizes, when
    only digits and hex digits should be allowed.
  • Lenient parsing of duplicate Content-Length headers, when they should be
    rejected.
  • Lenient parsing of the ending of chunked segments, when they should end
    with \r\n.

Patches

The vulnerability has been fixed in 5.6.4 and 4.3.12.

Workarounds

When deploying a proxy in front of Puma, turning on any and all functionality
to make sure that the request matches the RFC7230 standard.

These proxy servers are known to have "good" behavior re: this standard and
upgrading Puma may not be necessary. Users are encouraged to validate for
themselves.

  • Nginx (latest)
  • Apache (latest)
  • Haproxy 2.5+
  • Caddy (latest)
  • Traefik (latest)

References

HTTP Request Smuggling

🚨 Information Exposure with Puma when used with Rails

Impact

Prior to puma version 5.6.2, puma may not always call
close on the response body. Rails, prior to version 7.0.2.2, depended on the
response body being closed in order for its CurrentAttributes implementation to
work correctly.

From Rails:

Under certain circumstances response bodies will not be closed, for example
a bug in a webserver[1] or a bug in a Rack middleware. In the event a
response is not notified of a close, ActionDispatch::Executor will not know
to reset thread local state for the next request. This can lead to data
being leaked to subsequent requests, especially when interacting with
ActiveSupport::CurrentAttributes.

The combination of these two behaviors (Puma not closing the body + Rails'
Executor implementation) causes information leakage.

Patches

This problem is fixed in Puma versions 5.6.2 and 4.3.11.

This problem is fixed in Rails versions 7.02.2, 6.1.4.6, 6.0.4.6, and 5.2.6.2.

See: GHSA-wh98-p28r-vrc9
for details about the rails vulnerability

Upgrading to a patched Rails or Puma version fixes the vulnerability.

Workarounds

Upgrade to Rails versions 7.0.2.2, 6.1.4.6, 6.0.4.6, and 5.2.6.2.

The Rails CVE
includes a middleware that can be used instead.

🚨 Inconsistent Interpretation of HTTP Requests ('HTTP Request Smuggling') in puma

Impact

Prior to puma version 5.5.0, using puma with a proxy which forwards LF characters as line endings could allow HTTP request smuggling. A client could smuggle a request through a proxy, causing the proxy to send a response back to another unknown client.

This behavior (forwarding LF characters as line endings) is very uncommon amongst proxy servers, so we have graded the impact here as "low". Puma is only aware of a single proxy server which has this behavior.

If the proxy uses persistent connections and the client adds another request in via HTTP pipelining, the proxy may mistake it as the first request's body. Puma, however, would see it as two requests, and when processing the second request, send back a response that the proxy does not expect. If the proxy has reused the persistent connection to Puma to send another request for a different client, the second response from the first client will be sent to the second client.

Patches

This vulnerability was patched in Puma 5.5.1 and 4.3.9.

Workarounds

This vulnerability only affects Puma installations without any proxy in front.

Use a proxy which does not forward LF characters as line endings.

Proxies which do not forward LF characters as line endings:

  • Nginx
  • Apache (>2.4.25)
  • Haproxy
  • Caddy
  • Traefik

Possible Breakage

If you are dealing with legacy clients that want to send LF as a line ending in an HTTP header, this will cause those clients to receive a 400 error.

References

🚨 Keepalive Connections Causing Denial Of Service in puma

Impact

The fix for CVE-2019-16770 was incomplete. The original fix only protected
existing connections that had already been accepted from having their
requests starved by greedy persistent-connections saturating all threads in
the same process. However, new connections may still be starved by greedy
persistent-connections saturating all threads in all processes in the
cluster.

A puma server which received more concurrent keep-alive connections than the
server had threads in its threadpool would service only a subset of
connections, denying service to the unserved connections.

Patches

This problem has been fixed in puma 4.3.8 and 5.3.1.

Workarounds

Setting queue_requests false also fixes the issue. This is not advised when
using puma without a reverse proxy, such as nginx or apache, because you will
open yourself to slow client attacks (e.g. slowloris).

The fix is very small. A git patch is available here for those using
unsupported versions of Puma.

🚨 HTTP Smuggling via Transfer-Encoding Header in Puma

Impact

This is a similar but different vulnerability to the one patched in 3.12.5 and 4.3.4.

A client could smuggle a request through a proxy, causing the proxy to send a response
back to another unknown client.

If the proxy uses persistent connections and the client adds another request in via HTTP
pipelining, the proxy may mistake it as the first request's body. Puma, however,
would see it as two requests, and when processing the second request, send back
a response that the proxy does not expect. If the proxy has reused the persistent
connection to Puma to send another request for a different client, the second response
from the first client will be sent to the second client.

Patches

The problem has been fixed in Puma 3.12.6 and Puma 4.3.5.

🚨 HTTP Smuggling via Transfer-Encoding Header in Puma

Impact

By using an invalid transfer-encoding header, an attacker could
smuggle an HTTP response.

Patches

The problem has been fixed in Puma 3.12.5 and Puma 4.3.4.

🚨 HTTP Smuggling via Transfer-Encoding Header in Puma

Impact

By using an invalid transfer-encoding header, an attacker could
smuggle an HTTP response.

Patches

The problem has been fixed in Puma 3.12.5 and Puma 4.3.4.

🚨 HTTP Smuggling via Transfer-Encoding Header in Puma

Impact

This is a similar but different vulnerability to the one patched in 3.12.5 and 4.3.4.

A client could smuggle a request through a proxy, causing the proxy to send a response
back to another unknown client.

If the proxy uses persistent connections and the client adds another request in via HTTP
pipelining, the proxy may mistake it as the first request's body. Puma, however,
would see it as two requests, and when processing the second request, send back
a response that the proxy does not expect. If the proxy has reused the persistent
connection to Puma to send another request for a different client, the second response
from the first client will be sent to the second client.

Patches

The problem has been fixed in Puma 3.12.6 and Puma 4.3.5.

🚨 HTTP Response Splitting (Early Hints) in Puma

Impact

If an application using Puma allows untrusted input in an early-hints header,
an attacker can use a carriage return character to end the header and inject
malicious content, such as additional headers or an entirely new response body.
This vulnerability is known as HTTP Response
Splitting

While not an attack in itself, response splitting is a vector for several other
attacks, such as cross-site scripting (XSS).

This is related to CVE-2020-5247,
which fixed this vulnerability but only for regular responses.

Patches

This has been fixed in 4.3.3 and 3.12.4.

Workarounds

Users can not allow untrusted/user input in the Early Hints response header.

🚨 HTTP Response Splitting vulnerability in puma

If an application using Puma allows untrusted input in a response header,
an attacker can use newline characters (i.e. CR, LF) to end the header and
inject malicious content, such as additional headers or an entirely new
response body. This vulnerability is known as HTTP Response Splitting.

While not an attack in itself, response splitting is a vector for several
other attacks, such as cross-site scripting (XSS).

🚨 Keepalive thread overload/DoS in puma

A poorly-behaved client could use keepalive requests to monopolize
Puma's reactor and create a denial of service attack.

If more keepalive connections to Puma are opened than there are
threads available, additional connections will wait permanently if
the attacker sends requests frequently enough.

Release Notes

4.3.12

Security

4.3.11

4.3.10

Re-allows UTF-8 in HTTP header values

4.3.9

GHSA-48w2-rm65-62xx

4.3.8

  • Security
    • Close keepalive connections after the maximum number of fast inlined requests (#2625)

4.3.4 (from changelog)

Each patchlevel release contains a separate security fix. We recommend simply upgrading to 4.3.5/3.12.6.

  • Security

4.3.3 (from changelog)

  • Bugfixes
    • Fix: Fixes a problem where we weren't splitting headers correctly on newlines (#2132)
  • Security
    • Fix: Prevent HTTP Response splitting via CR in early hints. CVE-2020-5249.

4.3.1 (from changelog)

  • Security
    • Fix: a poorly-behaved client could use keepalive requests to monopolize Puma's reactor and create a denial of service attack. CVE-2019-16770.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.


👉 No CI detected

You don't seem to have any Continuous Integration service set up!

Without a service that will test the Depfu branches and pull requests, we can't inform you if incoming updates actually work with your app. We think that this degrades the service we're trying to provide down to a point where it is more or less meaningless.

This is fine if you just want to give Depfu a quick try. If you want to really let Depfu help you keep your app up-to-date, we recommend setting up a CI system:

* [Circle CI](https://circleci.com), [Semaphore ](https://semaphoreci.com) and [Github Actions](https://docs.github.com/actions) are all excellent options. * If you use something like Jenkins, make sure that you're using the Github integration correctly so that it reports status data back to Github. * If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with `depfu/`.

Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

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