Skip to content

Scrapy's redirects ignoring scheme-specific proxy settings

Moderate severity GitHub Reviewed Published May 14, 2024 in scrapy/scrapy • Updated May 14, 2024

Package

pip Scrapy (pip)

Affected versions

< 2.11.2

Patched versions

2.11.2

Description

Impact

When using system proxy settings, which are scheme-specific (i.e. specific to http:// or https:// URLs), Scrapy was not accounting for scheme changes during redirects.

For example, an HTTP request would use the proxy configured for HTTP and, when redirected to an HTTPS URL, the new HTTPS request would still use the proxy configured for HTTP instead of switching to the proxy configured for HTTPS. Same the other way around.

If you have different proxy configurations for HTTP and HTTPS in your system for security reasons (e.g., maybe you don’t want one of your proxy providers to be aware of the URLs that you visit with the other one), this would be a security issue.

Patches

Upgrade to Scrapy 2.11.2.

Workarounds

Replace the built-in retry middlewares (RedirectMiddleware and MetaRefreshMiddleware) and the HttpProxyMiddleware middleware with custom ones that implement the fix from Scrapy 2.11.2, and verify that they work as intended.

References

This security issue was reported by @redapple at scrapy/scrapy#767.

References

@Gallaecio Gallaecio published to scrapy/scrapy May 14, 2024
Published to the GitHub Advisory Database May 14, 2024
Reviewed May 14, 2024
Last updated May 14, 2024

Severity

Moderate
4.3
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N

Weaknesses

No CWEs

CVE ID

No known CVE

GHSA ID

GHSA-jm3v-qxmh-hxwv

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.