Writing a custom misp-modules expansion module

Build an in-house expansion module that enriches MISP attributes from your own asset inventory, CMDB or private intelligence source, with tests, deployment and upgrade planning.

On this page

When a custom misp-modules expansion module is worth building

An analyst team often reaches the point where MISP attributes need context that no public enrichment source can supply. An IP address may need the owning business unit from an asset inventory, a domain may need its CMDB owner and environment, or an indicator may need to be matched against a private intelligence source that is never shared outside the organization. The question is whether to write an in-house expansion module for misp-modules or to ask a partner to build and run it. Building is worth considering when the enrichment answer exists only inside your own systems and analysts currently look it up by hand across several tools.

misp-modules is the separate service that runs expansion, import, export and action modules alongside MISP itself. Its modules are exposed through a REST API that works without MISP, which means a module can be tested before it is wired into an event workflow. The misp-modules project is licensed under AGPL-3.0, so an internal module that is distributed or offered to users over a network carries obligations that your legal team should review before the build starts. Confirm the license terms against the project's own repository, since they govern what you can keep private.

Before committing, confirm three things: which internal source holds the data (asset inventory, CMDB or private intelligence store), whether it can be queried from the misp-modules host with a stable API or read-only account, and who will own the module after the first release. A module that depends on one engineer's script becomes a risk at the next MISP upgrade. If any of these answers is unclear, a short scoping exercise with a partner or your own platform team will show whether the work is a few modules or a broader integration.

What misp-modules exposes to a custom expansion module

misp-modules gives a custom expansion module three surfaces: a REST API that runs without MISP, a command-line tool and web interface, and a statistics endpoint that reports per-module behavior. Together they let your team test the module in isolation, watch it in service and confirm it still works after each change or upgrade.

Standalone REST API

The misp-modules REST API works without a running MISP instance, so you can send your module a sample attribute and inspect the JSON it returns before MISP is involved. This separates faults in your lookup logic from faults in MISP's enrichment workflow. Check that the module answers with the same structure MISP expects, including the result and error fields, and that unknown or malformed input returns a clean error rather than a crash.

misp-modules README

Command-line tool

The bundled CLI lets engineers run a module from a terminal against test input. It suits quick checks during development and scripted regression runs in a build pipeline. Use it to confirm that required configuration keys, such as the internal inventory URL or service account reference, are read correctly from the environment and that a missing key fails with a clear message.

Web interface

The web interface offers a browser view of the modules the service loads. Use it to confirm that your module is registered under the expected name, shows its input types and appears in the list MISP will query. A module that loads without errors here but never appears in MISP usually points to a registration or naming mismatch that is easier to fix at this stage.

Per-module statistics endpoint

GET /statistics reports query counts, errors and latency for each module. Once the module is live, these figures show whether your internal source is slow, failing or being called more often than planned. Ask your team to define alert thresholds on error counts and latency before go-live, and to review the figures after every upgrade of the internal source or of misp-modules itself.

misp-modules README

AGPL-3.0 license obligations

misp-modules is licensed under AGPL-3.0, and that license governs the service your module runs inside. Before you distribute a module outside your organization, or offer it as a network service to others, have legal review what the license requires of your code. Keep your internal lookup logic, credentials and inventory data outside the module's source where the license and your policy allow.

How an expansion module is structured and what it must return

An expansion module is a Python file in the misp-modules package that declares its metadata and exposes a handler. misp-modules discovers modules from its module directory and presents them through its REST API, so the handler is the single entry point MISP calls when an analyst triggers enrichment. The handler receives a request containing the attribute values to enrich and any module configuration, and it returns a structured response that MISP parses into an event. Treat the handler as an interface contract, not a place for business logic.

  • Module metadata: Declare the module name, description, supported input attribute types and the output types it can return. MISP uses these declarations to decide which attributes offer the module.
  • Handler function: Accept the request, validate the input type and return an error response for unsupported input instead of guessing.
  • Configuration: Read API endpoints, credentials and timeouts from configuration passed through the module settings, not from hard-coded values.
  • Dependencies: Keep third-party libraries minimal and pin them, so an upgrade of the base image does not change behavior silently.
  • Licensing: misp-modules is licensed under AGPL-3.0, so confirm with your legal team how an in-house module that is distributed beyond your organization is licensed.

