CVE-2025-55161 Overview
CVE-2025-55161 is a Server-Side Request Forgery (SSRF) vulnerability affecting Stirling-PDF, a locally hosted web application that performs various operations on PDF files. Prior to version 1.1.0, when using the /api/v1/convert/markdown/pdf endpoint to convert Markdown to PDF, the backend calls a third-party tool to process it and includes a sanitizer for security sanitization which can be bypassed, resulting in SSRF. This vulnerability allows attackers to potentially access internal network resources, cloud metadata endpoints, and other services that should not be externally accessible.
Critical Impact
Unauthenticated attackers can bypass input sanitization in the Markdown to PDF conversion endpoint to perform SSRF attacks, potentially accessing internal services and sensitive data without requiring any user interaction.
Affected Products
- Stirling-PDF versions prior to 1.1.0
- All deployments using the /api/v1/convert/markdown/pdf endpoint
- Self-hosted instances with network access to internal resources
Discovery Timeline
- August 11, 2025 - CVE-2025-55161 published to NVD
- August 15, 2025 - Last updated in NVD database
Technical Details for CVE-2025-55161
Vulnerability Analysis
This SSRF vulnerability (CWE-918) exists in the Markdown to PDF conversion functionality of Stirling-PDF. The application attempts to sanitize HTML content embedded within Markdown files before processing, but the sanitization mechanism can be bypassed. When a user submits specially crafted Markdown content through the /api/v1/convert/markdown/pdf endpoint, the backend third-party tool processes URLs without proper validation, allowing attackers to make requests to arbitrary internal or external destinations.
The vulnerability is particularly dangerous because it requires no authentication and can be exploited remotely over the network. Successful exploitation could allow attackers to scan internal networks, access cloud provider metadata services (such as AWS EC2 metadata at 169.254.169.254), retrieve sensitive configuration data, or interact with internal APIs that are not exposed to the internet.
Root Cause
The root cause of this vulnerability lies in inadequate URL validation within the HTML sanitization process. The CustomHtmlSanitizer class lacked proper SSRF protection when processing URLs embedded in Markdown content. The sanitizer focused on preventing XSS attacks but did not adequately validate or restrict the destinations of URLs that would be fetched during the PDF conversion process.
Attack Vector
The attack vector is network-based and requires no authentication or user interaction. An attacker can send a malicious Markdown document containing specially crafted URLs to the /api/v1/convert/markdown/pdf endpoint. The server will then make requests to these URLs as part of the PDF generation process, effectively making the Stirling-PDF server act as a proxy for the attacker's requests to internal network resources.
// Security patch introducing SSRF protection in CustomHtmlSanitizer.java
package stirling.software.common.util;
import org.owasp.html.AttributePolicy;
import org.owasp.html.HtmlPolicyBuilder;
import org.owasp.html.PolicyFactory;
import org.owasp.html.Sanitizers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import stirling.software.common.model.ApplicationProperties;
import stirling.software.common.service.SsrfProtectionService;
@Component
public class CustomHtmlSanitizer {
private final SsrfProtectionService ssrfProtectionService;
private final ApplicationProperties applicationProperties;
@Autowired
public CustomHtmlSanitizer(
SsrfProtectionService ssrfProtectionService,
ApplicationProperties applicationProperties) {
this.ssrfProtectionService = ssrfProtectionService;
this.applicationProperties = applicationProperties;
}
private final AttributePolicy SSRF_SAFE_URL_POLICY =
new AttributePolicy() {
@Override
// ... URL validation logic continues
Source: GitHub Commit 7d6b708
Detection Methods for CVE-2025-55161
Indicators of Compromise
- Unusual outbound requests from the Stirling-PDF server to internal IP addresses (e.g., 10.x.x.x, 172.16.x.x, 192.168.x.x)
- Requests to cloud metadata endpoints such as 169.254.169.254
- High volume of requests to the /api/v1/convert/markdown/pdf endpoint from external sources
- Server logs showing PDF conversion requests with suspicious URL schemes or internal hostnames
Detection Strategies
- Monitor network traffic from Stirling-PDF servers for unexpected connections to internal network segments
- Implement web application firewall (WAF) rules to detect SSRF payloads in Markdown content
- Review application logs for conversion requests containing internal IP addresses or localhost references
- Deploy network segmentation monitoring to alert on unauthorized cross-segment traffic
Monitoring Recommendations
- Enable detailed logging for all PDF conversion API endpoints
- Set up alerts for outbound connections to RFC 1918 private address ranges from application servers
- Monitor for DNS queries to internal hostnames originating from the Stirling-PDF application
- Implement rate limiting on the Markdown to PDF conversion endpoint to detect scanning attempts
How to Mitigate CVE-2025-55161
Immediate Actions Required
- Upgrade Stirling-PDF to version 1.1.0 or later immediately
- If immediate upgrade is not possible, disable or restrict access to the /api/v1/convert/markdown/pdf endpoint
- Implement network-level controls to prevent the application server from accessing sensitive internal resources
- Review logs for any evidence of exploitation prior to patching
Patch Information
The vulnerability has been patched in Stirling-PDF version 1.1.0. The fix introduces a new SsrfProtectionService and enhances the CustomHtmlSanitizer class with URL validation policies that prevent requests to internal network resources. The patch also adds HTML-specific configuration options through ApplicationProperties for finer-grained control over URL handling. The security fix is available in commit 7d6b70871bad2a3ff810825f7382c49f55293943. For detailed patch information, see the GitHub Security Advisory.
Workarounds
- Restrict network access from the Stirling-PDF server using firewall rules to block outbound connections to internal networks
- Deploy a reverse proxy with URL filtering capabilities in front of Stirling-PDF
- Disable the Markdown to PDF conversion feature entirely if not required for business operations
- Implement authentication requirements for the conversion API endpoint to limit exposure
# Example: Block outbound connections to internal networks from Stirling-PDF container
# Using iptables on the host system
iptables -A OUTPUT -s <stirling-pdf-ip> -d 10.0.0.0/8 -j DROP
iptables -A OUTPUT -s <stirling-pdf-ip> -d 172.16.0.0/12 -j DROP
iptables -A OUTPUT -s <stirling-pdf-ip> -d 192.168.0.0/16 -j DROP
iptables -A OUTPUT -s <stirling-pdf-ip> -d 169.254.169.254 -j DROP
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


