Rapid7 Vulnerability & Exploit Database

Moodle Teacher Enrollment Privilege Escalation to RCE

Back to Search

Moodle Teacher Enrollment Privilege Escalation to RCE

Disclosed
07/20/2020
Created
10/12/2021

Description

Moodle version 3.9, 3.8 to 3.8.3, 3.7 to 3.7.6, 3.5 to 3.5.12 and earlier unsupported versions allow for a teacher to exploit chain to RCE. A bug in the privileges system allows a teacher to add themselves as a manager to their own class. They can then add any other users, and thus look to add someone with manager privileges on the system (not just the class). After adding a system manager, a 'loginas' feature is used to access their account. Next the system is reconfigured to allow for all users to install an addon/plugin. Then a malicious theme is uploaded and creates an RCE. If all of that is a success, we revert permissions for managers to system default and remove our malicoius theme. Manual cleanup to remove students from the class is required. This module was tested against Moodle version 3.9

Author(s)

  • HoangKien1020
  • lanz
  • h00die

Platform

PHP

Architectures

php

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/multi/http/moodle_teacher_enrollment_priv_esc_to_rce
msf exploit(moodle_teacher_enrollment_priv_esc_to_rce) > show targets
    ...targets...
msf exploit(moodle_teacher_enrollment_priv_esc_to_rce) > set TARGET < target-id >
msf exploit(moodle_teacher_enrollment_priv_esc_to_rce) > show options
    ...show and set options...
msf exploit(moodle_teacher_enrollment_priv_esc_to_rce) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;