Before you write code, confirm the current handler interface, input and output field names against the misp-modules README and the version pinned for your deployment rather than working from memory or older examples.",

Implementation sequence from design to production

The sequence moves a lookup from an agreed contract to a verified enrichment result on a MISP event, with each stage producing a record that the next one depends on. Following the order keeps the data owner, the test evidence and the production monitoring aligned before analysts rely on the module.

  1. Agree the lookup contract and data owner

    Before any code is written, the MISP team and the owner of the internal source agree which attribute types the module accepts, which fields it returns, how misses and errors are reported, and who answers for data accuracy and access. The output is a short written contract listing the input attribute types, the output object or attribute structure, the error responses and a named owner for the source. Confirm with the owner whether the source can be queried from the network segment where misp-modules runs, and whether the query needs a service account and what that account is allowed to read.

  2. Build the module against a local misp-modules instance

    A developer creates the module in a local checkout of misp-modules, following the module structure the project uses for existing expansion modules, and implements the query logic against a development copy or sample of the internal source. Credentials stay in configuration or a secrets store and never in the module code. The output is a module that loads in a local misp-modules instance and returns results in the agreed structure for sample inputs, including a deliberate miss and a source error. Keep the code licensed under the same terms as the service it runs in, and confirm the license position for the module with your legal team before distribution.

  3. Test through the standalone REST API and CLI

    Because misp-modules exposes its modules through a REST API that works without MISP, the developer calls the module directly with sample payloads and checks the raw JSON response, then repeats the check with the bundled CLI tool. Each test case is recorded with its input, the response received and the expected result, including unsupported attribute types, empty results, timeouts and malformed source responses. The output is a passing test record kept with the module, which shows the module behaves correctly before MISP is involved at all.

  4. Deploy alongside the production misp-modules service

    The module is copied to the production misp-modules host or container image through the same change process used for other service code, with its configuration and credentials supplied through the environment your team already manages. The service is restarted in a controlled window, and the module is confirmed to appear in the module list of the production instance. The output is a record of the deployed version, the configuration keys used (without secret values) and the change approval, so the module can be traced and rolled back if needed. Ask your MISP administrator to confirm how the production service is packaged, since this determines where the file lives.

  5. Validate the enrichment from a MISP event

    A test event is created in MISP with attributes of each supported type, plus one unsupported type and one value known to be absent from the internal source. The enrichment is triggered from the event as an analyst would trigger it, and the results are checked for correct attachment, object structure, the to_ids setting and the handling of the miss. The output is a verified enrichment result on the test event, captured with screenshots or exported JSON and stored with the test record. Confirm that the test event is not published or synchronized to partners during this step.

  6. Set up monitoring with /statistics

    Once the module serves analysts, the team configures regular collection of the statistics endpoint that misp-modules provides, which reports per-module query counts, errors and latency. Alerts are defined for rising error counts or latency for the new module, and the owner of the internal source is included in the escalation path. The output is a working dashboard or check for the module's statistics and a documented alert threshold agreed with the platform and source owners. Confirm the thresholds with your operations team, because appropriate values depend on how often analysts run the enrichment and the source's own capacity.

Configuration decisions that shape the module

This table compares the design choices that determine how your module behaves once it reaches analysts and the internal data owner. Read each row as a decision: the option, when it fits, and what it changes for analysts and for the team that owns the internal source.

