CVE-2022-0332:
SQL injection in Moodle
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.88419%
CWE
Published
1/28/2022
Updated
2/3/2023
KEV Status
No
Technology
PHP
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
moodle/moodle | composer | >= 3.11, < 3.11.5 | 3.11.5 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from improper handling of the 'sortorder' parameter in user attempt fetching functionality. The pre-patch code:
- Allowed arbitrary SQL fragments in 'sortorder' parameter (PARAM_TEXT instead of specific validation)
- Directly concatenated user input into SQL ORDER BY clause without whitelisting
- The patch added get_safe_orderby validation restricting allowed fields (id/firstname/lastname) and directions (ASC/DESC)
- Test cases verify protection against invalid sort parameters
- CWE-89 classification confirms classic SQL injection pattern through direct SQL command element manipulation