The vulnerability stems from improper sanitization of admin-provided HTML in header/footer settings. Moodle's admin settings typically use admin_setting_configtextarea which accepts PARAM_RAW (raw text input). While admins are permitted to add custom HTML/JS, the vulnerability arises when this content is rendered without context-aware escaping in page templates. The combination of PARAM_RAW input handling in admin settings and lack of output encoding in template rendering creates the XSS vector. The disputed nature by the vendor confirms this is an intentional admin capability, but the CVE argues it's a vulnerability when admin-compromised accounts inject malicious scripts affecting other users.