DecisionOption and when it fitsWhat it changes for analystsWhat it changes for the data owner
Lookup locationCall an internal REST API from the module when the CMDB or inventory already exposes one. Bundle a local dataset only when the source is small and changes rarely.An API call adds latency to every enrichment. A bundled dataset returns instantly but can be stale between refreshes.An API keeps the source authoritative and auditable. A bundled copy spreads data into the MISP host and needs its own refresh and access controls.
Caching and TTLCache responses for a short window when asset ownership changes often. Use a longer window for stable reference data such as business unit mappings.Longer TTLs reduce repeat queries but may show a retired host as current. Analysts may need to know when a result came from cache.Caching reduces query load on the inventory service. The owner should agree on the maximum acceptable staleness before go-live.
Credential storageStore the service account key in the misp-modules environment or a secrets manager reachable from the host. Use a read-only, scoped account for the module.Analysts never see the credential, but a misconfigured key shows up as failed enrichments that look like empty results.A read-only scoped account limits exposure if the MISP host is compromised. The owner should review who can read the environment file and rotate the key on a set schedule.
Accepted attribute typesAccept only types the source can answer, such as ip-src, hostname or domain for asset lookups. Reject others explicitly in the module's input checks.Narrow input means analysts get a clear no-result for unsupported types instead of misleading matches from a loose hostname rule.Limiting types keeps queries to fields the source indexes well and reduces unnecessary lookups against the inventory.
Output as objects or flat attributesReturn structured objects when the result has several fields such as owner, environment and criticality. Return flat attributes when one value is enough.Objects keep related fields together on the event. Flat attributes are easier to filter and export but lose the grouping.Object templates define the schema the owner's data maps to. Changing the template later affects every event that already carries the object.
Behavior when the source is unavailableReturn a clear error status and leave the attribute unchanged. Avoid returning an empty result, which reads as confirmed absence of an asset.Analysts see that enrichment failed and can retry. A silent empty result can lead them to treat an unknown host as unowned.The owner is not flooded with failed-query noise. Monitoring of the module's error counts through the statistics endpoint shows outages early.
Result scope and sharingLimit returned fields to what the event audience needs. Omit internal hostnames or personal owner names from results that may be published.Analysts see only the fields they need, which keeps enriched events suitable for sharing outside the organization.Filtering at the module stops internal asset details from leaving the organization through sync or export. The owner should confirm the field list in writing.
Query volume and timeoutsSet a per-query timeout and a concurrency limit that the inventory service can absorb during a bulk enrichment.A short timeout returns failures sooner. A long one can hold analyst sessions open while the module waits.Caps protect the inventory from load spikes caused by bulk enrichment jobs. The owner should agree on the limits before deployment.

Testing the module through the standalone REST API before MISP

Test the module through the misp-modules REST API before you load it into MISP, because that service runs without a MISP instance and lets your team exercise query handling, error paths and response latency in isolation. When a failure appears inside MISP, it is hard to tell whether the fault lies in your module, the MISP workers or the connection between them. Testing directly against the module removes that ambiguity. Confirm the exact request format, the module name and the input field names in the misp-modules README before you write any test, since the request shape is the contract your tests should check.

Write cases for valid and malformed inputs first. A valid input should return the structure your module promises, with the attribute and object fields MISP expects. Malformed inputs include an empty value, a value of the wrong attribute type, an overlong string and characters that your internal asset inventory query would not handle safely. Each should produce a clear, bounded error rather than an unhandled exception or a silent empty result. Also test an empty result set from your source. An empty answer should return a valid response with no fabricated enrichment, so analysts do not read the absence of data as a confirmed finding.

Next, simulate a slow or unreachable source. Use a stub or a deliberately delayed endpoint to confirm that your module times out within a limit you set, returns a meaningful error and does not hold the service open. Check the per-module figures that GET /statistics reports for query counts, errors and latency after these runs, so you can see whether your module adds delay or failures under load. Record the baseline you observe in your own environment, and agree with the owners of the internal source what timeout and concurrency values are acceptable before go-live.

What drives the effort of building and running the module

This table separates the one-time work of building a custom misp-modules expansion module from the work that recurs once it is in production, and names the factors that move each one. Read it as a checklist for scoping: the rows that carry the most uncertainty are usually source access and output mapping, so ask for those to be estimated separately in any quote.

