Skip to content
DoS Disclosed report Intermediate CVE-2024-3572

Scrapy decompression bomb vulnerability

Scrapy enforced download size limits only on compressed response bodies, not on decompressed data. A malicious website could send a small compressed response that expands to exhaust memory and disk.

scrapy/scrapy

Originally disclosed on huntr

Impact

Scrapy limits allowed response sizes by default through the DOWNLOAD_MAXSIZE and DOWNLOAD_WARNSIZE settings.

However, those limits were only being enforced during the download of the raw, usually-compressed response bodies, and not during decompression, making Scrapy vulnerable to decompression bombs.

A malicious website being scraped could send a small response that, on decompression, could exhaust the memory available to the Scrapy process, potentially affecting any other process sharing that memory, and affecting disk usage in case of uncompressed response caching.

Patches

Upgrade to Scrapy 2.11.1.

If you are using Scrapy 1.8 or a lower version, and upgrading to Scrapy 2.11.1 is not an option, you may upgrade to Scrapy 1.8.4 instead.

Workarounds

There is no easy workaround.

Disabling HTTP decompression altogether is impractical, as HTTP compression is a rather common practice.

However, it is technically possible to manually backport the 2.11.1 or 1.8.4 fix, replacing the corresponding components of an unpatched version of Scrapy with patched versions copied into your own code.

Acknowledgements

This security issue was reported by @dmandefy through huntr.com.

From the GitHub Advisory Database (GHSA-7j7m-v7m3-jqm7, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

A malicious website could cause memory exhaustion in the Scrapy process, potentially affecting other processes sharing that memory, and could increase disk usage if uncompressed responses are cached.

What the attacker needed

Scrapy scrapes a malicious website; Website sends compressed response

The fix

The issue was fixed in Scrapy 2.11.1 (and 1.8.4 for older versions) by enforcing size limits during decompression.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a website sends data compressed to save bandwidth, the receiving program must decompress it. Scrapy checked the size of the compressed data but not the size after decompression, so a tiny compressed file could expand into a huge amount of data and use up all the computer's memory.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More from scrapy/scrapy

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.