Summary
Scholars Tracking System 1.0 contains an unrestricted file upload vulnerability in the profile picture upload endpoints that allows authenticated users to upload arbitrary files into a web-accessible directory.
By uploading a PHP script as a profile image and then accessing it via the public uploads/ path, an attacker can execute arbitrary code on the server with the privileges of the web server process.
Affected context
The vulnerability occurs in the Scholars Tracking System 1.0 application where user profile images are handled by update_profile_picture.php and upload_picture.php.
These endpoints accept user-supplied files, store them under their original filenames, and place them in a web-accessible uploads/ directory.
In deployments where the web server is configured to execute PHP files from this directory, any uploaded PHP file can be run as application code.
Exploit preconditions
- Attack surface: HTTP endpoints
update_profile_picture.phpandupload_picture.phpexposed to authenticated users. - Required access: Valid authenticated account with permission to upload or change a profile image.
- Trigger point: Uploading a file with a PHP extension (or any server-executable type) and then making an HTTP request to the resulting
/uploads/<filename>path. - Why exploitation is possible: The application does not validate file type or extension, preserves user-supplied filenames, and stores them in an executable webroot directory, enabling direct execution of attacker-controlled code.
Why this happens
The core issue is the lack of server-side constraints on which files can be uploaded and how they are stored.
The upload handlers:
- Do not verify the MIME type, extension, or content of the uploaded file.
- Preserve the original filename provided by the user.
- Store the file directly in a web-accessible directory that the server is configured to execute PHP from.
This aligns with CWE-434: Unrestricted Upload of File with Dangerous Type, where an application accepts arbitrary file types and places them in a context where they can be interpreted as active content by the server.
Potential impact
- Execution of arbitrary PHP code on the server as the web server user.
- Full compromise of the web application, including reading or modifying application data.
- Installation of web shells or backdoors for persistent access.
- Pivoting to other internal systems reachable from the compromised server.
- Use of the server for further attacks, such as hosting malware or phishing pages.
General mitigation guidance
Effective mitigation focuses on treating file uploads as untrusted data and ensuring they cannot be executed as code:
- Restrict uploads to a strict allowlist of safe file types (e.g., specific image formats) with server-side validation based on both extension and content.
- Normalize and regenerate filenames server-side instead of trusting user-supplied names.
- Store uploaded files outside of any executable webroot, serving them via a controlled mechanism (e.g., a script that streams file bytes).
- Configure the web server to never execute scripts (PHP or other) in upload directories, treating them as static content only.
- Apply least-privilege permissions to the upload directory so that even if misused, the blast radius is reduced.
How teams detect issues like this
Detection typically involves a mix of code-level review and runtime monitoring:
- Static analysis / code review:
- Flag upload handlers that write files to web-accessible paths without extension or content checks.
- Look for use of user-supplied filenames in filesystem paths, especially under directories served by the web server.
- Identify directories configured to execute scripts that are also used as general upload locations.
- Configuration and policy checks:
- Enforce policies that prevent executable handlers (e.g., PHP) from being enabled on upload paths.
- Use automated compliance checks to validate web server configuration against secure baselines.
- Runtime monitoring:
- Log and review file uploads, including filenames, paths, and MIME types.
- Monitor for execution of new or unusual scripts from upload directories and alert on anomalous behavior.

