Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2025-5584 Overview
CVE-2025-5584 is a stored cross-site scripting (XSS) vulnerability in PHPGurukul Hospital Management System 4.0. The flaw resides in the /doctor/edit-patient.php endpoint, where the patname POST parameter is reflected without proper output encoding. An authenticated attacker with doctor-level access can inject arbitrary JavaScript that executes in the browsers of subsequent viewers. The issue is tracked under CWE-79 and has been publicly disclosed with proof-of-concept details on GitHub.
Critical Impact
Authenticated attackers can store malicious JavaScript in patient records, enabling session theft, credential harvesting, and unauthorized actions against hospital staff accounts that view the affected pages.
Affected Products
- PHPGurukul Hospital Management System 4.0
- Anujk305 Hospital Management System 4.0 distribution
- Deployments exposing the /doctor/edit-patient.php endpoint
Discovery Timeline
- 2025-06-04 - CVE-2025-5584 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-5584
Vulnerability Analysis
The vulnerability occurs in the patient edit workflow accessible to authenticated doctor accounts. When a doctor submits the edit form at /doctor/edit-patient.php?editid=2, the application accepts the patname POST parameter and writes it to persistent storage without sanitization. On subsequent page loads, the stored value is rendered back into the HTML response without proper encoding. This classifies the issue as stored XSS rather than reflected XSS, which increases its persistence and reach across users who view affected records.
Exploitation requires valid authentication, which limits the attack surface to insider threats or attackers who have already compromised a doctor-level credential. The user interaction requirement reflects that a victim must load a page containing the stored payload for execution to occur.
Root Cause
The root cause is missing input validation and output encoding on the patname field in /doctor/edit-patient.php. The application neither sanitizes HTML control characters on input nor applies context-appropriate encoding when the value is written back into the HTML document. This is a classic improper neutralization of input during web page generation, categorized as CWE-79.
Attack Vector
An authenticated attacker submits a crafted payload to the patname parameter via the edit-patient form. The payload is persisted in the backend database tied to the patient record referenced by editid. When any user — including administrators or other medical staff — views the affected patient profile, the browser parses the injected script in the originating site's context. Common post-exploitation outcomes include session cookie exfiltration, forced CSRF actions against the hospital application, keystroke capture on hospital workstations, and pivoting to administrative interfaces.
Technical details and a proof-of-concept are published in the Hospital Management System v4.0 Stored XSS exploit writeup.
Detection Methods for CVE-2025-5584
Indicators of Compromise
- POST requests to /doctor/edit-patient.php containing HTML tags such as <script, <img, <svg, or event handlers like onerror= and onload= in the patname parameter.
- Outbound HTTP requests from staff browsers to attacker-controlled domains immediately after loading a patient record page.
- Unexpected document.cookie references or dynamic script injections observed in web server response logs for the hospital application.
Detection Strategies
- Deploy a web application firewall (WAF) rule that inspects POST bodies for the patname parameter and blocks HTML or JavaScript control characters.
- Review application access logs for anomalous edits to patient records, particularly by accounts that rarely modify data.
- Add database content checks that flag patient name fields containing angle brackets, protocol handlers (javascript:), or encoded payload markers.
Monitoring Recommendations
- Enable browser-side telemetry (Content Security Policy reporting) to surface blocked inline script executions originating from the hospital app.
- Monitor authentication logs for compromised doctor accounts that may be used to plant stored payloads.
- Correlate web server, database, and endpoint telemetry to identify staff workstations that execute unexpected JavaScript after loading patient pages.
How to Mitigate CVE-2025-5584
Immediate Actions Required
- Audit the tblpatient table (or equivalent) for existing records containing HTML or script content in the patname field and purge malicious entries.
- Restrict access to /doctor/edit-patient.php to vetted accounts and enforce multi-factor authentication on all doctor-level logins.
- Place the application behind a WAF with signatures tuned for stored XSS payloads targeting PHP applications.
Patch Information
At the time of publication, no official patch from PHPGurukul has been referenced in the advisory for CVE-2025-5584. Operators should consult the PHPGurukul project site for upstream fixes and apply source-level mitigations in the interim: validate patname against an allowlist of permitted characters, and apply htmlspecialchars($value, ENT_QUOTES, 'UTF-8') whenever the value is rendered in HTML context.
Workarounds
- Implement a strict Content Security Policy that disallows inline scripts and restricts script sources to trusted origins.
- Add server-side input filtering that rejects or escapes <, >, ", ', and & characters in free-text patient fields.
- Isolate the hospital management application on a segmented network and limit it to internal access via VPN where feasible.
# Example Apache WAF rule (ModSecurity) to block suspicious patname payloads
SecRule ARGS:patname "@rx (?i)(<script|onerror=|onload=|javascript:|<svg|<img[^>]+src)" \
"id:1005584,phase:2,deny,status:403,log,msg:'CVE-2025-5584 stored XSS attempt in patname'"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

