Summary
The Hospital Management System from rickxy suffers from an unrestricted file upload issue in the admin account backend handler, where the ad_dpic parameter is insufficiently validated.
A remote attacker can upload arbitrary files, potentially including executable scripts, to the server, leading to code execution or data compromise when those files are accessed or executed by the application or server.
Affected context
The vulnerability occurs in the backend administrative interface at /backend/admin/his_admin_account.php, specifically around handling of the ad_dpic argument used for uploading admin-related files (likely profile/display pictures).
It manifests when the application accepts files from remote users without enforcing strict checks on file type, content, destination, and execution context.
Systems are most at risk when the uploaded content is placed in a web-accessible directory or otherwise processed by the server in a way that may execute attacker-controlled code.
Exploit preconditions
- Attack surface: HTTP(S) interface to the backend admin functionality at
/backend/admin/his_admin_account.php. - Required access: Ability to reach the admin upload endpoint; depending on deployment, this may require valid credentials or could be exposed more broadly if access controls are weak.
- Trigger point: Sending a crafted HTTP request that sets the
ad_dpicparameter and attaches a malicious file as part of a form or API upload. - Why exploitation is possible: The upload handler does not sufficiently restrict file types, validate content, or control storage location; as a result, attacker-supplied files can be stored in locations where they may be interpreted or executed by the server.
Why this happens
This issue stems from improperly controlled file upload logic, aligning with CWE-434: Unrestricted Upload of File with Dangerous Type and supported by CWE-284: Improper Access Control.
The upload endpoint appears to trust client-supplied file metadata and does not enforce a strong allowlist of safe file types, nor does it adequately sanitize filenames or segregate upload locations.
In the absence of strict validation and execution barriers, uploaded files can remain accessible under the web root or other sensitive directories, enabling attackers to store and potentially execute arbitrary content on the host.
Potential impact
- Upload and hosting of arbitrary files on the server, including web shells or scripts.
- Possible remote code execution if uploaded files are interpreted by the server (e.g., via PHP, JSP, or other server-side engines).
- Defacement or alteration of application content by replacing or injecting files.
- Data disclosure or exfiltration by leveraging uploaded code to access backend databases or configuration.
- Use of the compromised server as a pivot point for further attacks within the network.
General mitigation guidance
Effective mitigation generally focuses on constraining what can be uploaded and how uploads are handled:
- Enforce a strict allowlist of permitted file types based on MIME type and server-side content inspection, not just file extensions.
- Store uploaded files outside the web root or in locations not executed by the web server; serve them through controlled handlers rather than direct file system access.
- Normalize and sanitize filenames, ignoring client-provided paths and names in favor of generated identifiers.
- Apply least-privilege file system permissions so the web process can write only to designated upload directories and cannot modify application or configuration files.
- Combine upload constraints with strong access control on administrative endpoints to reduce exposure.
How teams detect issues like this
Detection typically combines code-centric review and runtime monitoring:
- Static analysis: Flag file upload handlers that accept user-controlled file content without extension/MIME validation, content inspection, or path normalization; highlight direct writes into web-accessible directories.
- Code review: Look for upload logic that trusts client-supplied filenames, lacks allowlisted extensions, or omits checks preventing server-side execution of uploaded content.
- Policy enforcement: Implement CI/CD checks that require new upload endpoints to specify allowed types, storage locations, and non-executable directories.
- Runtime monitoring: Analyze web server logs and application telemetry for suspicious uploads (e.g., scripts, uncommon extensions) and subsequent direct access to uploaded files.

