Summary
InvoiceShelf's payment receipt PDF generation module contains a Server-Side Request Forgery (SSRF) flaw where user-controlled HTML from the payment Notes field is rendered by Dompdf, which then fetches remote resources referenced in that markup.
An attacker who can submit crafted notes or directly hit the PDF receipt endpoint can cause the server to make arbitrary HTTP requests to internal or external hosts, potentially exposing internal services and metadata.
Affected context
The vulnerability appears in InvoiceShelf deployments that:
- Allow users (or integrated systems) to provide free-form content in the payment Notes field
- Generate payment receipt PDFs via an HTTP endpoint
- Use Dompdf (or similar HTML-to-PDF tools) that automatically fetch remote resources referenced in HTML (e.g., images, styles)
The risk is higher where the InvoiceShelf server can reach internal infrastructure, cloud metadata endpoints, or other sensitive network segments.
Exploit preconditions
- Attack surface: The payment receipt PDF generation endpoint.
- Required access: Ability to supply or influence the payment Notes field contents, or direct access to the PDF receipt endpoint parameters.
- Trigger point: Rendering of the payment receipt as a PDF by Dompdf, which processes the attacker-controlled HTML.
- Why exploitation is possible: The application passes user-supplied HTML to Dompdf without sanitization or URL restriction, allowing arbitrary remote resource references (e.g.,
<img src="http://internal-service/endpoint">) that Dompdf will fetch server-side.
Why this happens
This issue stems from trusting user-controlled HTML in a context where it is interpreted by a server-side rendering engine that performs outbound HTTP requests.
By passing unvalidated, unsanitized HTML from the payment Notes field directly into Dompdf, the application permits attackers to define arbitrary remote resources that Dompdf will retrieve.
This behavior aligns with CWE-918: Server-Side Request Forgery (SSRF), where server-side components initiate network requests based on untrusted input without applying network or URL-level constraints.
Potential impact
- Discovery and probing of internal network services that are not directly exposed to the internet
- Access to cloud instance metadata services, potentially leaking credentials or configuration
- Interaction with internal HTTP-based admin panels, APIs, or management interfaces
- Leveraging the server as a pivot point for further attacks or network mapping
- Triggering unintended side effects on internal services that respond to crafted requests
General mitigation guidance
Effective mitigation typically focuses on controlling how untrusted data reaches network-capable components and limiting where the server can connect:
- Treat any HTML-accepting field as untrusted and avoid passing it directly to rendering engines that perform network calls.
- Implement strict URL allowlists or blocklists at the HTTP client level used by Dompdf or the underlying environment, restricting outbound requests to known-safe domains.
- Configure the rendering engine to disable or heavily restrict remote resource loading, preferring inline or local assets.
- Normalize or sanitize user-supplied HTML, stripping or rewriting tags and attributes that can reference remote URLs (e.g.,
img,link,script). - Reduce network privileges for the application host, such as denying access to internal management networks and metadata endpoints via firewall or network policy.
How teams detect issues like this
High-level detection approaches can include:
- Static analysis rules or manual code review to identify HTML-to-PDF or template rendering paths that accept user input and permit remote resource loading.
- Inspection of configuration for libraries like Dompdf to ensure remote content fetching is disabled or constrained.
- Network-level monitoring and anomaly detection for unusual outbound HTTP requests originating from the InvoiceShelf server, especially to internal IP ranges or metadata endpoints.
- Automated security testing in CI/CD that exercises PDF generation endpoints with crafted URLs and observes resulting network activity in a controlled environment.

