/

CVE-2026-33321

Severity:

HIGH RISK

(7.6)

SSRF in OpenEMR Eye Exam PDF Generation

CVE-2026-33321

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Server-Side Request Forgery to Internal and External Resources

Severity:

HIGH RISK

(7.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OpenEMR's Eye Exam PDF creation function contained an Out-of-Band Server-Side Request Forgery issue where user-supplied form answers were parsed as unescaped HTML.

Under these conditions, an attacker with the "Notes - my encounters" role could cause the server to initiate forged HTTP requests to internal or external resources during PDF generation.

Affected context

This vulnerability occurs in OpenEMR instances where:

  • Users with the Notes - my encounters role can complete Eye Exam forms for patient encounters
  • The Eye Exam form responses are later rendered into a PDF document
  • The PDF generation pipeline interprets the stored answers as HTML content without proper sanitization or output encoding

In such deployments, crafted Eye Exam responses can influence how the PDF engine loads external resources, enabling OOB SSRF from the OpenEMR server environment.

Exploit preconditions

  • Attack surface: Eye Exam encounter forms that are later exported/printed as PDF files.
  • Required access: Authenticated user with at least the Notes - my encounters role and permission to fill Eye Exam forms.
  • Trigger point: Invoking PDF generation for an encounter containing maliciously crafted Eye Exam answers.
  • Why exploitation is possible: The PDF creation logic treats stored form answers as raw HTML and allows resource-loading constructs that the PDF engine or underlying HTTP client resolves from the server's network context, thereby enabling server-initiated requests to attacker-chosen URLs.

Why this happens

The core issue is the direct use of unescaped, user-controlled Eye Exam form data as HTML input to the PDF renderer.

By not applying appropriate output encoding and sanitization, the system allows HTML constructs that reference external resources (for example, images or other fetchable assets) to be embedded in the generated document.

When the PDF engine processes this HTML, it makes outbound requests from the server environment to retrieve those resources, which aligns with CWE-918: Server-Side Request Forgery (SSRF)—the server is tricked into initiating network connections based on attacker-influenced input.

The vulnerability is amplified by the fact that the server's internal network access may differ significantly from that of the user, turning simple HTML rendering into a pivot point for indirect network probing and resource access.

Potential impact

  • Could allow attackers to cause the server to make HTTP/HTTPS requests to internal network services that are not directly exposed to users.
  • May enable limited internal network reconnaissance (e.g., checking which hosts or ports respond, depending on error behavior and timing).
  • Can potentially be used to access or interact with internal web endpoints, metadata services, or management interfaces reachable from the OpenEMR server.
  • Might facilitate chaining with other weaknesses (e.g., misconfigured internal services) to escalate impact beyond the application boundary.

General mitigation guidance

Effective mitigation typically focuses on reducing trust in user-controlled content and constraining outbound requests:

  • Treat all form responses as untrusted data and apply strict output encoding when embedding them into HTML or PDF templates, avoiding direct HTML interpretation where not necessary.
  • Introduce robust HTML sanitization for any content that must remain HTML-capable, removing or neutralizing elements and attributes that can trigger network requests (e.g., remote images, iframes, scripts, CSS imports).
  • Prefer safer document-generation patterns that separate layout templates from user data, using templating engines that default to escaped output.
  • Restrict the application server's egress network access at the infrastructure level, limiting which external hosts and ports it can reach and blocking access to cloud/VM metadata endpoints and sensitive internal services.
  • Apply least-privilege principles to the server environment so that even if outbound requests are triggered, their reach and potential impact are drastically reduced.

How teams detect issues like this

Detection can combine code-centric and infrastructure-level approaches:

  • Use static analysis or secure code review to flag patterns where user-provided form fields are injected into HTML or PDF templates without encoding or sanitization.
  • Add review checklists for features that generate documents from user data, explicitly questioning whether any resource-loading elements can be influenced by end users.
  • Monitor outbound HTTP traffic from application servers for unusual destinations, especially requests that correlate with user-triggered PDF generation events.
  • Employ network-level controls and logging (e.g., proxies, firewalls, or service meshes) to observe and restrict unexpected egress from the OpenEMR server.
  • Integrate automated security testing tools that simulate SSRF-like inputs in form fields used for document generation workflows.

Sources

SourceLink
github.comgithub.com/openemr/openemr/commit/dccc962f06bdf6105ca85c277915167caf3e7c28
github.comgithub.com/openemr/openemr/security/advisories/GHSA-5pc3-2crw-96rv

Frequently asked

questions

Yes, but exploitation still requires authenticated access. An attacker must have a user account with the ability to create or modify Eye Exam encounter forms and then trigger PDF generation; from there, the server performs the forged requests on behalf of that user's input.

The attacker must be logged in with at least the Notes - my encounters role (or equivalent permissions) that allow filling Eye Exam forms and invoking the print-to-PDF functionality. No direct server or administrative access is required.

The most robust approach is to ensure that user-supplied form data is never interpreted as raw HTML in the PDF pipeline. Use templating mechanisms that escape all variables by default, add HTML sanitization for any intentionally rich fields, and prevent resource-loading constructs from being user-controlled.

Systematically treat outbound connections from the application server as sensitive operations. Combine secure coding practices (strong output encoding, sanitization, and safe document generation) with architectural safeguards (egress filtering, network segmentation, and thorough review of any feature that can cause server-initiated requests based on user input).

Find out what's already
exploitable in your codebase.