Summary
WebErpMesv2 versions 1.19 and earlier allow a self-registered user to upload arbitrary PHP files through the HR Expense scan_file functionality. When uploaded files are reachable and interpreted by the server, an attacker may execute code remotely; open registration and ineffective role enforcement can make this risk effectively unauthenticated in default deployments.
Affected context
The vulnerability occurs in WebErpMesv2 installations where the HR Expense file-upload functionality accepts insufficiently restricted files. Risk is heightened when self-registration is enabled, uploaded content is stored in a web-accessible location, the server interprets uploaded PHP files, and role middleware does not reliably enforce authorization. These conditions may allow a low-privilege account to reach the vulnerable upload path.
Exploit preconditions
- Attack surface: HR Expense file-upload functionality exposed through the WebErpMesv2 web application
- Required access: Typically a self-registered user account; default configurations may not require an invitation
- Trigger point: Processing of the
scan_fileupload parameter - Authorization condition: Broken role middleware may fail to enforce the intended privileged-role requirement
- Why exploitation is possible: File type and execution-location controls may be insufficient, allowing server-side script content to be uploaded and subsequently interpreted
Why this happens
The primary weakness is CWE-434: Unrestricted Upload of File with Dangerous Type. The application does not adequately constrain uploaded content to safe file types or ensure that uploaded files cannot be executed as server-side scripts. The risk is compounded by CWE-20: Improper Input Validation and CWE-306: Missing Authentication for Critical Function, because upload validation and access-control assumptions do not reliably protect the sensitive operation.
Potential impact
- An attacker may execute arbitrary code in the web server's security context
- Application data and manufacturing or resource-management records could be accessed or modified
- Server credentials, configuration data, or connected service tokens could be exposed
- The compromised host could be used for lateral movement or persistence
- Business operations and system availability could be disrupted
General mitigation guidance
Mitigation generally focuses on treating every uploaded file as untrusted data and enforcing authorization before processing it.
Common defensive patterns include:
- Allowing only narrowly defined file types based on validated content, not client-supplied names or MIME types
- Storing uploads outside web-accessible and executable directories
- Disabling server-side script execution in upload locations
- Generating server-controlled filenames and rejecting path-related metadata
- Enforcing strict authentication and authorization for upload operations
- Making registration and invitation policies secure by default
- Ensuring authorization middleware propagates routing and policy failures rather than silently allowing requests
- Applying least privilege to the web process and its filesystem access
- Limiting upload size, rate, and storage quotas, with malware or content inspection where appropriate
How teams detect issues like this
High-level detection approaches include:
- Static analysis rules for unrestricted file-upload handlers, unsafe path construction, and server-side execution in upload directories
- Code review checks for extension-only validation, client-controlled filenames, web-root storage, and missing authorization middleware
- Tests that verify unauthorized and self-registered accounts cannot reach privileged upload operations
- Web-server and application monitoring for unexpected script files, unusual upload activity, and requests targeting uploaded content
- Policy enforcement requiring non-executable upload storage and explicit authorization checks for sensitive endpoints
- Automated security review tools can help identify dangerous upload sinks and missing access-control checks

