Self-hosted malware analysis with OpenCTI and CAPEv2

Learn how to run a CAPEv2 sandbox inside your own network and connect it to OpenCTI so samples are analyzed without leaving your environment. The page covers the integration method, prerequisites, setup sequence, data mapping, security and testing.

On this page

Self-hosted malware analysis with OpenCTI and CAPEv2: what the integration does

A security team that cannot send suspicious files to a cloud sandbox, because of air-gap, classification or data-residency rules, can still get sandbox verdicts into OpenCTI by running CAPEv2 on hosts it controls. The integration is a chain of three parts: a CAPEv2 instance inside your network, an OpenCTI internal-enrichment connector that submits observables to it, and the OpenCTI platform that stores the results as STIX objects linked to the file or artifact. Nothing in that chain has to leave your environment, which is the reason most teams in air-gapped or classified settings choose this route over a hosted service.

The supplied facts do not include a maintained CAPEv2 connector, so the supported method described here is a custom internal-enrichment connector built on the OpenCTI connector framework. That connector would call the CAPEv2 REST API to submit a file, poll for completion, and then map the report fields (verdicts, hashes, ATT&CK techniques, dropped files and network indicators) into OpenCTI objects. Before you choose the custom route, confirm in the OpenCTI connectors repository whether a maintained CAPEv2 connector exists, and if one does, check its version compatibility with your OpenCTI release, since connector and platform versions must be matched. Also confirm the CAPEv2 API version and authentication options in the CAPEv2 documentation for your build, because the connector depends on them.

The custom connector is the part you will own after go-live. Your team or the partner building it will need to decide where the connector runs, which CAPEv2 analysis machines and profiles it may target, how API tokens are stored and rotated, and which OpenCTI objects a sandbox result creates. Those choices determine whether analysts can trust the output and whether the platform stays within the data handling rules that caused you to self-host in the first place. Confirm the sample storage path, retention of submitted files on both the CAPEv2 and OpenCTI sides, and who may view analysis results.

The cost of this integration is mostly engineering and operations time rather than licensing, since the components are open source. Plan for one-time work to build and test the connector, and recurring work to keep it aligned with OpenCTI and CAPEv2 upgrades, monitor its queue and failures, and maintain the analysis guest images. Ask any partner quoting the work to state which of these items are included in a fixed scope, how the connector will be tested against your OpenCTI version, and how upgrades will be verified before they reach production.

Prerequisites for a CAPEv2 and OpenCTI integration

A CAPEv2 sandbox connected to OpenCTI touches three layers: the OpenCTI platform and its dependencies, the isolated analysis hosts, and the identity and service accounts that tie them together. Decide each layer before installation so the sandbox stays inside your network and the connector has only the access it needs.

OpenCTI platform dependencies

OpenCTI needs Elasticsearch 8.0 or OpenSearch 2.9 or later for indexing, Redis 7.1 or later for caching, RabbitMQ 3.11 or later for asynchronous writes, and S3-compatible storage such as MinIO for uploaded files. Each service is a separate component to size, patch and back up. Confirm that your search and storage choices are approved for the classification level of the samples you will handle, and confirm version compatibility against the current release notes before you pin versions.

Deployment overview

Platform sizing baseline

The documented baseline gives the platform 2 cores and at least 8 GB RAM, and the search engine 2 cores, 8 GB RAM and 16 GB SSD. The guidance also recommends at least one platform node for every 3 workers. Malware analysis adds file extraction and connector traffic, so treat the baseline as a floor and ask your team to size workers against the number of samples you expect to submit per day.

Platform nodes per workers
1 to 3
Sizing in the deployment overview

Isolated CAPEv2 host and guest network

CAPEv2 runs the analysis host and the Windows or Linux guest virtual machines that execute samples. Place the sandbox on a segment with no default route to the internet, and allow only the traffic the workflow needs, such as connections from the OpenCTI connector and the controlled internal network path to the guests. Confirm the hypervisor, guest images and any simulated internet services are hosted in your own data center or air-gapped enclave, and test that a detonated sample cannot reach external addresses.

LTS license key for LTS releases

