Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
Security

Breached Password and Credential Stuffing Guard Middleware for Small Web Apps

Build drop-in middleware for Express, Django or Laravel that protects login and sign-up forms in two ways: it refuses passwords that appear in known breaches using a privacy-preserving lookup, and it detects credential stuffing attacks from patterns across many login attempts. It is aimed at small e-commerce, school and clinic sites that cannot afford an enterprise bot management product.

Difficulty

Beginner

Achievable by one student in a semester with familiar tools.
Effort

1 semester · 2 students

Deliverables

7 to ship

4 optional extras

Suggested stack

Express (Node.js) or DjangoHave I Been Pwned Pwned Passwords APIRedisSQLite or PostgreSQLk6 for load and attack simulation
A suggestion, not a requirement. Swap anything for what you already know.

What you should ship

  • Middleware that checks new and changed passwords against breached password data using the k-anonymity range API
  • An optional offline mode using a downloaded hash list for sites without reliable outbound internet
  • Login attempt tracking per IP, per account and per network range in Redis
  • Detection rules for stuffing patterns: many accounts per source, high failure ratios, known breached usernames
  • Graduated responses: slow down, require a challenge, temporarily lock, notify the account owner
  • An admin page of recent attacks and affected accounts
  • A simulated attack test with a realistic mix of attack and normal traffic

If you have time left

  • A Laravel or WordPress plugin version
  • Notifying users at login when their current password appears in a new breach
  • Shared, anonymised attack signals between several sites
  • Passkey sign-up prompts for accounts that were targeted

The problem: your users' passwords already leaked somewhere else

Most people reuse passwords. When any site they use is breached, attackers take the leaked email and password pairs and try them automatically on thousands of other sites. This is credential stuffing, and it works because a fraction of those pairs open real accounts. Small online stores, school portals and clinic booking sites are attractive targets: they hold addresses, phone numbers and sometimes stored payment or wallet details, and they rarely have bot protection.

Two defences help a lot: stop users from choosing passwords already known to be breached, and notice when logins arrive in the pattern of a stuffing attack. Large companies buy both. Small sites get neither.

What already exists and the gap

  • Have I Been Pwned's Pwned Passwords service lets a site check whether a password appears in known breaches by sending only the first five characters of its hash (a k-anonymity range query).
  • Google Password Checkup warns users in their browser about breached passwords.
  • Cloudflare and other edge providers offer leaked credential detection and bot management.
  • Rate limiting libraries for Express or Django limit requests per IP but miss distributed attacks using many addresses.

The gap is a single, well-tested package for small sites that combines both defences, works on cheap hosting, has an offline option and explains what it is doing in an admin page.

Inspiration

"Protocols for Checking Compromised Credentials" by Lucy Li, Bijeeta Pal, Junade Ali, Nick Sullivan, Rahul Chatterjee and Thomas Ristenpart (ACM CCS 2019) gave the first formal analysis of compromised credential checking services such as Have I Been Pwned and Google Password Checkup. It showed that hash prefixes leak information that can make remote guessing much more effective, and proposed stronger protocols. Your project uses the existing service but must handle that leakage carefully, for example by checking passwords only at sign-up and change, not on every login.

What you build

  • Developers add one middleware and a few lines of config to their login and registration routes.
  • Users see a clear message when their chosen password is breached, with advice to use a password manager or passkey.
  • Site owners see an admin page of attack waves, accounts targeted and actions taken.

The technically interesting part

  • Privacy-preserving lookup. Hash the password, send only the prefix, compare suffixes locally, and add padding so the response size does not leak anything. Never log the password or the full hash.
  • Spotting distributed attacks. Stuffing tools spread requests across many IP addresses. Look at patterns across the whole site: many distinct usernames failing in a short window, a high share of usernames that do not exist, or usernames that match a known breach list.
  • Not punishing real users. Locking accounts on every failure lets attackers lock out real customers. Use graduated responses and make them configurable.
  • Telling the account owner. When an attack hits an account with the correct password, the owner should get an email or SMS straight away, with a link to change the password and sign out other sessions.
  • Sites behind proxies. Many small sites sit behind a CDN or a shared host, so the visible IP address is the proxy's. Read forwarded headers only from trusted proxies, or attackers can spoof their address.
  • Fast and cheap. Every check adds latency to login. Keep counters in Redis and measure the overhead.

How to evaluate it

  • Simulated attacks: with k6, replay stuffing attacks from a fake breached list against a test site, mixed with normal login traffic, and measure detection time and false lock-outs.
  • Overhead: added latency per login and sign-up request.
  • Breached password check: test with known breached and random strong passwords.
  • Ease of adoption: time for a developer outside the team to install it in a sample app.
  • Lookup safety: confirm with a packet capture that no full hash or password ever leaves the server.

Suggested plan

  • Weeks 1 to 3: build a sample app with login; integrate the Pwned Passwords range API.
  • Weeks 4 to 7: attempt tracking and detection rules.
  • Weeks 8 to 10: graduated responses and admin page.
  • Weeks 11 to 14: attack simulation, tuning and documentation.
  • Week 15: demo and report.

Path to a product

Open source middleware with good documentation can be widely used, and a hosted dashboard that shares attack signals across many small sites is a natural paid layer. It also gives a strong story for backend and application security roles.

Scope warning

Test only against your own sample applications. Do not use real leaked credential lists; generate fake ones. Pick one framework first.

Learn what you need on Sefism

Get help with this idea

This is a good first security project with a real user. Tauseef can help you design the detection rules, plan a fair simulation and package the middleware so others can adopt it. If you are new here, create a free account first.

Ideas and guidance, not finished projects

These are project ideas and scoping guidance, published free for students to use as a starting point. I do not build, write, or sell final-year projects, and I do not complete coursework for anyone. Take an idea, make it yours, and build it.

Not sure this one fits you?

I help students pick an idea that matches their skills and their deadline, then scope it down until it is finishable. Guidance only, never done for you.

Discuss this idea
Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.