/

CVE-2026-25146

Severity:

CRITICAL RISK

(9.6)

Sensitive Information Exposure in OpenEMR

CVE-2026-25146

Analyzed

Vulnerability type

Category:

Sensitive Information Exposure

CWE:

CWE-200

Impact:

Payment Gateway Account Compromise and Fraudulent Transactions

Severity:

CRITICAL RISK

(9.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 exposed the gateway_api_key secret value in plaintext to client-side contexts along at least two application paths between versions 5.0.2 and 8.0.0.

If an attacker can observe these responses (e.g., via a compromised user account, browser, or network position), they may obtain payment gateway API keys and use them to perform arbitrary money movements or take over payment gateway accounts.

Affected context

The vulnerability occurs in OpenEMR deployments that are:

  • Running versions from 5.0.2 up to (but not including) 8.0.0
  • Configured with payment gateway integrations that rely on a gateway_api_key secret
  • Serving application paths where server-side templates or API responses include the secret in plaintext to the client

The exposure is tied to application logic that renders configuration or payment integration details directly into the browser or other client consumers, rather than keeping the secret fully server-side.

Exploit preconditions

  • Attack surface: Web application responses in OpenEMR (HTML views or API endpoints that include payment configuration data).
  • Required access: Ability to access affected pages or endpoints where the gateway_api_key is rendered. This may be via:
  • Valid user credentials with sufficient role/permissions, or
  • Leveraging an already compromised session or browser, or
  • Intercepting traffic on the network path if transport protections are weak.
  • Trigger point: Viewing or capturing the HTTP response for the vulnerable paths; the key is present in plaintext within the response body or client-side code.
  • Why exploitation is possible: The application treats the payment gateway secret as displayable configuration data and includes it in client-visible content, violating the principle that secrets must remain server-side and never be exposed to end users or their environments.

Why this happens

This issue stems from insecure handling of sensitive configuration data, where a payment gateway secret (gateway_api_key) is rendered in plaintext to the client.

Conceptually, this maps to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, because a highly sensitive credential is disclosed in a context where it can be accessed by parties beyond the core backend system.

The underlying pattern is:

  • Storing payment API credentials server-side (correct), but
  • Reusing the same data structures or templates for both internal configuration and outward-facing views, leading to direct inclusion of the secret in responses.

By failing to segregate secret storage from client-visible data and not redacting or omitting these values before rendering, the application exposes long-lived credentials that can be reused outside of the intended trust boundary.

Potential impact

  • Attackers may use exposed gateway_api_key values to perform arbitrary money movements via integrated payment gateway APIs.
  • Compromise of payment gateway accounts associated with the OpenEMR instance, including changing payout destinations or account settings.
  • Fraudulent transactions and financial loss for the healthcare provider or its patients.
  • Abuse of compromised keys to pivot into other systems integrated with the same payment accounts.
  • Reputational damage and regulatory exposure due to mishandling of financial and potentially patient-related payment data.

General mitigation guidance

Effective mitigation focuses on treating payment gateway credentials as high-value secrets and strictly preventing their exposure to clients.

Recommended patterns include:

  • Never render secrets client-side: Avoid including raw API keys, tokens, or passwords in HTML, JavaScript, JSON, or any other client-consumable format. Use server-side operations to interact with payment gateways on behalf of the client.
  • Redaction and separation of concerns: When configuration data must be viewed in the UI (for administration), display only non-sensitive identifiers (e.g., masked keys, last 4 characters) and keep full secrets stored in separate, non-viewable fields.
  • Use dedicated secret storage mechanisms: Store gateway_api_key in secret stores, environment variables, or encrypted configuration backends designed for secrets, not in general-purpose configuration objects directly bound to templates.
  • Enforce least privilege and scoping: Prefer short-lived, scoped tokens or keys that minimize damage if accidentally exposed, and use separate keys per environment and per tenant where possible.
  • Implement secure configuration workflows: Provide explicit UX for rotating keys, revoking compromised credentials, and validating that new keys are functional without ever echoing back the full secret to the user.

How teams detect issues like this

To detect and prevent similar issues, organizations can adopt several analysis and review techniques:

  • Static analysis and code scanning:
  • Search templates, controllers, and API responses for variables or fields named like *api_key*, *secret*, *token* that are interpolated into client-visible content.
  • Enforce rules that forbid rendering certain configuration fields or ORM columns in views or JSON serializers.
  • Configuration and policy checks:
  • Maintain an inventory of sensitive configuration keys and enforce policies that they are only accessed in backend service layers that communicate with payment gateways.
  • Use schema-level annotations or metadata to mark fields as "secret" and block their use in serializers or UI bindings.
  • Dynamic testing and response inspection:
  • Include automated tests that crawl authenticated application pages and APIs, scanning responses for known sensitive patterns (e.g., live API key formats, high-entropy strings where they are not expected).
  • Integrate security testing into CI/CD pipelines to fail builds if suspected secrets are detected in rendered responses.
  • Code review practices:
  • Add review checklist items specifically for payment integration changes, verifying that all payment operations occur server-side and that no secrets are exposed to the client.
  • Use automated code review tools or pre-commit hooks to flag direct rendering of sensitive configuration fields.

Sources

SourceLink
github.comgithub.com/openemr/openemr/blob/6a4e18c5ec73e0c755f6f65b28a9652aded1a58b/interface/patient_file/front_payment.php#L765
github.comgithub.com/openemr/openemr/blob/6a4e18c5ec73e0c755f6f65b28a9652aded1a58b/portal/portal_payment.php#L537
github.comgithub.com/openemr/openemr/commit/fe6341496dc82d5b4f5a3f35891bb2e2481f3b25
github.comgithub.com/openemr/openemr/security/advisories/GHSA-2hq8-wc73-jvvq

Frequently asked

questions

Exploitability depends on who can access the affected views or endpoints. Any party that can legitimately or illegitimately access the application pages where the gateway_api_key is rendered can potentially harvest the keys. This includes compromised user accounts, malicious insiders, or attackers with network visibility if traffic is not properly encrypted.

Typically, the attacker needs at least the same level of access as a user or administrator who can reach the pages or APIs that contain the exposed key. In some deployments, this might require authenticated access; in others, misconfigurations could make the paths more broadly reachable. Once the key is obtained, the attacker no longer needs access to OpenEMR itself to abuse the payment gateway APIs.

The safest approach is to ensure that payment gateway secrets are never returned in responses or rendered in any client-visible context. Secrets should be stored in dedicated secret storage and only used server-side to call payment APIs. Any administrative UI should display only non-sensitive metadata, with options to rotate or re-enter secrets rather than view them.

Prevention involves a combination of technical and process measures: classify and tag secret fields, enforce coding standards that prohibit client-side exposure of credentials, integrate static and dynamic checks that scan for secrets in responses, and routinely review all payment or credential-related changes with a security lens. Adopting a centralized secrets management strategy and least-privilege token design also reduces the impact of any accidental exposure.

Find out what's already
exploitable in your codebase.