If your team runs an LTS release line, the OpenCTI container images require a specific LTS license key before they run. LTS lines receive only critical bug and security fixes after the first month of stabilization, so plan a upgrade path to the next LTS branch rather than waiting for feature updates. Ask Filigran how the key is issued for your deployment before scheduling the build, and store the key in your secrets manager.

Product life cycle

Least-privilege connector service account

The CAPEv2 connector should authenticate with a dedicated service account, not an administrator's personal login. Grant it only the read access to observables it needs to enrich, the write access to the report and indicator types it will create, and no rights to change platform settings or users. Record the account's owner and review its permissions on each platform upgrade, since connector roles can drift as the data model grows.

How a sample moves between OpenCTI, the connector and CAPEv2

The sample starts as an observable in OpenCTI, either requested by an analyst or queued by a playbook. OpenCTI hands the work through RabbitMQ to the custom enrichment connector, which calls the CAPEv2 API on an isolated host inside your network. Results return to OpenCTI as STIX objects. The trust boundary covers the platform, the queues, the sample storage and the sandbox, so no step needs to leave the network. Check that the sandbox host and sample store sit inside the boundary and that egress from the sandbox is blocked.

Sample flow through OpenCTI, RabbitMQ, the connector and CAPEv2, all inside the boundary.

Choosing the CAPEv2 placement for air-gapped and connected sites

In a fully air-gapped placement, the OpenCTI platform, the CAPEv2 sandbox, the connector, and every update arrive by approved transfer media after review. Nothing in the enclave reaches the internet, so the sandbox cannot fetch its own signatures, guest images, or connector code. Your team owns every import, and each import needs a recorded hash check and an approval step that matches your media handling procedure.

  • Guest images: Your team, or a partner working inside your boundary, builds the Windows or Linux guest images and the analysis tooling they contain. Confirm who signs off on image contents and where the golden images are stored.
  • Staged updates: Stage CAPEv2, OpenCTI, and connector versions in a staging enclave first, then carry the tested set across. Confirm that the OpenCTI version and the connector version are compatible before transfer.
  • Dependency bundles: Python packages, container images, and OS packages must be mirrored in full, because nothing will resolve them at install time.
  • Classification rules: Sample handling, retention, and the decision to keep detonation traces inside the enclave usually follow the highest classification of the data involved. Ask your security authority to confirm this before design starts.

Check that your transfer process can prove the integrity of each release from source to enclave.

Configuring the CAPEv2 connector in OpenCTI, step by step

This sequence connects a CAPEv2 sandbox running inside your network to OpenCTI so that file observables are submitted for analysis and reports return as enrichment. Each step ends with a check that confirms the component works before the next one depends on it.

  1. Confirm the OpenCTI version and license path

    Before touching the sandbox, record the OpenCTI version you run and whether you are on a regular release or an LTS line. Regular releases use the x.YYMMDD.z format, while LTS releases use x.YYMMDD.z-lts.n and require a specific LTS license key. Confirm with your Filigran contact or the product life cycle documentation that your edition and license cover the internal-enrichment connector you plan to use. Done means you have a written record of the version string, the license type and the support window, and an administrator can log in to the platform and view its version in the settings.

  2. Build an isolated CAPEv2 host and guest pool

    Provision the CAPEv2 host on a network segment with no route to the internet or to production systems, which is the main reason to self-host the sandbox in the first place. Build the analysis guests from clean Windows images, keep them on a separate network from the host, and snapshot each guest in a known state so that every submission starts clean. Confirm the host can reach the guests and that the guests cannot reach your corporate network or the internet. Done means a network test from a guest fails for external destinations and the host reports the guest as available in its machine list.

  3. Create a restricted CAPEv2 API identity

    Create a dedicated API key or user for OpenCTI rather than reusing an administrator credential. Restrict it to submitting tasks and retrieving reports, and keep it off any administrative endpoints in your deployment. Store the key in your secrets manager so it does not appear in compose files or repository history. Done means a direct API call using that key can submit a task and fetch a report, while a request to an administrative endpoint with the same key is refused.

  4. Verify the sandbox with a benign test sample

    Before connecting anything, submit a harmless test file to CAPEv2 using the restricted key. Use a sample you created for this purpose, such as a file with no executable behavior, and confirm the task completes and produces a report. Check that the guest shows the expected activity and that no traffic left the isolated segment during the run. Done means the report is retrievable through the API and your network logs show no outbound connections from the guest.

  5. Deploy the internal-enrichment connector with its configuration keys

    Deploy the CAPEv2 internal-enrichment connector in the same environment as the platform, following the connector's documentation for the exact configuration keys. Set the OpenCTI platform URL, the connector identifier and the token, and point the CAPEv2 settings at your internal sandbox address using the restricted key. Keep the token and API key in environment variables or secrets, not in plain configuration files. Done means the connector container starts, writes its startup log without authentication errors, and shows as connected in the platform's connector list.

  6. Register the connector with the platform

    Confirm the connector registers itself with OpenCTI and appears under the connectors section with the correct scope. If it does not appear, check that the platform URL and token match what the platform issued and that the connector can reach the platform's API and message queue. Record the connector identifier for later audit. Done means the connector is listed as active and its last-seen time updates while it runs.

  7. Enable the connector on file observables only

    Limit the connector's scope to file observables so that it does not submit domains, IP addresses or URLs to the sandbox. In the connector configuration, set the scope to file and avoid automatic enrichment for every new observable until you have reviewed the volume and results. Then create one benign file observable in OpenCTI, trigger enrichment on it, and confirm the sandbox task is created and its report is attached as enrichment. Done means the observable shows a CAPEv2 result and the sandbox host log records exactly one submission for that test.

