Skip to content

Add DarkEye TI provider (HaveIBeenRansom and Breach House) - #965

Open
Juan Manuel Tejada (juanmill4) wants to merge 1 commit into
microsoft:mainfrom
juanmill4:add-darkeye-ti-provider
Open

Juan Manuel Tejada (juanmill4) wants to merge 1 commit into
microsoft:mainfrom
juanmill4:add-darkeye-ti-provider

Conversation

@juanmill4

Copy link
Copy Markdown

What this adds

A DarkEye threat intelligence provider. DarkEye has two products with a paid API, and this one provider covers both:

  • HaveIBeenRansom: ransomware leaks and data breaches. GET /api/metadata/domain/{observable} or /api/metadata/email/{observable}, up to 5 pages.
  • Breach House: ransomware victims, data breaches, leads and stealer logs. GET /api/v1/search?q={observable}.

Supported observables: dns, hostname, email. No query subtypes.

Each product has its own optional key. A product without a key is not queried and its host is never contacted. At least one key is required; with neither, the provider raises MsticpyConfigError.

TIProviders:
  DarkEye:
    Args:
      HIBRAuthKey: "..."
      BreachHouseAuthKey: "..."
    Primary: True
    Provider: "DarkEye"

What a result looks like

One row per observable. Details has Count, Categories, Truncated, a Products entry per product (ok, error or not queried, with its record count) and Records. Each record has product (HaveIBeenRansom or Breach House), category (ransomware, breach, leak, stealer or lead), plus id, title, website, group, country and discovery date when the API returns them.

Severity never goes above warning, because a listing means the organisation or address appears in leaked or listed data, not that the observable is hostile. Leads, and no records at all, are information: no record only means nothing was found. If every queried product fails, the row is QUERY_FAILED rather than an empty "not found"; if only one fails, the other's records are returned and the error is in Details.

Only listing metadata is read. HaveIBeenRansom's stealer-content endpoint is not used, no password or credential field is kept from either response, and RawResult holds the reduced records, not the raw API response.

Design choices worth explaining

_run_ti_lookup_query is overridden because one lookup goes to two hosts, each with its own key, and the answer is one combined result. scanmalware does the same. parse_results is kept and reports the same details from a built result.

Two new names in _HTTP_PROVIDER_LEGAL_KWARGS (HIBRAuthKey, BreachHouseAuthKey). lookup.py silently drops any other kwarg, so without this the keys from msticpyconfig.yaml would never reach the provider. A test loads the provider through TILookup from tests/msticpyconfig-test.yaml to check this.

Breach House matching. Its search is free text, so a record is kept only when it is about the observable: the exact address for an email, or the host or one of its subdomains for a hostname (notexample.com and example.com.other.com do not match example.com).

Requests. The key is sent only in the Authorization header of a request to its own host, and redirects are not followed so the header cannot be carried elsewhere. Error messages never include the key or the exception text. Each lookup is bounded: 5 HaveIBeenRansom pages, 25 results per Breach House section, 100 records per product; Truncated says when a limit was hit.

Changes

  • msticpy/context/tiproviders/darkeye.py (new): the provider.
  • msticpy/context/tiproviders/__init__.py: registers DarkEye.
  • msticpy/context/lookup.py: the two key names in _HTTP_PROVIDER_LEGAL_KWARGS.
  • msticpy/resources/mpconfig_defaults.yaml: config definition, both keys optional, Primary defaults to False.
  • tests/context/test_darkeye.py (new) and tests/msticpyconfig-test.yaml.
  • Docs: TIProviders.rst, msticpyconfig.rst and the API page msticpy.context.tiproviders.darkeye.rst.

No new dependencies.

Testing

  • pytest tests/context/test_darkeye.py: 82 passed. All HTTP is mocked with respx, nothing is sent to either API.
  • pytest tests/context/test_lookup.py tests/context/test_tiproviders.py tests/common/test_pkg_config.py tests/config: pass, except test_geo_ip_settings, which fails the same way on untouched main here (no MaxMind setup).
  • ruff check, ruff format, pylint (10.00), pydocstyle --convention=numpy and mypy pass on the new module.

One provider, msticpy/context/tiproviders/darkeye.py, looks up domains,
hostnames and email addresses in the two DarkEye products that have an
API. Each product has its own optional key (HIBRAuthKey,
BreachHouseAuthKey); a product without a key is not queried, and at
least one key is required.

Both products are combined into one result in which every record
carries its product and category (ransomware, breach, leak, stealer,
lead). Only listing metadata is kept. The tests in
tests/context/test_darkeye.py run offline.
@juanmill4

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Darkeye Industries LLC"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant