Moodle GeniAI Plugin Cross-Site Scripting Vulnerability
Vulnerability
A cross-site scripting (XSS) vulnerability has been identified in the Moodle GeniAI plugin (local_geniai) version 2.3.6. This vulnerability allows authenticated users with a Teacher role to upload PDFs containing embedded JavaScript. The assistant then provides an unsanitized HTML link to the uploaded file. When other users, including Students and Administrators, click this link, the JavaScript payload executes in their browsers. This issue also reflects a broader problem with the assistant returning raw HTML links that can be used to deliver stored XSS payloads to other users.
Impact
Exploitation of this vulnerability allows for both stored and reflected cross-site scripting. The stored XSS occurs when a PDF with embedded JavaScript is uploaded and then accessed via an unsanitized link, leading to script execution. The reflected XSS happens when malicious input is sent through the chatbot, which is then rendered unsanitized in the chat interface, causing immediate script execution.
Reproduction
To reproduce this vulnerability, upload a PDF containing JavaScript payloads as a Teacher. The assistant will provide a link to the uploaded PDF. When a Student clicks this link, the JavaScript payload executes. Additionally, the vulnerability can be demonstrated by sending a crafted input through the GeniAI chatbot, which will be reflected back unsanitized, executing the embedded JavaScript. This vulnerability can also be reproduced by prompting the assistant to return a link to the uploaded PDF after a malicious file has been uploaded. If the assistant provides an HTML link, clicking it will trigger the stored XSS payload.
Remediation
It is recommended that the plugin be updated to a version that addresses this vulnerability. Moodle users can check the official Moodle plugin directory for the latest version of the GeniAI plugin.
Vulnerability Rating
Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.