Mapping CAPEv2 report fields to OpenCTI objects

This table maps the kinds of data a CAPEv2 analysis produces to the STIX2-based objects OpenCTI uses to store them. Read it as a starting design, then confirm each CAPEv2 report key against the version you install, because field names change between releases. The main takeaway is that file and network results map cleanly to observables, while verdicts and behavior need a deliberate choice of object type.

Sandbox outputOpenCTI objectMapping notesConfirm before building
File hashes and sample metadataArtifact and File observablesHashes (MD5, SHA-1, SHA-256) attach to a File observable; the original sample is stored as an Artifact only if your policy allows itExact hash keys and whether the sample is returned to OpenCTI
Verdict and malware scoreLabels or Malware Analysis objectUse labels for quick triage filters; use a Malware Analysis object when you need the result tied to a specific analysis runScore scale and how your team defines a malicious verdict
Malware family or signature namesMalware object with relationships to filesLink the family to the sample so later matches reuse the same entityWhether family names come from signatures or a separate source
Contacted IP addressesIPv4 or IPv6 address observablesCreate one observable per distinct address and relate it to the file that contacted itField path for network connections in the report
Contacted domains and URLsDomain-Name and URL observablesKeep URLs as observed rather than normalizing them, so later comparison stays accurateWhether DNS requests and HTTP requests are reported separately
Observed behavior and techniquesAttack Pattern references using ATT&CK IDsMap each behavior to the ATT&CK technique ID, then relate it to the malware or file objectATT&CK version and signature-to-technique mapping in your CAPEv2 build
Dropped files and process artifactsAdditional File observables linked by relationshipDropped files usually need their own hashes and relations back to the parent sampleWhether dropped files are included in the report export

Keeping samples and results under your data rules

Running CAPEv2 inside your own network changes the governance question. Samples, screenshots, memory dumps and network captures all stay on infrastructure your organization controls, so the first decision is not which sandbox to use but who may hold these artifacts and for how long. Before the sandbox receives its first sample, your security and legal owners should confirm the classification of malware samples and their derived artifacts, the retention period for each artifact type, and the rules for destroying them. Those rules then drive storage locations, backup scope and the lifecycle of the OpenCTI objects that point to the results. Treat these as written decisions, not defaults, because a memory dump can contain credentials or personal data from the machine that ran the sample.

In OpenCTI, the markings and access settings decide who sees the analysis results. Each imported report, malware object and observable can carry a marking definition, and the platform's group and role settings determine which users see objects carrying each marking. Test this with a non-administrative account before you connect the sandbox, and confirm that enrichment output inherits the markings you expect rather than landing in a broadly visible space. Pay attention to the platform's sharing and export paths, because a result that is restricted in the interface can still leave through a connector or a stream if that path is not restricted too.

