CVE-2025-60511
Executive Summary
CVE-2025-60511 is an Insecure Direct Object Reference (IDOR) vulnerability in the Moodle OpenAI Chat Block plugin version 3.0.1 (2025021700). The flaw resides in /blocks/openai_chat/api/completion.php, where the blockId parameter is not properly validated. An authenticated student can impersonate another user's block (e.g., an administrator) by manipulating this parameter, allowing them to send queries that execute with the target block's configuration. This can expose administrator-only Source of Truth entries, alter model behavior, and potentially misuse API resources. The vulnerability is currently unpatched, and no official fix has been released.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects a Moodle plugin distributed via the Moodle plugins directory. Since Moodle plugins are not managed via NPM, PyPI, Go, or Ruby, the supply chain risk is limited to the plugin's update mechanism. Administrators should monitor the plugin's page for updates and verify the integrity of downloaded packages.
CVSS Breakdown & Threat Level
The CVSS score is listed as 0.0, indicating that no official CVSS vector has been assigned. Based on the vulnerability description, a reasonable assessment would be:
- Attack Vector (AV): Network (N) – The vulnerability is exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): Low (L) – An authenticated student account is needed.
- User Interaction (UI): None (N) – No user interaction is required.
- Scope (S): Changed (C) – The vulnerable component impacts resources beyond its security scope.
- Confidentiality (C): High (H) – Administrator-only Source of Truth entries can be exposed.
- Integrity (I): High (H) – Model behavior can be altered.
- Availability (A): Low (L) – API resources could be misused, potentially leading to denial of service.
Estimated CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:L
Estimated Base Score: 9.0 (Critical)
Deep Dive & Mechanics
The vulnerability is a classic IDOR (CWE-639) in the Moodle OpenAI Chat Block plugin. The plugin allows users to create and configure chat blocks, each identified by a blockId. The API endpoint /blocks/openai_chat/api/completion.php processes chat queries and uses the blockId parameter to load the block's configuration, including API keys, model settings, and Source of Truth entries.
The flaw is that the endpoint does not verify whether the authenticated user owns the specified blockId. An attacker can enumerate or guess valid blockId values belonging to other users, including administrators. By sending a request with a victim's blockId, the attacker can:
- Expose Source of Truth entries: Administrator blocks may contain sensitive data or custom instructions.
- Alter model behavior: The attacker can send queries that use the administrator's configuration, potentially bypassing restrictions.
- Misuse API resources: The attacker can consume the administrator's API quota or incur costs.
The attack requires only a valid session cookie from an authenticated student account. No special privileges are needed.
Vulnerable vs. Patched Code
Vulnerable Code (simplified):
// /blocks/openai_chat/api/completion.php
$blockId = required_param('blockId', PARAM_INT);
$block = $DB->get_record('block_instances', array('id' => $blockId));
// No ownership check
$config = unserialize($block->configdata);
// Process query with $config
Patched Code (hypothetical):
// /blocks/openai_chat/api/completion.php
$blockId = required_param('blockId', PARAM_INT);
$block = $DB->get_record('block_instances', array('id' => $blockId));
// Verify ownership
$context = context_block::instance($blockId);
require_capability('moodle/block:view', $context);
// Or check userid
if ($block->userid != $USER->id) {
print_error('invalidblock', 'block_openai_chat');
}
$config = unserialize($block->configdata);
// Process query with $config
The patched version adds an ownership check using Moodle's capability system or a direct user ID comparison.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A Moodle instance with the OpenAI Chat Block plugin version 3.0.1 installed.
- An authenticated student account.
Exploitation Steps:
Identify a target block: Use a tool like Burp Suite or a simple script to enumerate
blockIdvalues. Blocks are typically sequential integers.Craft the request: Send a POST request to
/blocks/openai_chat/api/completion.phpwith the following parameters:blockId: The target block's ID (e.g., 42).message: A query to send to the OpenAI API.
Example using
curl:curl -X POST \ 'https://target-moodle.com/blocks/openai_chat/api/completion.php' \ -H 'Cookie: MoodleSession=your_session_cookie' \ -d 'blockId=42&message=List all Source of Truth entries.'Analyze the response: The response will contain the OpenAI API output, which may include sensitive data from the administrator's configuration.
Expected Outcome: The attacker receives the OpenAI response as if they were the administrator, exposing any Source of Truth entries or custom instructions.
Blue Team
Detection Steps:
Monitor API access logs: Look for unusual patterns in
/blocks/openai_chat/api/completion.phprequests, especially from student accounts accessing multipleblockIdvalues.Check for enumeration: A sudden spike in requests with different
blockIdparameters from a single user may indicate enumeration.Review block ownership: Regularly audit block instances to ensure that only authorized users have access to sensitive blocks.
Hunting Query (Splunk):
index=web sourcetype=access_combined
uri="/blocks/openai_chat/api/completion.php"
| stats count by clientip, user, blockId
| where count > 10
Indicators of Compromise (IOCs)
Network IOCs:
- Repeated requests to
/blocks/openai_chat/api/completion.phpwith varyingblockIdparameters. - Requests from student accounts to
blockIdvalues not associated with their own blocks.
- Repeated requests to
File IOCs:
- Unusual entries in Moodle's
block_instancestable whereuseriddoes not match the expected owner.
- Unusual entries in Moodle's
Log IOCs:
- Moodle error logs showing
invalidblockerrors (if patched) or access to unauthorized blocks.
- Moodle error logs showing
Detection Engineering
YARA Rule
rule CVE_2025_60511_IDOR_Moodle {
meta:
description = "Detects exploitation attempts of CVE-2025-60511 in Moodle OpenAI Chat Block"
author = "Valters IT"
date = "2025-04-10"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2025-60511"
strings:
$endpoint = "/blocks/openai_chat/api/completion.php"
$param_blockId = "blockId="
$param_message = "message="
condition:
$endpoint and $param_blockId and $param_message
}
Sigma Rule
title: CVE-2025-60511 - Moodle OpenAI Chat Block IDOR Exploitation
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects attempts to exploit an IDOR vulnerability in Moodle OpenAI Chat Block plugin
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: '/blocks/openai_chat/api/completion.php'
cs-uri-query|contains: 'blockId='
condition: selection
falsepositives:
- Legitimate use by administrators
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-60511 - Moodle OpenAI Chat Block IDOR Exploitation"; flow:to_server,established; content:"POST"; http_method; content:"/blocks/openai_chat/api/completion.php"; http_uri; content:"blockId="; http_client_body; classtype:attempted-user; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin: If the plugin is not critical, disable it until a patch is available.
- Restrict access: Use Moodle's role-based permissions to limit who can use the OpenAI Chat Block.
- Monitor logs: Enable detailed logging for the API endpoint and review regularly.
Long-term Fix:
- Apply a patch from the plugin developer once released. The fix should include proper ownership validation using Moodle's capability system.
- Consider implementing a Web Application Firewall (WAF) rule to block requests with suspicious
blockIdpatterns.
Workaround:
- Modify the plugin code manually to add an ownership check (see patched code example above). This is not recommended for production without thorough testing.
Valters IT
Securing Digital Frontiers