DriverWhy it changes effortOne-time or recurringWhat to ask for in a quote
Number and quality of internal sourcesEach inventory, CMDB or private feed needs its own query logic, field normalization and handling of missing or duplicate records. Inconsistent naming across sources adds mapping work.One-time for design and build, recurring when sources change schemaA list of each source, its owner, its data quality issues and a fixed set of lookups the module will support
Access and data-owner approvalsService accounts, network paths and approval from each data owner can take longer than the code. Approval scope also defines which attributes the module may send to MISP.One-time for initial approval, recurring when access is reviewed or rotatedWho obtains approvals, which access documents are prepared, and whether approval time is included in the timeline
Complexity of output mapping to MISP objectsMapping results to existing MISP object templates is faster than defining custom objects. Custom object definitions need review of attribute types, relations and sharing behavior.One-time, with recurring review when templates changeWhich MISP object templates are targeted, whether custom objects are included, and how many mapping cases are covered
Test coverage expected by security reviewersReviewers usually expect tests against the standalone REST API, failure cases such as timeouts and malformed responses, and evidence that no unexpected data leaves the network.One-time for the test suite, recurring for regression runs on each changeThe test cases in scope, the evidence format delivered, and whether the reviewer's own test steps are included
Deployment alongside misp-modulesPackaging, service configuration and the module registration step depend on how misp-modules is installed and how MISP is hosted. Air-gapped or containerized setups add steps.One-time for first deployment, recurring for redeployment after host changesThe target hosting model, the deployment runbook, and who performs the rollout on production
Tracking misp-modules and MISP changesThe module uses interfaces that may change across releases. Teams need to review changelogs, rerun tests and confirm compatibility before each upgrade of MISP or misp-modules.Recurring, usually tied to each upgrade cycleWhich versions are covered, how upgrade testing is scheduled, and what a compatibility fix costs after a release
Monitoring and error handlingThe module needs visibility into query counts, errors and latency. The misp-modules statistics endpoint provides per-module metrics, but alerting and dashboards must be built and maintained.One-time for setup, recurring for alert tuning and reviewWhich metrics are collected, where alerts go, and who responds to module failures

Deploying the module alongside the misp-modules service

The module sits beside the running misp-modules service, not inside MISP itself, so deployment is mostly about getting the service to load your file and then pointing MISP at the service. The first decision is how your installation method loads modules. Confirm with your installer, Docker image or custom package how misp-modules discovers custom modules, whether through a directory it scans at startup, a mounted volume in a container, or a package-managed path. Check the service's own README in the misp-modules repository for the current loading behavior before you write a deployment runbook, since the mechanism differs between a host install and a container. Keep the module file under version control so the same artifact reaches every environment.

Once the file is in place, restart the service and verify that the module is registered. Use the misp-modules REST API directly, since it works without MISP, and confirm the module appears in the module list and returns a response for a test query. Also confirm the service's systemd unit, container restart policy or equivalent supervisor setting, because a module that loads only after a manual restart will fail silently after a reboot. The statistics endpoint reports per-module query counts, errors and latency, so it is the first place to look when MISP reports enrichment failures. Plan the restart as a change window item, because restarting the service interrupts any enrichment in progress.

Point MISP at the service through its modules settings in the administration interface, using the service URL your MISP instance can reach over the network. Confirm the port, TLS choice and any network policy between the two hosts, and check that the module is enabled in MISP only after the service test passes. Keep credentials for the internal inventory or CMDB out of the module source, and out of version control. Load them from environment variables or a secrets store that the service reads at startup, with file permissions restricted to the service account. Store the base URL and any API token in your deployment configuration, and rotate those values on the same schedule as your other service credentials. Ask your platform team which secrets tool they already run before you choose a mechanism.

How the module connects to MISP and internal systems

An expansion module sits between an analyst's enrichment request in MISP and a system you own. Each connection below is a point where configuration, authentication and failures can go wrong, so plan them together rather than one at a time.