Access control and audit depend on edition. Under the Enterprise Edition, OpenCTI adds activity monitoring and audit logs, along with organization-based data segregation, which lets you separate what each organization's users can see. Since OpenCTI 7.260224.0, defining and using authentication strategies, including SSO, is also an Enterprise Edition feature, so a team that needs central sign-in and per-user accountability for who viewed a sample should confirm the license requirement before design starts. Ask Filigran which edition and license terms apply to your deployment, and record the answer alongside your classification decisions.

Hardening the sandbox and the connector

A CAPEv2 sandbox that sits next to OpenCTI handles hostile files, so its weakest link becomes the whole integration. The controls below cover the sandbox guests, the identities and secrets the two systems share, what enters the sample store, and how both are patched and logged.

Isolate guest VMs from the network

Detonation guests run malware, so they should sit on a dedicated analysis network with no route to your production segments and no direct internet egress. Route any simulated internet traffic through a controlled sink that CAPEv2 operators own. Before go-live, confirm from inside a guest that outbound connections fail and that the host cannot be reached from the guest.

Separate service accounts

Give CAPEv2 and the OpenCTI connector their own accounts, and never reuse an administrator login for either. The connector needs only read access to the analysis results it imports and the ability to submit the samples it is asked to analyze. Review the OpenCTI connector role and the CAPEv2 API user so that a leaked token from one system does not grant control over the other.

Store connector tokens in a secrets manager

The OpenCTI connector and the CAPEv2 API key should be held in a secrets store, not in a plain environment file committed to a repository or copied into container images. Plan rotation for both tokens and record who can read them. Confirm that the connector logs do not echo the token during startup or error handling.

Control sample intake

Decide which OpenCTI objects are allowed to trigger a detonation, such as artifacts uploaded by analysts or files tied to an approved case, and reject everything else. Enforce file size limits and file type checks before submission. Documents with macros and archives should be unpacked only inside the guest, never on the OpenCTI host.

Restrict the sample and report stores

Raw samples and CAPEv2 reports often sit in shared storage, so limit read and write access to the sandbox service and to the named analysts who handle them. Keep report buckets separate from sample buckets, apply retention rules, and confirm that object storage access is logged. Ask your storage team to test that a connector account cannot list the sample bucket.

Log every submission

Record who or what submitted each sample, the time, the source object in OpenCTI, the guest used, and the resulting task identifier. These records let you trace an imported indicator back to its detonation and show an auditor how analysis was requested. Forward these logs to the same central store as your OpenCTI audit trail and check that they cannot be edited by the sandbox operators.

Stage patches for CAPEv2 and the connector

Both components parse untrusted files and change often, so updates should go through a staging copy with a test guest image before production. Pin the connector and CAPEv2 versions, and record which guest image and analysis packages were used for each report. Ask the platform team to confirm the rollback steps before every upgrade window.

OpenCTI life cycle

Testing the integration before analysts rely on it

Test the CAPEv2 integration in stages before any analyst submits a real sample, and write down the expected result for each test first so you can judge the output objectively. Start with a benign known sample that has a well-documented behavior, such as a harmless test file that produces predictable file, registry or network activity. Submit it from OpenCTI through the sandbox connector and confirm the full round trip: the submission reaches CAPEv2, the analysis completes, the report returns to OpenCTI, and the resulting Malware Analysis object links to the original file observable. If any link in that chain breaks, stop and fix it before going further.

Next, run a set of samples with known outcomes, including clean files and known malware families that your team has already analyzed elsewhere. For each one, record the expected verdict, the ATT&CK techniques you expect, and the network indicators and dropped files you would expect to see. Compare what the connector imports against that list. Pay particular attention to indicator mapping: confirm that domains, IP addresses and hashes land as the right observable types, that duplicates merge rather than multiply, and that benign infrastructure is not promoted into indicators. Check the connector configuration keys and the CAPEv2 API settings against your written record, not against memory.

Then test failure behavior. Take CAPEv2 offline deliberately, submit a sample, and confirm that the connector logs a clear error, that the observable stays in OpenCTI unchanged, and that a retry or a later resubmission works once the sandbox is back. Finally, run a load test sized to the submission rate you expect in production, including the bursts that follow a large phishing campaign. Watch the sandbox queue depth, worker memory and RabbitMQ backlog, and confirm that analysts still see results within a time frame your team agrees on in advance. Document each result against the expectations you recorded, and do not let analysts rely on the integration until every stage passes.

