VYPR
Unrated severityNVD Advisory· Published Jun 6, 2022· Updated Aug 3, 2024

CVE-2022-31498

CVE-2022-31498

Description

LibreHealth EHR Base 2.0.0 allows interface/orders/patient_match_dialog.php key XSS.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

A stored XSS vulnerability in LibreHealth EHR 2.0.0 allows attackers to inject arbitrary web script via the patient match dialog.

Vulnerability

A cross-site scripting (XSS) vulnerability exists in LibreHealth EHR Base version 2.0.0 in the file interface/orders/patient_match_dialog.php. The application fails to properly sanitize user-supplied input to the key parameter (as noted in the original advisory [1]). An attacker can inject arbitrary JavaScript or HTML through this parameter, which is then reflected back to the user in the dialog response. The vulnerability affects the 2.0.0 release tag [2].

Exploitation

An attacker can exploit this vulnerability by crafting a URL containing malicious code in the key parameter, such as `. When a victim—typically an authenticated EHR user—visits the crafted URL via interface/orders/patient_match_dialog.php?key=...` the injected script executes in the context of their session. No prior authentication is required to send the malicious link, but the target must be logged into the application for the script to run with their privileges [1].

Impact

Successful exploitation allows the attacker to execute arbitrary JavaScript in the victim's browser. This can lead to session hijacking, data exfiltration, or manipulation of the application's functionality within the context of the user's role. Since the script runs with the victim's privileges, an attacker could potentially access or modify patient records, perform unauthorized actions, or steal sensitive information displayed on the page [1].

Mitigation

As of the publication date (2022-06-06), no official patch has been released for this vulnerability. The affected version 2.0.0 remains in widespread use. Mitigations should include input validation and output encoding for the key parameter in patient_match_dialog.php. Until a fix is deployed, organizations should restrict access to the vulnerable endpoint via web application firewall rules or network segmentation, and avoid clicking untrusted links while logged into LibreHealth EHR [1]. This CVE is not listed in CISA's Known Exploited Vulnerabilities catalog as of now.

AI Insight generated on May 27, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

2
  • LibreHealth/LibreHealth EHR Basedescription
  • LibreHealth/EMRllm-fuzzy
    Range: =2.0.0

Patches

0

No patches discovered yet.

Vulnerability mechanics

Root cause

"Missing output sanitization of the `key` GET parameter in patient_match_dialog.php allows reflected cross-site scripting."

Attack vector

An attacker crafts a URL containing a malicious payload in the `key` GET parameter and tricks an authenticated user into visiting it. The payload is injected directly into the page output without proper escaping, causing the browser to execute the attacker's script in the context of the LibreHealth EHR application. The proof-of-concept URL is `librehealth_host/orders/patient_match_dialog.php?key=%3C/script%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E` [ref_id=1].

Affected code

The vulnerable endpoint is `interface/orders/patient_match_dialog.php` [ref_id=1]. The `key` GET parameter is reflected without sanitization, allowing an attacker to inject arbitrary JavaScript.

What the fix does

The advisory does not include a patch or remediation details [ref_id=1]. To fix this vulnerability, the application should properly encode or sanitize the `key` parameter before reflecting it in the HTML response, for example by using `htmlspecialchars()` or an equivalent output-escaping function.

Preconditions

  • authThe attacker must trick an authenticated LibreHealth EHR user into visiting a crafted URL.
  • inputThe `key` GET parameter is reflected in the page output without sanitization.

Reproduction

Visit the following URL while authenticated to LibreHealth EHR: `librehealth_host/orders/patient_match_dialog.php?key=%3C/script%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E` [ref_id=1]. A JavaScript alert box displaying the user's cookies will appear, confirming the XSS.

Generated on May 25, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

1

News mentions

0

No linked articles in our index yet.