ModerateGHSA-33r8-5m8h-7mmxdraft, embargoed

GHSA-33r8-5m8h-7mmxUnbounded convolution kernel size: remote unauthenticated CPU exhaustion (DoS) in default configuration

Thumbor's convolution filter accepts a kernel matrix of any length, so an unauthenticated request to /unsafe/ can pin the Tornado IOLoop for tens of seconds to minutes and stall the whole service.

thumbor/thumbor ·Python ·10.5k ★ ·Published 15 Aug 2026 ·5 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's convolution filter applies a user-supplied kernel matrix to every pixel of the requested image, and nothing in the parser, the native extension or the HTTP layer bounds the length of that matrix. A remote, unauthenticated request to /unsafe/ can therefore ask for an arbitrarily large kernel and keep the server's CPU busy for tens of seconds to minutes, tracked as GHSA-33r8-5m8h-7mmx in thumbor/thumbor. Because the filter runs synchronously on the Tornado IOLoop, one such request stalls every other connection, health checks included.

01Background: image filters on the request path

Thumbor is a Python imaging service that turns a URL into a resized, filtered image. Filters are appended to the URL path and executed in order, for example /unsafe/300x200/filters:brightness(10)/image.jpg. In the default configuration the /unsafe/ prefix means no signature is required, so anyone who can reach the service can choose the filter chain.

The convolution filter is the most expensive of them: it takes a kernel as a semicolon-separated list of numbers plus a row count, and multiplies that matrix against a neighbourhood of every pixel. Work therefore scales with image area times kernel area, and the kernel is entirely client-controlled.

02Root cause: a linear regex where a length check was needed

The filter is declared in thumbor/filters/convolution.py (lines 22 to 26). Its argument pattern was rewritten during the March 2026 security round so the regex no longer backtracks catastrophically. The pattern still accepts an unlimited number of matrix elements. So does columns, typed PositiveNonZeroNumber, an unbounded positive integer (thumbor/filters/__init__.py:132).

@filter_method(r"-?\d+(?:\.\d*)?(?:;-?\d+(?:\.\d*)?)*", BaseFilter.PositiveNonZeroNumber, BaseFilter.Boolean)

The native extension repeats the omission. In thumbor/ext/filters/_convolution.c:50-58 the kernel size is taken straight from the tuple, and the only guard in that block is the columns_count <= 0 check that the divide-by-zero fix introduced:

kernel_size = PyTuple_Size(kernel_tuple);

From there the per-pixel loops at _convolution.c:82-111 do the work the caller asked for. Total cost is W × H × (rows × cols), or W*H*N with N unbounded.

The March 2026 round fixed two denial-of-service variants of this same filter: catastrophic backtracking in the argument regex, and a divide-by-zero when columns=0. Neither fix capped the matrix length. The remaining unbounded resource is the element count itself.

03Why one request stalls the whole server

The filter is not offloaded. BaseFilter.run() (thumbor/filters/__init__.py:209-229) awaits the filter coroutine directly, and convolution() calls into the C extension synchronously, so the arithmetic executes on the IOLoop thread. Setting ENGINE_THREADPOOL_SIZE does not help: the default is 0 (thumbor/config.py:334-343), and even when a pool exists it only serves transformer operations and encoding of the result (thumbor/transformer.py:216, thumbor/handlers/__init__.py:816).

One convolution request makes the process unresponsive. It does not merely slow the client that sent it.

04Proof of concept: 101×101 kernel, 41.7 seconds

Measured against a default configuration on a single core, using a 2048×2048 source image requested at 1024×1024:

RequestResultTime
/unsafe/1024x1024/filters:convolution(<121 ones>,11,false)/big.pngHTTP 2000.7 s
/unsafe/1024x1024/filters:convolution(<10201 ones>,101,false)/big.pngHTTP 20041.7 s

While the 101×101 request was in flight, a concurrent GET /healthcheck/ timed out after 3 seconds, confirming foreground execution on the IOLoop with the default ENGINE_THREADPOOL_SIZE = 0.

Tornado's max_request_head_size of 65,536 bytes does cap the URL in practice: a 301×301 matrix needs roughly 181 kB and is rejected before it reaches the application. That limit is a transport default, not a thumbor control. Embedding frameworks or proxies can raise it. Within the default limit a kernel of roughly 20,000 to 30,000 elements on a multi-megapixel image already costs minutes of CPU per request, and thumbor applies no rate limiting of its own.

05Impact: unauthenticated denial of service in the default setup

An attacker with no credentials and no signed URL can exhaust CPU and freeze the thumbor process for tens of seconds to minutes per request. A handful of concurrent requests saturates the service, and health checks fail while the loop is blocked, which can pull the instance out of a load balancer or restart it under an orchestrator.

Buggs777 rated the issue Moderate. The outcome is availability loss, with no data exposure and no code execution.

06Affected versions

PackageAffectedPatched
thumbor (pip)<= 7.8.0None released

The affected Python and C sources are byte-identical in 7.8.0 and on master before the fix. No CVE ID has been assigned; the advisory is tracked as GHSA-33r8-5m8h-7mmx, with an independent duplicate at GHSA-4g5h-58j2-p9h3 describing the same component and the same remediation.

07Remediation: two configurable limits on kernel size and work

The fix introduces two limits, both configurable:

  • MAX_CONVOLUTION_KERNEL_ELEMENTS (default 225, i.e. a 15×15 square kernel) rejects oversized kernels with HTTP 400 while the filter is being built, before the image is loaded.
  • MAX_CONVOLUTION_WORK (default 1000000000) caps image pixels multiplied by kernel elements, summed over every convolution filter and animation frame of a request, and returns HTTP 400 as soon as one convolution would exceed it.

The native extension repeats both checks on every call the filter makes. The 101×101 request above took 30.6 s before the fix (96.0 s with the machine saturated) and returns HTTP 400 in 0.006 s with it, without loading the image. Setting a limit to 0 disables only that limit, and thumbor logs a startup warning while MAX_CONVOLUTION_WORK is disabled and the filter is enabled. The same change stops the native kernel parser from leaking one bytes object per coefficient on every call.

Residual cost. The limits bound the work of a request; they do not make convolution cheap. At the default work limit (a 15×15 kernel on a 2108×2108 image, 999,824,400 pixel-element products) the native loop still burned 2.0 s of CPU idle and 6.7 s on a saturated machine, and a concurrent /healthcheck/ waited 6.2 s behind it. Deployments that cannot tolerate a multi-second stall should lower MAX_CONVOLUTION_WORK.

For versions without the fix, remove thumbor.filters.convolution from FILTERS so the filter is ignored in URLs, or set ALLOW_UNSAFE_URL = False and serve only signed URLs, as long as the application does not sign URLs with client-chosen filters. Raising ENGINE_THREADPOOL_SIZE is not a workaround. With a pool of 4, a health check still waited 8.5 s behind a 9.1 s convolution request on the unfixed code.

08Timeline

  1. 2026-08-15GHSA-33r8-5m8h-7mmx opened privately by Buggs777, with measurements against the default configuration and an analysis of the March 2026 fixes.
  2. 2026-08-15Advisory edited by marcelometal; kept as a draft with severity Moderate.
  3. PendingRelease containing MAX_CONVOLUTION_KERNEL_ELEMENTS and MAX_CONVOLUTION_WORK, then public disclosure.

09References

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.