Common CAPEv2 and OpenCTI integration failures

This table lists the failures teams most often hit when CAPEv2 and OpenCTI are wired together, with the likely cause and a check to run first. Read each row as a triage path: start with the symptom you see, confirm the cause with the listed check, then apply the fix. The main takeaway is that most failures sit in messaging, trust between services, or data mapping, and each can be isolated with a short, ordered set of checks.

SymptomLikely causeCheck and fix
Connector never picks up workConnector not registered with the platform, wrong connector token, or RabbitMQ connection refusedConfirm the connector appears under the platform's connector list and is active. Check the connector's log for authentication or AMQP connection errors, then reissue the token and verify RabbitMQ credentials and port reachability from the connector host.
Submissions stay queued or pendingWorkers are not consuming RabbitMQ messages, so the queue backs upCheck the RabbitMQ management view for unacknowledged messages on the connector queue. Confirm at least one worker is running and consuming, then restart the worker and the connector in that order.
Submissions fail with connection errors to CAPEv2CAPEv2 API unreachable from the connector host, usually a routing, firewall or port issueFrom the connector host, request the CAPEv2 API root with curl and confirm the port and path. Fix firewall rules or the API bind address on the CAPEv2 side, then retry one known sample.
TLS errors in an air-gapped networkInternal CA certificate not trusted by the connector container or hostInspect the handshake error in the connector log. Add the internal root and intermediate certificates to the container trust store, rebuild the image, and confirm trust with a test request before resubmitting samples.
Reports return but no objects appearMapping or schema mismatch between the CAPEv2 report fields and the STIX objects the connector createsOpen one returned report and compare its fields to the connector's mapping. Look for empty fields, renamed keys or unsupported object types in the connector log, then update the mapping and reprocess a single sample.
Duplicate malware analysis or observablesThe same sample or hash was submitted more than once, and each run created new objects instead of reusing existing onesSearch for the file hash in the platform before submitting. Limit automatic submission to new artifacts, use a deduplication check in the connector, and merge duplicates that already exist.
Guest VM reaches the internal network or internetAnalysis network not isolated, so a sample in the guest can reach hosts it should notTest from inside a guest VM that it cannot reach internal ranges or the management interface. Restrict the analysis bridge or VLAN with firewall rules, and confirm the result after every network change.
Enrichment results missing after upgradeConnector version and platform version no longer match the expected schemaCompare the connector version with the platform release in use. Align versions according to the platform's life cycle documentation, then retest with a known sample.

Questions buyers ask before outsourcing CAPEv2 with OpenCTI

Is there a maintained CAPEv2 connector for OpenCTI, and what does a custom one cost?

Confirm the current state of any CAPEv2 connector in the OpenCTI connectors repository before you plan, because the supplied facts do not confirm which connectors exist or are maintained. If no suitable connector exists, the cost of a custom one depends on the number of CAPEv2 API calls you need (submission, polling, report retrieval), how results map to STIX objects such as observables, malware analysis and ATT&CK techniques, how the connector handles failures and retries, and how much testing your environment requires. Those items are the cost drivers, and the labor is what you pay for. DeployOpen does not publish prices. A quote follows from a written scope that lists which connector behavior is required, which OpenCTI version it targets, and who maintains it after handover.

How long does a self-hosted CAPEv2 and OpenCTI setup take?

Duration depends on how much of the stack is already in place. The work usually covers the OpenCTI platform and its dependencies, the CAPEv2 analysis hosts and guest images, the connector, network segmentation and access control, and testing with safe sample sets. Teams with existing hypervisor capacity, approved network paths and a working OpenCTI instance move faster than teams starting from bare hardware. Approval cycles for network changes and sample handling policy often set the pace more than the build itself. Ask for a timeline that shows each dependency and the client decisions it waits on. Confirm the OpenCTI version and dependency versions with your own environment and the OpenCTI deployment overview before fixing dates.

What must our team provide before an outsourced CAPEv2 build starts?

