TheHive is one of the most widely deployed open-source case management platforms in security operations. Its strength is organizing investigations — tracking observables, linking cases, and coordinating analyst workflows. But case management without context is just bookkeeping. When an analyst adds a suspicious IP or domain to a case, they need enrichment data to make triage decisions. That is where TheHive IOC enrichment integrations become critical, and where DFIR Platform's multi-source API fits into the architecture.
This guide walks through integrating DFIR Platform as a Cortex analyzer for TheHive, so every observable added to a case is automatically enriched with data from 14+ threat intelligence sources — without manual lookups, without switching tools, and without managing a dozen upstream API keys.
Why TheHive Needs External IOC Enrichment
TheHive itself does not perform IOC analysis. It stores observables — IPs, domains, hashes, URLs — and provides a structured interface for managing them within investigations. The analysis layer is delegated to Cortex, TheHive's companion project, which runs "analyzers" against observables and writes results back into the case.
Out of the box, Cortex ships with analyzers for individual sources: VirusTotal, Shodan, PassiveTotal, AbuseIPDB, and others. Each analyzer queries one source, returns one result, and requires its own API key configuration. For a SOC team that wants comprehensive enrichment, this means:
- Managing API keys for 8-12 different services
- Monitoring rate limits and quotas across each service independently
- Waiting for sequential analyzer execution (or configuring parallel runs)
- Manually correlating results from multiple analyzer reports per observable
DFIR Platform collapses this into a single API call. One analyzer, one API key, 14+ sources queried in parallel, one normalized response. The result is faster enrichment, simpler configuration, and lower operational overhead.
Architecture Overview
The integration follows TheHive's standard analyzer pattern:
[TheHive Case]
|
v
[Observable Added] --> [Cortex Analyzer Triggered]
|
v
[DFIR Platform API]
api.dfir-lab.ch/v1
|
v
[14+ Sources Queried]
(AbuseIPDB, Shodan, PassiveDNS,
Spamhaus, VirusTotal, etc.)
|
v
[Normalized Response]
|
v
[Report Written to TheHive Case]
The Cortex analyzer acts as the bridge. When an analyst adds an observable to a case and runs analysis, Cortex calls the DFIR Platform IOC enrichment API, receives the aggregated result, and formats it as a Cortex report that appears directly in TheHive's case view.
Prerequisites
Before setting up the integration, you need:
- TheHive 4.x or 5.x installed and running
- Cortex 3.x installed and configured as an analysis backend for your TheHive instance
- Python 3.8+ on the Cortex server (for running the custom analyzer)
- DFIR Platform API key — sign up at platform.dfir-lab.ch (free tier includes 100 credits/month, no credit card required)
- Network connectivity from the Cortex server to
api.dfir-lab.chon port 443
Getting Started
If you do not yet have a DFIR Platform account, create one at platform.dfir-lab.ch. The free tier provides 100 credits per month, which covers approximately 20-33 IOC enrichment lookups (3-5 credits per lookup depending on IOC type). No credit card is required.
Once registered, generate an API key from the dashboard. You will need this key for the Cortex analyzer configuration.
Building the Cortex Analyzer
Cortex analyzers are Python modules that follow a specific structure. Each analyzer lives in its own directory with a Python script and a JSON descriptor. Below is a complete implementation.
Directory Structure
DFIRPlatform_IOCEnrichment/
DFIRPlatform_IOCEnrichment.py
DFIRPlatform_IOCEnrichment.json
requirements.txt
Analyzer Descriptor (DFIRPlatform_IOCEnrichment.json)
{ "name": "DFIRPlatform_IOCEnrichment", "version": "1.0", "author": "DFIR Lab", "url": "https://dfir-lab.ch", "license": "MIT", "description": "Multi-source IOC enrichment via DFIR Platform API (14+ sources)", "command": "DFIRPlatform_IOCEnrichment/DFIRPlatform_IOCEnrichment.py", "dataTypeList": ["ip", "domain", "hash", "url"], "configurationItems": [ { "name": "api_key", "description": "DFIR Platform API key from platform.dfir-lab.ch", "type": "string", "multi": false, "required": true }, { "name": "api_url", "description": "DFIR Platform API base URL", "type": "string", "multi": false, "required": false, "defaultValue": "https://api.dfir-lab.ch/v1" } ]}Analyzer Script (DFIRPlatform_IOCEnrichment.py)
#!/usr/bin/env python3"""Cortex analyzer for DFIR Platform IOC enrichment.""" import requestsfrom cortexutils.analyzer import Analyzer class DFIRPlatformAnalyzer(Analyzer): """Query DFIR Platform API for multi-source IOC enrichment.""" def __init__(self): Analyzer.__init__(self) self.api_key = self.get_param( "config.api_key", None, "DFIR Platform API key is required" ) self.api_url = self.get_param( "config.api_url", "https://api.dfir-lab.ch/v1" ) def run(self): data_type = self.data_type observable = self.get_data() # Map TheHive data types to DFIR Platform IOC types type_map = { "ip": "ip", "domain": "domain", "hash": "hash", "url": "url", } ioc_type = type_map.get(data_type) if not ioc_type: self.error(f"Unsupported data type: {data_type}") return headers = { "X-API-Key": self.api_key, "Content-Type": "application/json", } payload = { "type": ioc_type, "value": observable, } try: response = requests.post( f"{self.api_url}/ioc/enrich", headers=headers, json=payload, timeout=30, ) response.raise_for_status() result = response.json() self.report({ "risk_score": result.get("risk_score", 0), "verdict": result.get("verdict", "unknown"), "sources_queried": result.get("sources_queried", 0), "sources_flagged": result.get("sources_flagged", 0), "enrichment": result.get("enrichment", {}), "tags": result.get("tags", []), "raw": result, }) except requests.exceptions.RequestException as e: self.error(f"DFIR Platform API request failed: {str(e)}") def summary(self, raw): taxonomies = [] level = "info" risk_score = raw.get("risk_score", 0) if risk_score >= 75: level = "malicious" elif risk_score >= 40: level = "suspicious" elif risk_score > 0: level = "safe" taxonomies.append( self.build_taxonomy( level, "DFIRPlatform", "RiskScore", risk_score ) ) taxonomies.append( self.build_taxonomy( "info", "DFIRPlatform", "Sources", f"{raw.get('sources_flagged', 0)}/{raw.get('sources_queried', 0)}", ) ) return {"taxonomies": taxonomies} if __name__ == "__main__": DFIRPlatformAnalyzer().run()Requirements (requirements.txt)
cortexutils
requests
Installing the Analyzer in Cortex
-
Copy the
DFIRPlatform/directory to your Cortex analyzers path (typically/opt/cortex/analyzers/or the path configured inapplication.conf). -
Install dependencies:
cd /opt/cortex/analyzers/DFIRPlatformpip3 install -r requirements.txt-
In the Cortex web interface, navigate to Organization > Analyzers and enable DFIRPlatform.
-
Configure the analyzer with your API key from platform.dfir-lab.ch.
-
Restart Cortex if necessary (depends on your version and configuration).
Using the Integration in TheHive
Once the analyzer is configured in Cortex, it appears in TheHive's analysis options for any observable. The workflow is straightforward:
Manual Analysis
- Open a case in TheHive.
- Navigate to the Observables tab.
- Add or select an observable (IP, domain, hash, or URL).
- Click Analyze and select DFIRPlatform.
- The enrichment report appears in the observable's analyzer results within seconds.
The report includes the risk score, the number of sources that flagged the indicator, and the full enrichment data from all queried sources.
Automated Analysis on Observable Creation
TheHive supports auto-analysis — running specific analyzers automatically when observables are added to a case. To enable this:
- In Cortex, set the DFIRPlatform analyzer to auto-run for the relevant data types.
- Every observable added to any case will be enriched automatically without analyst intervention.
This is particularly valuable for cases created from automated alert ingestion (SIEM alerts, email reports, SOAR playbooks), where observables arrive in bulk and need immediate context.
Standalone Python Integration
If you are not using Cortex, or if you want to enrich observables before they reach TheHive, you can call the DFIR Platform API directly and push results to TheHive via its REST API.
#!/usr/bin/env python3"""Enrich IOCs via DFIR Platform and add results to TheHive case.""" import requests DFIR_API_KEY = "your-dfir-platform-api-key"DFIR_API_URL = "https://api.dfir-lab.ch/v1"THEHIVE_URL = "https://your-thehive-instance"THEHIVE_API_KEY = "your-thehive-api-key" def enrich_ioc(ioc_type: str, value: str) -> dict: """Query DFIR Platform for IOC enrichment.""" headers = { "X-API-Key": DFIR_API_KEY, "Content-Type": "application/json", } response = requests.post( f"{DFIR_API_URL}/ioc/enrich", headers=headers, json={"type": ioc_type, "value": value}, timeout=30, ) response.raise_for_status() return response.json() def add_enrichment_to_thehive(case_id: str, observable_id: str, enrichment: dict): """Add enrichment data as a case task log in TheHive.""" headers = { "Authorization": f"Bearer {THEHIVE_API_KEY}", "Content-Type": "application/json", } risk_score = enrichment.get("risk_score", 0) verdict = enrichment.get("verdict", "unknown") sources = enrichment.get("sources_queried", 0) flagged = enrichment.get("sources_flagged", 0) note = ( f"## DFIR Platform Enrichment\n\n" f"**Risk Score:** {risk_score}/100\n" f"**Verdict:** {verdict}\n" f"**Sources Queried:** {sources}\n" f"**Sources Flagged:** {flagged}\n\n" f"Full enrichment data attached as JSON." ) # Add a task log with the enrichment summary requests.post( f"{THEHIVE_URL}/api/v1/case/{case_id}/comment", headers=headers, json={"message": note}, timeout=15, ) # Update observable tags based on verdict if risk_score >= 75: tag_update = {"tags": ["dfir:malicious", f"dfir:score:{risk_score}"]} elif risk_score >= 40: tag_update = {"tags": ["dfir:suspicious", f"dfir:score:{risk_score}"]} else: tag_update = {"tags": ["dfir:clean", f"dfir:score:{risk_score}"]} requests.patch( f"{THEHIVE_URL}/api/v1/observable/{observable_id}", headers=headers, json=tag_update, timeout=15, ) def process_case_observables(case_id: str): """Enrich all observables in a TheHive case.""" headers = { "Authorization": f"Bearer {THEHIVE_API_KEY}", "Content-Type": "application/json", } # Fetch observables from the case response = requests.post( f"{THEHIVE_URL}/api/v1/query", headers=headers, json={ "query": [ {"_name": "getCase", "idOrName": case_id}, {"_name": "observables"}, ] }, timeout=15, ) response.raise_for_status() observables = response.json() type_map = {"ip": "ip", "domain": "domain", "hash": "hash", "url": "url"} for obs in observables: data_type = obs.get("dataType", "") ioc_type = type_map.get(data_type) if not ioc_type: continue value = obs.get("data", "") obs_id = obs.get("_id", "") print(f"Enriching {data_type}: {value}") enrichment = enrich_ioc(ioc_type, value) add_enrichment_to_thehive(case_id, obs_id, enrichment) print(f" Risk score: {enrichment.get('risk_score', 'N/A')}") if __name__ == "__main__": process_case_observables("case-id-here")This script fetches all observables from a TheHive case, enriches each one via the DFIR Platform API, and writes the results back as case comments with appropriate tags. It can be triggered manually, from a cron job, or from a SOAR playbook.
TheHive IOC Enrichment Workflow: End-to-End Example
Here is a concrete scenario showing how the integration works in practice.
Scenario: A phishing email is reported by an employee. The SOC creates a case in TheHive and adds the observables extracted from the email: a sender IP, two URLs from the email body, and a SHA-256 hash of an attached PDF.
Step 1 — Observable ingestion. The analyst (or an automated playbook) adds the four observables to the case.
Step 2 — Auto-analysis triggers. The DFIRPlatform Cortex analyzer runs automatically against all four observables.
Step 3 — API enrichment. For each observable, the DFIR Platform API queries 14+ sources in parallel. The sender IP is checked against abuse databases, IP reputation feeds, and passive scan data. The URLs are checked for phishing indicators, redirect chains, and domain reputation. The hash is checked against malware repositories and sandbox results.
Step 4 — Results appear in case. Within seconds, each observable in TheHive shows a Cortex report with a risk score and source breakdown. The analyst sees at a glance: the sender IP has a risk score of 82 (flagged by 9 of 14 sources), one URL scores 91 (known phishing page), the second URL scores 12 (legitimate CDN), and the hash scores 67 (detected by 4 AV engines in sandbox analysis).
Step 5 — Triage decision. The analyst escalates the case, blocks the high-risk IP and phishing URL at the perimeter, and submits the PDF hash for deeper sandbox analysis. Total time from observable ingestion to triage decision: under three minutes.
Configuration Best Practices
Credit management. Each enrichment lookup consumes 3-5 credits. If you are running auto-analysis on high-volume alert ingestion, monitor your credit usage in the DFIR Platform dashboard. The free tier (100 credits/month) is suitable for evaluation and low-volume teams. For production SOC use, the Starter plan (500 credits/month at $29/mo) or Professional plan (2,500 credits/month at $79/mo) provides adequate capacity.
Rate limiting. The DFIR Platform API handles rate limiting server-side. If you exceed your plan's rate, requests return a 429 status with a Retry-After header. The Cortex analyzer handles this gracefully — it reports the error rather than failing silently.
Observable deduplication. TheHive can ingest the same observable across multiple cases. Configure Cortex to cache analyzer results for a configurable TTL (e.g., 1 hour) to avoid re-enriching the same IOC repeatedly and burning credits on duplicate lookups.
Network security. Ensure the Cortex server can reach api.dfir-lab.ch over HTTPS. If your SOC operates in an air-gapped or heavily firewalled environment, whitelist the API endpoint in your egress rules.
Conclusion
TheHive provides the structure for managing investigations. DFIR Platform provides the intelligence to drive decisions within those investigations. The combination — either through the Cortex analyzer or the direct API integration — gives SOC teams automated, multi-source IOC enrichment without the operational overhead of managing a dozen individual threat intelligence subscriptions.
The Cortex analyzer takes under 15 minutes to deploy. The standalone Python integration can be adapted to any workflow that touches TheHive's API. Both approaches use the same DFIR Platform API key and credit pool.
Sign up for a free account at platform.dfir-lab.ch to get your API key — 100 credits per month, no credit card required. Use code LAUNCH50 for 50% off your first paid month on Starter or Professional plans.