HighCVE-2026-53505GHSA-76r4-252q-2fcfdraft, embargoed

CVE-2026-53505Unbounded generated image resizes enable remote memory/CPU exhaustion (DoS)

Thumbor resizes any fetched image to the exact WIDTHxHEIGHT in the URL with no ceiling on output pixels, so one unsigned /unsafe/ request can render 400 megapixels and exhaust the process.

thumbor/thumbor ·Python ·10.5k ★ ·Published 15 Aug 2026 ·6 min read

Embargoed draft. This advisory is still private on GitHub. Technical details below are published here for the record; the maintainers' advisory and any CVE ID will follow once the report is disclosed.

Thumbor, the Python service that renders an image from the geometry in a URL, resizes every fetched image to the exact WIDTHxHEIGHT it was asked for, upscaling included, and never bounds the pixel count of the result. In the default configuration a single unauthenticated request to /unsafe/ can therefore ask for a 400-megapixel render; the report behind GHSA-76r4-252q-2fcf measured roughly 1.5 GB of resident memory for one such request, against a ~57 MB baseline. The advisory is still a private draft and no patched release exists yet.

01Background: an on-demand resizer that trusts the URL

thumbor/thumbor is the reference implementation of the on-demand thumbnail server: fetch a source image, apply the geometry encoded in the URL path, hand the result back. The URL is the API, and the two numbers in /unsafe/500x300/photo.jpg are the entire resize instruction.

That endpoint is reachable without a signature out of the box. ALLOW_UNSAFE_URL defaults to True (thumbor/config.py:402-407), and the /unsafe/ handler takes the geometry straight from the path without verifying an HMAC (thumbor/handlers/imaging.py:67-72). Signing does not remove the exposure either: the report notes the issue is reachable whenever signed URLs can be produced with attacker-influenced dimensions, the same precondition the earlier proportion-filter fix acknowledged. That fix, which capped the proportion value in March 2026 to stop the same class of DoS, is tracked as CVE-2026-53505 / GHSA-phj3-59pf-cp83. It does not touch the WIDTHxHEIGHT resize path or the watermark filter.

Upscaling is intended behaviour. The only thing that clamps a target to the source size is the opt-in thumbor/filters/no_upscale.py filter, which confirms that rendering beyond the source dimensions is the default path. That path is unbounded.

02Root cause: MAX_PIXELS guards the input, nothing guards the output

The project already has a pixel ceiling, but it is the wrong one. MAX_PIXELS (default 75 MP) is installed as Pillow's Image.MAX_IMAGE_PIXELS in thumbor/engines/pil.py:82-90 and 105-109, so it only applies to Image.open(), the decoded source. A programmatic Image.resize() is not covered by that setting at all.

The dimensions themselves are parsed as plain integers. In thumbor/context.py:302-303 the width and height come from the URL through self.int_or_0(), which is int(value) with no upper bound:

self.width = "orig" if width == "orig" else self.int_or_0(width)

The caps that would have caught this, MAX_WIDTH and MAX_HEIGHT, whose docstrings promise to cover images "read or generated by thumbor", sit behind if conf.MAX_WIDTH and ... in thumbor/handlers/__init__.py:216-228. Both default to 0 in thumbor/config.py:40-51. A default install skips the guard entirely.

From there the number flows unchecked through the pipeline: _calculate_target_dimensions() assigns self.target_width = float(self.context.request.width) (thumbor/transformer.py:83-97), resize() calls self.engine.resize(self.target_width or 1, self.target_height or 1) (thumbor/transformer.py:345-354), and the Pillow engine finally runs size = (int(width), int(height)) followed by self.image.resize(size, resample) (thumbor/engines/pil.py:206-211). Four layers, no size check in any of them.

Scale. A 20000x20000 request is 400 MP, 5.3× the project's own 75 MP default, and is served with HTTP 200. Opening that same image with Pillow locally raises DecompressionBombError: the load-time guard the resize path steps around.

The watermark ratio path reaches the same sink

The watermark filter has its own route to the same missing invariant. Its w_ratio and h_ratio arguments (the fifth and sixth positional parameters) are matched by the argument regex (?:-?\d+)|none, then divided by 100 with no ceiling (float(w_ratio)/100.0), and calc_watermark_size() feeds the product straight into watermark_engine.resize(). A ratio of 3000 becomes 30×. A 1000×1000 primary image with a 50×50 watermark can produce a 30000x30000 intermediate before compositing. The report was verified on the 7.8.0 release and on current master, and a bounded reproduction under a 512 MiB process limit hit MemoryError at 10000x10000, without ever allocating the 900-megapixel raster.

