Indicators of compromise
Pull indicators of compromise out of threat reports and defang or refang them safely
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/ioc/index.md to help me query Indicators of compromise with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Extract every distinct indicator from a defanged report as (type, value) rows.
Example output · captured
- Connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value
| type | value |
|---|---|
| ipv4 | 10.0.0.5 |
| url | http://evil.com |
Quick start
Choose where to run Indicators of compromise, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach the release directly
Downloads the latest release for your platform and caches it locally.
ATTACH 'ioc' AS ioc (
TYPE vgi,
LOCATION 'github-auto://Query-farm/vgi-ioc'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'ioc' AS ioc (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-ioc:0.5.0'
);
3. Run a query
SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'ioc' AS ioc
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value
Query Farm operates Indicators of compromise for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use ioc as the catalog alias for the query below.
4. Run a query
SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach the release directly
Uses the verified release each time you attach the connector.
ATTACH 'ioc' AS ioc (
TYPE vgi,
LOCATION 'github-auto://Query-farm/[email protected]'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'ioc' AS ioc (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-ioc:0.5.0'
);
Overview
Defensive CTI tooling: extract and defang/refang indicators of compromise (IOCs) from free text.
Pull indicators of compromise (IOCs) out of cyber-threat-intelligence (CTI) reports and defang or refang them with plain SQL — no Python notebook, regex cheat-sheet, or external service required. The ioc extension turns DuckDB into an IOC parser that recognizes IPv4 and IPv6 addresses, domains, URLs, e-mail addresses, file hashes (MD5, SHA-1, SHA-256, SHA-512) and CVE identifiers, and converts between live indicators (http://evil.com) and the defanged form (hxxp[://]evil[.]com) that analysts use to share malware artifacts safely. It is built for threat hunters, incident responders, SOC analysts and data engineers who already keep logs, alerts and reports in DuckDB and want indicator extraction to be just another column expression.
This is a purely defensive tool: it reads and rewrites indicators that already exist in your text — it never generates attacks, resolves names, or touches the network. Extraction is powered by the Rust regex crate (documentation), whose linear-time, backtracking-free engine matches large reports without catastrophic blowup. The worker is a standalone binary that DuckDB attaches over Apache Arrow IPC, so results stream back as native Arrow columns. A key design choice is refang-before-extract: every extractor (and is_ioc / extract_iocs) first refangs a copy of its input, so indicators that were defanged in a report — 10[.]0[.]0[.]5, bad[at]evil[.]com, hxxp://evil[.]com — are still found. Only defanging and refanging themselves skip that step.
Reach for it whenever indicators live inside free text rather than tidy columns: enriching an alerts or tickets table, building a watchlist from an incident report, sanitizing artifacts before sharing them, or joining extracted indicators against a threat feed. Functions are grouped into extraction, defang/refang and classification, and each carries its own worked examples.
Catalog
Everything ioc exposes once attached — read straight from the worker's
released build.
main 1 view · 12 functions
IOC extraction and defang/refang functions for cyber-threat intelligence.
Schema examples (9)
Extract every distinct indicator from a defanged report as (type, value) rows.
SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value;
| type | value |
|---|---|
| ipv4 | 10.0.0.5 |
| url | http://evil.com |
Count the indicators in a report, grouped by type.
SELECT type, count(*) AS n
FROM ioc.main.extract_iocs('c2 hxxp://evil[.]com from 10[.]0[.]0[.]5 and bad[at]evil[.]com')
GROUP BY type
ORDER BY type;
Defang a live URL so it is safe to paste into a report.
SELECT ioc.main.defang('http://evil.com/x') AS safe;
Pull the defanged IPv4 addresses out of a report, one per row.
SELECT UNNEST(ioc.main.extract_ipv4('beacon from 10[.]0[.]0[.]5')) AS ip;
5 more examples
Classify a hex digest by algorithm.
SELECT ioc.main.hash_type('d41d8cd98f00b204e9800998ecf8427e') AS algorithm;
Label every indicator pulled from a defanged report with its coarse group (network, email, hash, vulnerability) and the single-type extractor for it, by joining extract_iocs to the ioc_types registry.
SELECT t.kind, i.type, i.value, t.extractor
FROM ioc.main.extract_iocs('dropper hxxps://cdn[.]evil[.]com/a.exe (sha256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855) beacons to 203[.]0[.]113[.]7, exploits CVE-2021-44228, phish from ops[at]evil[.]com') AS i
JOIN ioc.main.ioc_types AS t ON t.name = i.type
ORDER BY t.kind, i.type, i.value;
Turn a live incident note into a safe-to-share watchlist: extract every indicator with extract_iocs, then defang each value so none of them is clickable.
SELECT i.type, ioc.main.defang(i.value) AS shareable
FROM ioc.main.extract_iocs('beacon to http://evil.com/gate.php from 10.0.0.5, contact [email protected]') AS i
ORDER BY i.type, shareable;
For each alert in a table, list the file hashes it mentions with their algorithm: unnest extract_hashes over the alert text and label each hash with hash_type (alerts without hashes produce no rows).
WITH alerts(id, body) AS (VALUES (1, 'dropped d41d8cd98f00b204e9800998ecf8427e and da39a3ee5e6b4b0d3255bfef95601890afd80709'), (2, 'user reset password'), (3, 'payload e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')) SELECT a.id, h.hash, ioc.main.hash_type(h.hash) AS algorithm
FROM alerts AS a,
UNNEST(ioc.main.extract_hashes(a.body)) AS h(hash)
ORDER BY a.id, algorithm;
Triage a ticket queue: keep only tickets whose text contains any indicator (is_ioc), then count the IPv4 addresses, URLs and CVEs each one mentions.
WITH tickets(id, body) AS (VALUES (1, 'beacon to hxxp://evil[.]com/x from 10[.]0[.]0[.]5'), (2, 'password reset for jsmith'), (3, 'exploiting CVE-2024-1234 via 10[.]0[.]0[.]5 and 10[.]0[.]0[.]9'), (4, 'printer offline on floor 3')) SELECT id, len(ioc.main.extract_ipv4(body)) AS n_ips, len(ioc.main.extract_urls(body)) AS n_urls, len(ioc.main.extract_cves(body)) AS n_cves
FROM tickets
WHERE ioc.main.is_ioc(body)
ORDER BY id;
ioc_types
Registry of the indicator-of-compromise types this worker recognizes: for each type, the group it belongs to, the function that extracts it, a defanged example, and a one-line description.
List the network-layer indicator types and the function that extracts each.
SELECT name, extractor
FROM ioc.main.ioc_types
WHERE kind = 'network'
ORDER BY name;
Count how many indicator types fall into each coarse group.
SELECT kind, count(*) AS n_types
FROM ioc.main.ioc_types
GROUP BY kind
ORDER BY kind;
Label every indicator pulled from a defanged report with its coarse group (network, email, hash, vulnerability) and the single-type extractor for it, by joining extract_iocs to the ioc_types registry.
SELECT t.kind, i.type, i.value, t.extractor
FROM ioc.main.extract_iocs('dropper hxxps://cdn[.]evil[.]com/a.exe (sha256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855) beacons to 203[.]0[.]113[.]7, exploits CVE-2021-44228, phish from ops[at]evil[.]com') AS i
JOIN ioc.main.ioc_types AS t ON t.name = i.type
ORDER BY t.kind, i.type, i.value;
defang (text ANY)
Defang indicators in text so they are safe to share (http->hxxp, .->[.], @->[at], ://->[://])
Defang a live URL so it is safe to paste into a report (returns 'hxxp[://]evil[.]com/x').
SELECT ioc.main.defang('http://evil.com/x');
Turn a live incident note into a safe-to-share watchlist: extract every indicator with extract_iocs, then defang each value so none of them is clickable.
SELECT i.type, ioc.main.defang(i.value) AS shareable
FROM ioc.main.extract_iocs('beacon to http://evil.com/gate.php from 10.0.0.5, contact [email protected]') AS i
ORDER BY i.type, shareable;
extract_cves (text ANY)
Extract CVE identifiers (refangs first) as VARCHAR[]
Pull a CVE identifier out of a report (returns 'CVE-2024-1234').
SELECT UNNEST(ioc.main.extract_cves('exploiting CVE-2024-1234 in the wild'));
extract_domains (text ANY)
Extract bare domains (refangs first; URL/e-mail hosts excluded) as VARCHAR[]
Pull a bare defanged domain out of a report (returns 'evil.example.com').
SELECT UNNEST(ioc.main.extract_domains('callback to evil[.]example[.]com'));
extract_emails (text ANY)
Extract e-mail addresses (refangs first) as VARCHAR[]
Pull a defanged e-mail address out of a report (returns '[email protected]').
SELECT UNNEST(ioc.main.extract_emails('phish from bad[at]evil[.]com'));
extract_hashes (text ANY)
Extract md5/sha1/sha256/sha512 hashes (refangs first) as VARCHAR[]
Pull a file hash out of a report (returns 'd41d8cd98f00b204e9800998ecf8427e').
SELECT UNNEST(ioc.main.extract_hashes('sample md5 d41d8cd98f00b204e9800998ecf8427e'));
For each alert in a table, list the file hashes it mentions with their algorithm: unnest extract_hashes over the alert text and label each hash with hash_type (alerts without hashes produce no rows).
WITH alerts(id, body) AS (VALUES (1, 'dropped d41d8cd98f00b204e9800998ecf8427e and da39a3ee5e6b4b0d3255bfef95601890afd80709'), (2, 'user reset password'), (3, 'payload e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')) SELECT a.id, h.hash, ioc.main.hash_type(h.hash) AS algorithm
FROM alerts AS a,
UNNEST(ioc.main.extract_hashes(a.body)) AS h(hash)
ORDER BY a.id, algorithm;
extract_ipv4 (text ANY)
Extract IPv4 addresses (refangs first; private/reserved included) as VARCHAR[]
Pull the defanged IPv4 address out of a report (returns '10.0.0.5').
SELECT UNNEST(ioc.main.extract_ipv4('beacon from 10[.]0[.]0[.]5'));
extract_ipv6 (text ANY)
Extract IPv6 addresses (refangs first; canonicalized) as VARCHAR[]
Pull an IPv6 address out of free text (returns '2001:db8::1').
SELECT UNNEST(ioc.main.extract_ipv6('C2 at 2001:db8::1 observed'));
extract_urls (text ANY)
Extract URLs (refangs first) as VARCHAR[]
Pull a defanged URL out of a report (returns 'http://evil.com/x').
SELECT UNNEST(ioc.main.extract_urls('payload from hxxp://evil[.]com/x'));
hash_type (s ANY)
Classify a hex string as 'md5'|'sha1'|'sha256'|'sha512' by length, or NULL if it is not a recognized hash
Classify a 32-character hex string as an MD5 hash (returns 'md5').
SELECT ioc.main.hash_type('d41d8cd98f00b204e9800998ecf8427e');
For each alert in a table, list the file hashes it mentions with their algorithm: unnest extract_hashes over the alert text and label each hash with hash_type (alerts without hashes produce no rows).
WITH alerts(id, body) AS (VALUES (1, 'dropped d41d8cd98f00b204e9800998ecf8427e and da39a3ee5e6b4b0d3255bfef95601890afd80709'), (2, 'user reset password'), (3, 'payload e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')) SELECT a.id, h.hash, ioc.main.hash_type(h.hash) AS algorithm
FROM alerts AS a,
UNNEST(ioc.main.extract_hashes(a.body)) AS h(hash)
ORDER BY a.id, algorithm;
is_ioc (text ANY)
True if the text contains ANY recognizable IOC (refangs first)
Test whether free text contains any indicator of compromise (returns true).
SELECT ioc.main.is_ioc('beacon to 10[.]0[.]0[.]5');
Triage a ticket queue: keep only tickets whose text contains any indicator (is_ioc), then count the IPv4 addresses, URLs and CVEs each one mentions.
WITH tickets(id, body) AS (VALUES (1, 'beacon to hxxp://evil[.]com/x from 10[.]0[.]0[.]5'), (2, 'password reset for jsmith'), (3, 'exploiting CVE-2024-1234 via 10[.]0[.]0[.]5 and 10[.]0[.]0[.]9'), (4, 'printer offline on floor 3')) SELECT id, len(ioc.main.extract_ipv4(body)) AS n_ips, len(ioc.main.extract_urls(body)) AS n_urls, len(ioc.main.extract_cves(body)) AS n_cves
FROM tickets
WHERE ioc.main.is_ioc(body)
ORDER BY id;
refang (text ANY)
Refang defanged indicators back to live form (hxxp->http, [.]->., [at]->@, [://]->://)
Refang a defanged URL back to live form (returns 'http://evil.com').
SELECT ioc.main.refang('hxxp://evil[.]com');
extract_iocs (text VARCHAR)
Extract every distinct IOC from text as (type, value) rows (refangs first; deduplicated)
Extract every distinct indicator from a defanged report as (type, value) rows.
SELECT type, value
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5')
ORDER BY type, value;
| type | value |
|---|---|
| ipv4 | 10.0.0.5 |
| url | http://evil.com |
Count the distinct indicators found in a report, grouped by indicator type.
SELECT type, count(*) AS n
FROM ioc.main.extract_iocs('beacon to hxxp://evil[.]com from 10[.]0[.]0[.]5 and bad[at]evil[.]com')
GROUP BY type
ORDER BY type;
Keep only the network-layer indicators (IPs, domains, URLs) from a report.
SELECT value
FROM ioc.main.extract_iocs('c2 hxxp://evil[.]com from 10[.]0[.]0[.]5')
WHERE type IN ('ipv4', 'ipv6', 'url', 'domain')
ORDER BY value;
2 more examples
Label every indicator pulled from a defanged report with its coarse group (network, email, hash, vulnerability) and the single-type extractor for it, by joining extract_iocs to the ioc_types registry.
SELECT t.kind, i.type, i.value, t.extractor
FROM ioc.main.extract_iocs('dropper hxxps://cdn[.]evil[.]com/a.exe (sha256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855) beacons to 203[.]0[.]113[.]7, exploits CVE-2021-44228, phish from ops[at]evil[.]com') AS i
JOIN ioc.main.ioc_types AS t ON t.name = i.type
ORDER BY t.kind, i.type, i.value;
Turn a live incident note into a safe-to-share watchlist: extract every indicator with extract_iocs, then defang each value so none of them is clickable.
SELECT i.type, ioc.main.defang(i.value) AS shareable
FROM ioc.main.extract_iocs('beacon to http://evil.com/gate.php from 10.0.0.5, contact [email protected]') AS i
ORDER BY i.type, shareable;
Try these queries
Count the indicators in a report, grouped by type.
SELECT type, count(*) AS n
FROM ioc.main.extract_iocs('c2 hxxp://evil[.]com from 10[.]0[.]0[.]5 and bad[at]evil[.]com')
GROUP BY type
ORDER BY type
Uses extract_iocs
Defang a live URL so it is safe to paste into a report.
SELECT ioc.main.defang('http://evil.com/x') AS safe
Uses defang
Pull the defanged IPv4 addresses out of a report, one per row.
SELECT UNNEST(ioc.main.extract_ipv4('beacon from 10[.]0[.]0[.]5')) AS ip
Uses extract_ipv4
Classify a hex digest by algorithm.
SELECT ioc.main.hash_type('d41d8cd98f00b204e9800998ecf8427e') AS algorithm
Uses hash_type
List the network-layer indicator types and the function that extracts each.
SELECT name, extractor
FROM ioc.main.ioc_types
WHERE kind = 'network'
ORDER BY name
Uses ioc_types
Pull a defanged URL out of a report (returns 'http://evil.com/x').
SELECT UNNEST(ioc.main.extract_urls('payload from hxxp://evil[.]com/x'));
Uses extract_urls
17 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- Return a single boolean value that is true when the text 'exploiting CVE-2024-1234 in the wild' contains any indicator of compromise, and false otherwise.
- From the text 'C2 at 2001:db8::1 observed', return the IPv6 addresses, one address per row (a single column of scalar address strings, not a list).
- From the defanged text 'payload from hxxp://evil[.]com/x', return the URLs in live (clickable) form, one URL per row.
- From the defanged text 'callback to evil[.]example[.]com', return the bare domain names, one domain per row.
- From the defanged text 'phish from bad[at]evil[.]com', return the e-mail addresses in live form, one address per row.
- From the text 'exploiting CVE-2024-1234 in the wild', return the CVE identifiers, one per row.
Indicators of compromise is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
YARA
Security & forensics
Scan blobs and text for malware with YARA rules, straight from SQL
Threat intel
Security & forensics
Classify IPs, domains, URLs, and file hashes offline, then enrich them against threat-intel reputation feeds
CVE
Security & forensics
Look up CVE records, flag known-exploited CVEs, score exploit likelihood, find open-source package advisories, and compute CVSS v3.1 scores