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

105 lines
4.4 KiB
Markdown
Raw Normal View History

2022-04-28 23:27:22 +00:00
# Drupal
2022-04-28 16:01:33 +00:00
2022-05-01 16:57:45 +00:00
## Drupal
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>Support HackTricks and get benefits!</strong></summary>
2022-09-09 11:28:04 +00:00
- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/carlospolopm)**.**
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- **Share your hacking tricks by submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
2022-04-28 16:01:33 +00:00
</details>
2022-05-01 16:57:45 +00:00
## Username enumeration
2022-04-28 16:01:33 +00:00
2022-05-01 16:57:45 +00:00
### Register
2021-11-30 16:46:07 +00:00
In _/user/register_ just try to create a username and if the name is already taken it will be notified:
![](<../../.gitbook/assets/image (254).png>)
2022-05-01 16:57:45 +00:00
### Request new password
If you request a new password for an existing username:
![](<../../.gitbook/assets/image (255).png>)
If you request a new password for a non-existent username:
![](<../../.gitbook/assets/image (256).png>)
2022-05-01 16:57:45 +00:00
## Number of users enumeration
Accessing _/user/\<number>_ you can see the number of existing users, in this case is 2 as _/users/3_ returns a not found error:
![](<../../.gitbook/assets/image (257).png>)
2022-09-09 11:00:52 +00:00
![](<../../.gitbook/assets/image (227) (1) (1).png>)
2022-05-01 16:57:45 +00:00
## Hidden pages enumeration
**Fuzz `/node/$` where `$` is a number** (from 1 to 500 for example).\
You could find **hidden pages** (test, dev) which are not referenced by the search engines.
2022-05-01 16:57:45 +00:00
### Installed modules info
2021-09-20 10:57:53 +00:00
```bash
#From https://twitter.com/intigriti/status/1439192489093644292/photo/1
#Get info on installed modules
curl https://example.com/config/sync/core.extension.yml
curl https://example.com/core/core.services.yml
# Download content from files exposed in the previous step
curl https://example.com/config/sync/swiftmailer.transport.yml
```
2022-05-01 16:57:45 +00:00
## Code execution inside Drupal with admin creds
2021-11-30 16:46:07 +00:00
You need the **plugin php to be installed** (check it accessing to _/modules/php_ and if it returns a **403** then, **exists**, if **not found**, then the **plugin php isn't installed**)
2022-04-28 23:27:22 +00:00
Go to _Modules_ -> (**Check**) _PHP Filter_ -> _Save configuration_
2022-09-09 11:00:52 +00:00
![](<../../.gitbook/assets/image (247) (1).png>)
Then click on _Add content_ -> Select _Basic Page_ or _Article -_> Write _php shellcode on the body_ -> Select _PHP code_ in _Text format_ -> Select _Preview_
![](<../../.gitbook/assets/image (253).png>)
2022-05-01 16:57:45 +00:00
## Post Exploitation
2021-04-01 21:42:37 +00:00
2022-05-01 16:57:45 +00:00
### Read settings.php
2021-04-01 21:42:37 +00:00
```
2021-04-01 21:42:37 +00:00
find / -name settings.php -exec grep "drupal_hash_salt\|'database'\|'username'\|'password'\|'host'\|'port'\|'driver'\|'prefix'" {} \; 2>/dev/null
```
2022-05-01 16:57:45 +00:00
### Dump users from DB
2021-04-01 21:42:37 +00:00
```
2021-04-01 21:42:37 +00:00
mysql -u drupaluser --password='2r9u8hu23t532erew' -e 'use drupal; select * from users'
```
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>Support HackTricks and get benefits!</strong></summary>
2022-09-09 11:28:04 +00:00
- Do you work in a **cybersecurity company**? Do you want to see your **company advertised in HackTricks**? or do you want to have access to the **latest version of the PEASS or download HackTricks in PDF**? Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- **Join the** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** [**🐦**](https://github.com/carlospolop/hacktricks/tree/7af18b62b3bdc423e11444677a6a73d4043511e9/\[https:/emojipedia.org/bird/README.md)[**@carlospolopm**](https://twitter.com/carlospolopm)**.**
2022-04-28 16:01:33 +00:00
2022-09-09 11:28:04 +00:00
- **Share your hacking tricks by submitting PRs to the** [**hacktricks github repo**](https://github.com/carlospolop/hacktricks)**.**
2022-04-28 16:01:33 +00:00
</details>