Enrichment requests that trigger the module

An analyst or an automated job asks MISP to enrich an attribute, and MISP forwards that attribute to misp-modules under the module name you registered. The module receives the attribute type and value, plus any configuration passed in, and returns objects or attributes for MISP to attach to the event. Confirm which attribute types your module accepts in its input declaration, because an unsupported type should be rejected cleanly rather than failing inside your query logic. Test each accepted type through the standalone REST API before connecting it to MISP.

misp-modules docs

The internal inventory or CMDB query

The module calls your asset inventory, CMDB or private intelligence source over the network, so it needs a service account, a read-only scope and a defined timeout. Decide which fields come back into MISP, since asset owners, hostnames or business units may be more sensitive than the indicator itself. Ask the system owner whether the query endpoint can be reached from the misp-modules host only, and whether lookups are logged on their side. Keep the credential in configuration that the service reads at startup, not in the module source code.

Credentials and network path

The misp-modules host must reach the internal source, and that path should be documented, reviewed and limited to the required port. Store the service account secret where your existing secrets tooling manages it, and set a rotation owner. If the source uses a private certificate authority, the trust store on the misp-modules host must include it, or every lookup will fail with a TLS error that looks like an application fault. Record these dependencies in the module's runbook.

Analyst workflow inside MISP events

Results appear as objects or attributes on the event the analyst is working on, so the analyst decides what to keep, tag or publish. Your module should return a compact, consistent structure that analysts can read without opening raw JSON. Agree with the analyst team whether internal asset data may be shared to partner communities, because a value that is safe in your private instance may not be safe once an event is published. Set the distribution and sharing group on returned data explicitly.

Monitoring through the statistics endpoint

misp-modules exposes GET /statistics, which reports per-module query counts, errors and latency. Poll this endpoint from your monitoring system and alert on a rising error count or latency for your module, since a slow internal source often shows up first as analyst complaints about enrichment timing out. Compare error counts against the inventory system's own logs when they diverge. Confirm which monitoring agent your team uses and whether it can scrape this endpoint from its network zone.

misp-modules README

Shared service with other modules

Other expansion modules, such as the VirusTotal, Shodan and passive DNS modules covered in the enrichment setup pages, run on the same misp-modules service. Your module can share its host, process supervision, logging and upgrade window with them, so a change to one affects all. Keep your module's configuration separate from the third-party module settings, and check that a failure in your module does not block the others. Confirm with your platform team how the service is restarted during maintenance.

Keeping the module working across MISP and misp-modules upgrades

Why does a custom misp-modules module break after a MISP upgrade?

A custom module usually breaks because the surrounding platform changed, not because the module code did. MISP and misp-modules are separate releases, so a MISP upgrade can change the attribute types, object templates or API responses your module reads or returns, and a misp-modules upgrade can change the module interface or the Python dependencies it loads. The line that matters most for planning is the database layer: MISP 2.5.47 introduced a new database migration system with PostgreSQL support, so an upgrade that crosses that point changes the platform under your module. Check the release notes for each version you move through before you upgrade.

Which MISP version should a module target in 2026?

Target the MISP 2.5 line, which the project recommends for new deployments. MISP 2.4 is end of life and receives security fixes only, and the project strongly advises against installing new 2.4 instances. If your organization still runs 2.4, the module work and the upgrade belong in the same plan, because building against a line that is no longer maintained leaves you with a second migration later. Confirm the exact release you run on the MISP download page and in the GitHub releases before you write the module's compatibility notes.

How do I pin MISP and misp-modules versions for a custom module?

Pin both components to explicit versions in the deployment definition rather than tracking a moving tag. Record the MISP release, the misp-modules commit or release, and the Python version and dependency lock for your module in one file under version control. For Docker or Ansible deployments, set the image tag or role version explicitly, and for the official installer, record the release you installed. Your module's own requirements file should pin its dependencies, and the pinned set should be the only one that reaches production. Upgrades then become deliberate changes to a recorded set, which makes rollback and review possible.

