Summary
NotrinosERP's employee document handler accepts uploaded files without validating their extension, MIME type, or content. An authenticated user with SA_EMPLOYEE permission may upload a PHP file beneath the web root, where requesting it could execute code on the server.
Affected context
The issue occurs in the employee document upload flow in hrm/manage/employees.php, specifically through tab_documents(). It affects deployments where uploaded files are stored in a web-accessible directory and the server is configured to execute uploaded PHP files. The description identifies affected NotrinosERP versions from 1.0.0 until 1.1.0.
Exploit preconditions
- Attack surface: The employee document upload functionality in the web application
- Required access: An authenticated account with SA_EMPLOYEE permission
- Trigger point: Uploading a document and then requesting its stored path
- Why exploitation is possible: The handler stores the client-supplied filename and accepts executable content without adequate file validation; the destination is beneath the web root
Why this happens
The handler trusts uploaded file names and content without restricting executable file types or validating the content. Storing an executable upload in a web-accessible location can allow the web server to interpret it as code when requested. This is primarily CWE-434: Unrestricted Upload of File with Dangerous Type. CWE-22 is also associated with this vulnerability, but the described behavior does not establish that a path traversal is required for exploitation.
Potential impact
- An attacker with the required permission could execute code on the server
- The application or its runtime environment could be compromised
- Accessible data could be exposed, altered, or deleted
- The compromised server could be used to affect connected systems, depending on its permissions and network access
General mitigation guidance
Defensive patterns focus on limiting accepted content and preventing uploaded files from being interpreted as executable code.
- Allow only business-required file types, using content inspection rather than trusting client-supplied names or MIME types
- Generate server-controlled storage names and avoid using raw client filenames as filesystem paths
- Store uploads outside the web root, or serve them through a non-executable download path
- Apply strict size limits and validate files before making them available
- Restrict the application's filesystem and service permissions to the minimum needed
How teams detect issues like this
- Use static analysis to identify upload handlers that trust client filenames or omit file type and content checks
- Review whether uploaded files are stored beneath the web root or in locations where script execution is enabled
- Monitor upload and web-server access logs for executable file extensions and requests to uploaded document paths
- Enforce code-review or CI policies requiring safe storage and validation practices for file uploads

