In Moodle through 3.5.12, v3.6.0-beta through 3.7.6, v3.8.0-beta through 3.8.3, v3.9.0-beta through 3.9.0, teachers of a course were able to assign themselves the manager role within that course.
CWE-863 - Incorrect Authorization
Authorization is a security mechanism performed by an application to grant or deny access to the requested resources by verifying the privileges of the user. When an application lacks effective authorization mechanisms, it enables unauthorized users to gain unintended privileges and illegitimate access to resources. Such a vulnerability may result in exposure of sensitive information, denial of service, arbitrary code execution, and complete system takeover.