What should the module test suite cover before each upgrade?

Rerun the module's test suite after every upgrade of MISP or misp-modules, using the standalone REST API so the tests do not depend on a full MISP instance. The suite should send representative attribute values to the module, check the response structure, check the object and attribute types it returns, and confirm error handling when the internal source is unreachable. Add a test for each defect you have fixed so it stays fixed. Keep the suite runnable in CI so a failure blocks the upgrade rather than surfacing in analyst work. The misp-modules README describes the REST API and the GET /statistics endpoint, which can show per-module query counts, errors and latency after an upgrade.

How do I track MISP and misp-modules changes that affect my module?

Watch the repositories and release notes for the components your module touches, and review each one against the module's code paths. Follow the MISP GitHub releases for version notes and database migration changes, and the misp-modules repository for changes to the module interface and dependencies. Assign an owner to read these notes at each release you consider, and record the findings in the module's changelog. Security advisories from the project need the same review, because a fix in MISP itself can change behavior your module relies on. Keep the pinned versions and the notes together so the next person can see why a change was accepted.

Why do I need a staging environment for MISP module upgrades?

A staging environment lets you run an upgrade of MISP and misp-modules against a copy of your configuration before analysts depend on the result. It should match production closely enough to exercise your module with real module requests and realistic attribute sets, including the internal inventory or CMDB connection. Use it to run the test suite, check the statistics endpoint for errors and latency, and confirm that enrichment results still reach events as expected. Ask whether your organization can keep a staging copy with the same access controls and data handling as production, because an unprotected copy of internal inventory data creates its own exposure.

Who maintains a custom module after the first release?

The organization that owns the module maintains it, and that work recurs for as long as the module runs. Ongoing costs include reviewing release notes, rerunning tests, adjusting code when the interface or dependencies change, and fixing issues with the internal source the module queries. You can carry this work in-house, or you can place it under a retainer with a partner such as DeployOpen, which offers ongoing support, upgrades and continuous testing as retainers. Ask any provider to state in writing which upgrades are covered, how staging is handled, and who is responsible for the module's code after handover.

What are the licensing constraints when I maintain a module for MISP?

The MISP software is licensed under the GNU AGPL version 3, and misp-modules is also licensed under AGPL-3.0, so a module that you distribute as part of that service should be reviewed against those terms before release. Keep in mind that taxonomies and galaxy data use separate licenses, CC0 1.0 Universal or the 2-clause BSD license, which apply to that data rather than to your code. A module that stays inside your own network and is never distributed has different obligations from one shared outside your organization. Confirm the terms with your legal or compliance team before you publish or share the module.

How DeployOpen scopes and delivers a custom MISP module

DeployOpen plans, builds, tests and hands over custom misp-modules expansion modules that query your internal asset inventory, CMDB or private intelligence source from MISP, inside infrastructure you control. Each engagement starts with a written scope so the data source, attribute types, deployment target and support terms are agreed before any code is written.

How we scope

  • Confirm which internal source the module queries, who owns it and how access is granted
  • Agree which MISP attribute types the module accepts and what object output it returns
  • Record deployment target, upgrade expectations and support terms in a fixed-scope written agreement

How we build

  • Structure the module to the misp-modules layout and test each lookup through the standalone REST API
  • Verify error handling, timeouts and per-module statistics exposed through the GET /statistics endpoint
  • Review credentials handling and data exposure before the module reaches a MISP instance

How we hand over

  • Deploy the module alongside your misp-modules service and document the configuration steps
  • Provide test cases and a runbook covering installation, rollback and common failure messages
  • Walk your team through enabling the module in MISP so analysts know how to trigger it

How we support

  • Retest the module against each MISP 2.5 release you plan to adopt before upgrading production
  • Offer ongoing support, upgrades and continuous testing as a retainer once the module is live
  • Confirm with us during scoping which upgrade and support terms apply to your environment

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.