IntelOwl icon indicating copy to clipboard operation
IntelOwl copied to clipboard

Add HaveIBeenPwned (HIBP) Analyzer for Breach and Compromised Password Checks

Open R1sh0bh-1 opened this issue 10 months ago • 3 comments

Name

HaveIBeenPwned

Link

  • Official site & API docs: https://haveibeenpwned.com/API/v3
  • Maintained by: Troy Hunt (security expert)

Type of analyzer

Observable
(Supports email, domain, and generic observables. Could extend to password/hash checks via k-anonymity mode.)

Why should we use it

HaveIBeenPwned (HIBP) is one of the most trusted and widely-used free resources for checking data breaches and compromised credentials. It tracks over 600+ breaches affecting billions of accounts and 12+ billion pwned passwords.

Key benefits for IntelOwl users (SOCs, incident responders, threat hunters):

  • Enrich email observables with breach history (e.g., which breaches an email appeared in, including dates, pwn count, and leaked data classes like passwords/emails).
  • Check domains for associated breached accounts or stealer log exposures.
  • Detect credential-stuffing risks via pwned password checks (using privacy-preserving k-anonymity—no full password sent).
  • Complements existing analyzers like EmailRep, Dehashed_Search (paid), LeakCheck, but HIBP is free (basic access), authoritative, and frequently updated.
  • No current HIBP integration exists in IntelOwl (confirmed via repo search, analyzer docs, and issues).
  • Adds huge value for credential exposure detection in phishing/incident response playbooks.

This analyzer would make IntelOwl more comprehensive for everyday threat intel workflows.

Possible implementation

  • Base class: Inherit from ObservableAnalyzer (in api_app/analyzers_manager/classes.py).
  • File location: api_app/analyzers_manager/observable_analyzers/have_i_been_pwned.py
  • Supported observables:
    • email → Use /api/v3/breachedaccount/{email} (with ?truncateResponse=false for full details).
    • domain → Use /api/v3/breacheddomain/{domain} or /api/v3/breaches?domain={domain}.
    • generic (or hash) → Use /api/v3/range/{first5chars_of_SHA1} for pwned password checks (k-anonymity mode).
  • Configuration / Secrets:
    • Optional API key (hibp-api-key) stored in secrets (required for email/domain breach checks; free test key available for development).
    • User-Agent header: "IntelOwl-HIBP-Analyzer" (mandatory per HIBP rules).
  • Core logic in run() method:
    • Determine observable type.
    • Build request with headers (API key if provided).
    • Handle responses:
      • 200 → Parse JSON (breaches list with Name, BreachDate, PwnCount, DataClasses, etc.).
      • 404 → No breaches found (return empty list).
      • 429 → Rate limit hit (raise AnalyzerRunException with retry info).
    • Return structured dict: e.g.,
      {
          "success": True,
          "breach_count": 3,
          "breaches": [{"Name": "Adobe", "BreachDate": "2013-10-04", ...}, ...],
          "summary": "Email found in 3 breaches affecting 153M+ accounts"
      }
      
      

PTAL @mlodic – happy to adjust the proposal based on your feedback. Planning to implement soon if approved!

R1sh0bh-1 avatar Jan 16 '26 14:01 R1sh0bh-1

we already have this, whats' the difference?

mlodic avatar Jan 16 '26 15:01 mlodic

You’re right there is an existing HIBP analyzer. Thanks for pointing it out.

After reviewing the current implementation, my issue is not about adding a duplicate analyzer, but about extending what is currently a very minimal email-only wrapper into a more complete HIBP integration.

What the current analyzer does

  • Supports only /api/v3/breachedaccount/{email}.

  • Returns raw JSON without normalization or summary.

  • No observable-type routing (email vs domain vs generic).

  • No support for:

    • Domain breach lookups
    • Pwned password checks (k-anonymity /range API)
  • Missing mandatory User-Agent header per HIBP API rules.

  • No explicit handling for common cases like 404 (no breach) or 429 (rate limit).

What my proposal aims to add

  • Extend the existing analyzer to support:

    • Domain observables
    • Password/hash exposure checks via k-anonymity
  • Add proper error handling and IntelOwl-style structured output (summary, counts, normalized fields).

  • Make API key usage and headers explicit and compliant with HIBP requirements.

So yes HIBP support exists today, but in a basic form limited to email checks. My intent is to build on top of it, not reintroduce it.

If preferred, I’m happy to submit a PR that enhances the existing analyzer instead of adding anything new.

R1sh0bh-1 avatar Jan 16 '26 15:01 R1sh0bh-1

sure, I'll assign you. Considering those are endpoints doing different things, they need to be 2 different new analyzers, sharing part of the code. Also, consider that only "/api/v3/range/{first5chars_of_SHA1}" endpoint is free to be used without any API keys. All the other endpoints require a paid key, you need to use their integration test API key to perform actual tests and provide meaningful results.

mlodic avatar Jan 17 '26 06:01 mlodic