CVE-2025-68616

7.5 HIGH

📋 TL;DR

WeasyPrint versions before 68.0 contain an SSRF protection bypass vulnerability in the default_url_fetcher. Attackers can exploit HTTP redirects to access internal network resources like localhost services or cloud metadata endpoints, even when developers have implemented custom security policies. This affects any application using WeasyPrint to generate PDFs from untrusted HTML input.

💻 Affected Systems

Products:
  • WeasyPrint
Versions: All versions before 68.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications that process untrusted HTML input for PDF generation. Applications using WeasyPrint with trusted input only are not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of internal network services, including access to cloud metadata endpoints (potentially exposing credentials), internal APIs, and sensitive localhost services.

🟠

Likely Case

Information disclosure from internal services, enumeration of internal network resources, and potential access to cloud metadata containing temporary credentials.

🟢

If Mitigated

Limited impact if proper network segmentation and egress filtering are in place, though some internal resource enumeration may still occur.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires the ability to control HTML content being converted to PDF. The vulnerability is straightforward to exploit once an attacker controls input.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 68.0

Vendor Advisory: https://github.com/Kozea/WeasyPrint/security/advisories/GHSA-983w-rhvv-gwmv

Restart Required: No

Instructions:

1. Update WeasyPrint to version 68.0 or later using pip: pip install --upgrade weasyprint==68.0
2. Verify the update completed successfully
3. Test PDF generation functionality to ensure compatibility

🔧 Temporary Workarounds

Implement custom URL fetcher with redirect validation

all

Create a custom url_fetcher that validates redirect destinations against security policies

Implement custom fetcher that checks response.url after redirects

Network egress filtering

all

Block outbound connections from WeasyPrint servers to internal network ranges

Configure firewall rules to restrict WeasyPrint server egress traffic

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for HTML content processed by WeasyPrint
  • Deploy network segmentation to isolate WeasyPrint servers from sensitive internal resources

🔍 How to Verify

Check if Vulnerable:

Check WeasyPrint version: python -c "import weasyprint; print(weasyprint.__version__)" and verify it's below 68.0

Check Version:

python -c "import weasyprint; print(weasyprint.__version__)"

Verify Fix Applied:

After updating, test with a controlled SSRF attempt using redirects to internal resources

📡 Detection & Monitoring

Log Indicators:

  • Unusual outbound connections from WeasyPrint processes to internal IP ranges
  • Multiple redirects in URL fetching operations

Network Indicators:

  • HTTP traffic from WeasyPrint servers to internal/private IP addresses
  • Requests to cloud metadata endpoints from application servers

SIEM Query:

source="weasyprint" AND (dest_ip=10.0.0.0/8 OR dest_ip=172.16.0.0/12 OR dest_ip=192.168.0.0/16 OR dest_ip=169.254.169.254)

🔗 References

📤 Share & Export