All reports
High

Thumbor has path traversal via post-validation URL decoding bypass in file_loader

Affected versions

Version ranges need review.

Affected versions
<= 7.7.7
Fixed version
7.8.0
Affected versions
<7.8.0 || =4.1.3 || =4.10.0 || =4.10.1 || =4.10.2 || =4.10.3 || =4.11.0 || =4.11.1 || =4.12.0 || =4.12.1 || =4.12.2 || =4.4.1 || =4.5.3 || =4.5.4 || =4.6.0 || =4.7.0 || =4.7.1 || =4.8.0 || =4.8.1 || =4.8.2 || =4.8.3 || =4.8.4 || =4.8.5 || =4.8.6 || =4.9.0 || =4.9.1 || =5.0.0 || =5.0.0rc1 || =5.0.0rc2 || =5.0.1 || =5.0.2 || =5.0.3 || =5.0.4 || =5.0.5 || =5.0.6 || =5.1.0 || =5.2.0 || =5.2.1 || =6.0.0 || =6.0.0b1 || =6.0.0b2 || =6.0.0b3 || =6.0.0b4 || =6.0.0b5 || =6.0.1 || =6.0.2 || =6.1.0 || =6.1.1 || =6.1.2 || =6.1.3 || =6.1.4 || =6.1.5 || =6.2.0 || =6.2.1 || =6.3.0 || =6.3.1 || =6.3.2 || =6.4.0 || =6.4.1 || =6.4.2 || =6.4.3 || =6.5.0 || =6.5.1 || =6.5.2 || =6.6.0 || =6.6.1 || =6.7.0 || =6.7.1 || =6.7.2 || =6.7.3 || =6.7.4 || =6.7.5 || =6.7.6 || =7.0.0 || =7.0.0a1 || =7.0.0a2 || =7.0.0a3 || =7.0.0a4 || =7.0.0a5 || =7.0.0b1 || =7.0.1 || =7.0.10 || =7.0.11 || =7.0.12 || =7.0.2 || =7.0.3 || =7.0.5 || =7.0.6 || =7.0.7 || =7.0.8 || =7.0.9 || =7.1.0 || =7.1.1 || =7.1.2 || =7.2.0 || =7.2.1 || =7.3.0 || =7.3.1 || =7.3.2 || =7.4.0 || =7.4.1 || =7.4.2 || =7.4.3 || =7.4.4 || =7.4.5 || =7.4.6 || =7.4.7 || =7.5.0 || =7.5.1 || =7.5.2 || =7.6.0 || =7.7.0 || =7.7.1 || =7.7.2 || =7.7.3 || =7.7.4 || =7.7.5 || =7.7.6 || =7.7.7
Fixed version
7.8.0

Exploitation

CVE-2026-53502

Probability of exploitation in the next 30 days: 0.52%

FIRST EPSS · 2026-11-24

Description

The file_loader performs unquote() on the file path AFTER the abspath() + startswith() security check. An attacker can use percent-encoded path traversal sequences (%2e%2e for ..) that pass the security check as literal directory names, but are then decoded to actual .. traversal sequences.

Affected code

thumbor/loaders/file_loader.py lines 28-49:

async def load(context, path):
    file_path = join(
        context.config.FILE_LOADER_ROOT_PATH.rstrip("/"), path.lstrip("/")
    )
    file_path = abspath(file_path)
    inside_root_path = file_path.startswith(         # Security check
        abspath(context.config.FILE_LOADER_ROOT_PATH)
    )
    result = LoaderResult()
    if not inside_root_path:
        result.error = LoaderResult.ERROR_NOT_FOUND
        result.successful = False
        return result

    if not exists(file_path):
        file_path = unquote(file_path)               # unquote AFTER check!

    if exists(file_path) and isfile(file_path):
        with open(file_path, "rb") as source_file:
            ...

The watermark and frame filters pass their URL parameters directly to the loader without re-encoding (unlike the main image URL flow which applies quote() in imaging.py line 37).

PoC

# Read /etc/passwd via watermark filter path traversal
# %252e is double-encoded: Tornado decodes to %2e, filter passes to file_loader,
# file_loader unquote decodes %2e to .
curl 'http://thumbor-host:8888/unsafe/filters:watermark(%252e%252e/%252e%252e/%252e%252e/%252e%252e/etc/passwd,0,0,100)/some-valid-image.jpg'

Flow:

  1. %252e%252e arrives at Tornado, decoded to %2e%2e

  2. Watermark filter passes %2e%2e/%2e%2e/.../etc/passwd to file_loader

  3. join(ROOT, '%2e%2e/...') = ROOT/%2e%2e/...

  4. abspath() sees %2e%2e as literal dir name (no dots to resolve)

  5. startswith(ROOT) = True (passes check)

  6. exists() returns False (literal %2e%2e dir doesn't exist)

  7. unquote() converts %2e%2e to ..

  8. OS resolves .. → reads files outside ROOT

Prerequisites

  • LOADER = thumbor.loaders.file_loader (or file_loader_http_fallback)

  • ALLOW_UNSAFE_URL = True (this is the default)

  • watermark/frame filters are enabled by default (in BUILTIN_FILTERS)

Impact

Arbitrary file read on the thumbor server. When the file is a valid image format, its content is returned in the response overlaid as a watermark. Can be used to read configuration files, secrets, private keys, etc.

Links

Credits

  • q1uf3ng
  • 0xHunSec