Your team provides the infrastructure and decisions that only you can make:

  • Hosts for OpenCTI, its dependencies (Elasticsearch or OpenSearch, Redis, RabbitMQ and S3-compatible storage) and the CAPEv2 analysis machines, sized against the OpenCTI deployment overview.
  • Network approvals for the sandbox segment, including which hosts can reach the connector, which can reach the internet if anything is permitted, and how results return to OpenCTI.
  • A sample policy that states which file types are accepted, who may submit them, how they are classified and how long they are retained.
  • A named owner with authority to approve scope changes and accept the handover.
  • Access to an identity provider if SSO is required. Note that SSO configuration is an Enterprise Edition feature.

Missing items in these areas are the most common causes of schedule slips.

Can an internal team build and run CAPEv2 with OpenCTI without a partner?

Yes, an internal team can do it if it has skills in Linux server administration, virtualization, network segmentation, OpenCTI operations and malware analysis workflows, and enough time to maintain the result. The hardest parts are usually not installation. They are keeping analysis guests patched and isolated, handling connector failures, keeping OpenCTI upgrades on a supported path and documenting the sample handling rules that auditors and incident responders will ask about. Compare the internal effort with an outsourced scope that includes build, testing, documentation and handover. A partner adds the most value when your team lacks one of these skills or when the deadline is tight.

Does a self-hosted CAPEv2 sandbox work in air-gapped sites?

A self-hosted design is the reason this approach suits air-gapped and classified environments, because samples and analysis results stay inside your own network. In an air-gapped site, the main changes are how software, container images, connector packages, operating system updates and guest images reach the environment. Plan an internal artifact path for each of them and confirm every dependency works without internet access. Internet-based enrichment services will not be reachable, so verify which connectors and lookups depend on outside services. Updates need a controlled transfer process and a test step before they reach production. DeployOpen's deployment work can be scoped for this setting, and the written scope should name the transfer method and approval path.

What risks should we check before running malware analysis on our own hosts?

The main risks are sample escape from the analysis guest, unintended network contact from the sandbox, exposure of results or samples to users who should not see them, and loss of audit evidence. Check that analysis guests are isolated from production networks, that egress is blocked or tightly controlled, that snapshots and images are restored between runs, and that access to samples and reports follows your data handling rules. Confirm which OpenCTI features need the Enterprise Edition, including audit logs and organization-based data segregation, before you rely on them for access control. Ask the implementer to show how each control is tested and documented.

Does the OpenCTI license cover this setup, and what recurs after launch?

The Community Edition is licensed under Apache License 2.0, and the Enterprise Edition uses a proprietary license. Any feature you need, such as SSO, audit logs or playbooks, may require Enterprise Edition, so check which features your sandbox workflow depends on. OpenCTI LTS releases also require a specific LTS license key. Recurring costs typically include infrastructure, OpenCTI license fees if you use Enterprise, maintenance of guest images and connectors, and upgrades on the release cycle. Ask the implementer to list recurring work by task and owner, and confirm current license terms with Filigran before signing.

How DeployOpen scopes and delivers a CAPEv2 integration

DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure, including air-gapped networks. For a CAPEv2 sandbox connected to OpenCTI, that means agreeing the scope in writing first, then building the sandbox and its link to OpenCTI in your environment so samples never leave your network.

How we scope

  • We confirm which sample types, guest operating systems and analysis networks your CAPEv2 sandbox must support.
  • We map where the sandbox, OpenCTI and its dependencies will run, and who may submit files and read reports.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before any build work starts.

How we build

  • We install and configure CAPEv2 and its guest images inside your network, isolated from production systems.
  • We connect the sandbox to OpenCTI through the connector path your team approves, with credentials kept in your secrets store.
  • We test submission, report import and network isolation with sample files you supply under your own handling rules.

How we hand over

  • You receive documentation of the architecture, network rules, guest image build steps and connector configuration.
  • We provide runbooks for submitting samples, reviewing failed analyses and rotating credentials.
  • We walk your security and platform teams through the controls so they can review the setup themselves.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Upgrades of CAPEv2, OpenCTI and guest images are planned and tested before they reach your sandbox.
  • Confirm with us the response expectations, support hours and upgrade cadence you need before signing a scope.

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.