03Proof of concept: three curls against a default instance

No authentication, no signature, no special loader. Any source image works. The file can be as small as 10×10:

$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" http://127.0.0.1:8888/unsafe/1000x1000/tiny.png
200 0.08s
$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" http://127.0.0.1:8888/unsafe/5000x5000/tiny.png
200 0.97s
$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" http://127.0.0.1:8888/unsafe/20000x20000/tiny.png
200 14.1s

After the last request the server's RSS sat at roughly 1.5 GB, up from a ~57 MB baseline, and the response was a valid 400 MP image. Cost scales linearly with the requested area: 50000x50000 (~10 GB) or 100000x100000 (~40 GB) exceed typical deployment memory and get the process OOM-killed. Concurrent requests multiply the effect.

A second, quieter variant uses the proportional form. With MAX_WIDTH and MAX_HEIGHT both set to 2000, /unsafe/20000x20000/ is correctly clamped to 2000x2000. But /unsafe/0x0:1x1000/2000x0/ on a 1000×1000 source still asks for 2000x2000000, and reached MemoryError under a 3 GB limit, because only the typed dimension is clamped. /unsafe/65500x0/ on a 1×65500 source produced a 33x2216416 output (491 MB peak RSS) the same way.

04Impact: unauthenticated remote denial of service

Any client that can reach the HTTP port can allocate attacker-chosen memory and burn CPU for the duration of a resize, with no credentials and no signed URL. At 400 MP the render takes seconds and gigabytes; at the sizes above it takes the worker down, and a handful of parallel requests is enough to keep it down.

Because thumbor is typically the front line in front of object storage, an outage is not limited to one image: every URL that has not been cached yet has to be rendered again, so the failure arrives exactly when traffic is highest. Deployments that protect the endpoint with a signature are only safe if the signer never signs attacker-controlled geometry.

05Affected versions

PackageAffectedPatched
thumbor (pip)<= 7.8.0none released

The watermark variant was reproduced on 7.8.0 and on master at the time of the report. The advisory GHSA-76r4-252q-2fcf is still a private draft with two comments, and the fix lives on a branch rather than a release. There is currently no version to upgrade to.

06Remediation: a pixel budget for generated images

The fix on branch advisory-fix-1 (private PR thumbor/thumbor-ghsa-76r4-252q-2fcf#1) adds MAX_OUTPUT_PIXELS, default 75 million, applied through one shared proportional calculation to every raster thumbor generates, and changes the MAX_WIDTH/MAX_HEIGHT defaults from 0 to 65500, the largest side libjpeg accepts.

Oversized requests are not rejected. They are reduced proportionally before the transform, as if the URL had asked for the smaller size, so fit-in, full-fit-in, no_upscale(), upscale(), the fill() canvas and /meta all continue to work from the reduced dimensions. The side limits also apply to sides thumbor calculates rather than reads: the proportional half of WIDTHx0, a fit-in result, a watermark sized from its ratios. The same budget covers watermark resizes, SVG rasterisation and the padding added by frame(), which is answered with HTTP 400 when it cannot shrink. The frames of an animated GIF or WebP share it.

Request (default config)BeforeAfter
/unsafe/20000x20000/200, 13.4 s, 1580 MB200, 8660×8660, 2.6 s, 339 MB
/unsafe/50000x50000/MemoryError under 4 GB200, 8660×8660, 2.3 s, 339 MB
/unsafe/20000000x1/200, 4.8 s, 1347 MB200, 65500×1, 0.02 s, 55 MB
watermark at 3000%MemoryError under 4 GB200, 8660×8660, 1.2 s, 921 MB

The limits bound the work of a request. They do not make it cheap: a request at the default budget still renders 75 MP, which is the 339 MB and 2.6 s above. Operators who expose /unsafe/ should lower MAX_OUTPUT_PIXELS, MAX_WIDTH and MAX_HEIGHT to the largest output they actually serve. Setting all three to 0 restores the old unlimited behaviour. The same limits apply to source images on load: an 800×70000 PNG source is now served as 749×65500, with crops and resizes starting from the reduced copy.

Until a release exists, the workaround is to set ALLOW_UNSAFE_URL = False and sign only URLs whose size, crop and filters are never attacker-controlled (/unsafe/ then answers HTTP 400). Setting MAX_WIDTH and MAX_HEIGHT alone is explicitly not sufficient. The proportional case above and the watermark ratio path both slip past them.

07References

AG
Arthur Gurunlian @Buggs777

Vulnerability researcher working on application security, reverse engineering and fuzzing. I find, verify and responsibly disclose bugs in widely used open-source software.