CVE-2025-68616: WeasyPrint SSRF Protection Bypass via HTTP Redirect

weasyprint Updated 20 Jan 2026

Summary

20/01/2026
Yes i
High
7.5

CVE-2025-68616: WeasyPrint has a Server-Side Request Forgery (SSRF) Protection Bypass via HTTP Redirect. Affects weasyprint versions < 68.0. Fixed in 68.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

WeasyPrint is a popular open-source library used for generating PDF documents from HTML and CSS. It is widely utilized in web applications to create printable documents. The library allows developers to define custom URL fetching mechanisms to enhance security by validating or sanitizing URLs before fetching them. However, a critical vulnerability exists that undermines these security measures.

Vulnerability Detail

The vulnerability in WeasyPrint arises from its default URL fetching mechanism, which is susceptible to a Server-Side Request Forgery (SSRF) Protection Bypass. This occurs because the underlying urllib library automatically follows HTTP redirects without re-evaluating the new destination against the developer's security policies. An attacker can exploit this by providing a URL that initially passes validation but redirects to a blocked internal resource, leading to unauthorized access to sensitive internal services or cloud metadata endpoints.

How To Fix

Minimum fixed version

68.0

This is the first release that contains the fix.

pip install --upgrade "weasyprint==68.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, developers can implement additional checks in their custom url_fetcher function to validate the final destination after a redirect. Here is an example of how to enhance the secure_fetcher function:

from weasyprint import default_url_fetcher

# Enhanced Security Filter

def secure_fetcher(url):
    # Check for both 'localhost' and any internal IP ranges
    if "localhost" in url or url.startswith("http://127."):
        raise PermissionError(f"Security Block: Access to {url} denied.")
    
    print(f"[ALLOWED] Initial URL check passed for: {url}")
    return default_url_fetcher(url)

Conclusion

The SSRF Protection Bypass vulnerability in WeasyPrint (CVE-2025-68616) poses significant risks to applications that rely on this library for PDF generation. It is crucial for developers to update to the patched version and consider implementing additional security measures to protect against potential exploits.

See every vulnerability recorded for weasyprint →

Share this vulnerability

FAQ

CVE-2025-68616 is a vulnerability in WeasyPrint that allows attackers to bypass SSRF protections through HTTP redirects.

This vulnerability can lead to unauthorized access to internal services or sensitive data, potentially allowing attackers to exploit internal network resources.

Implement additional checks in your custom url_fetcher to validate the final destination after redirects as a temporary workaround.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The CVSS score of this vulnerability is 7.5, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for weasyprint.

How To Fix

Minimum fixed version

68.0

This is the first release that contains the fix.

pip install --upgrade "weasyprint==68.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback