NTFS MFT
Turn a collected NTFS $MFT into a SQL forensic timeline with full paths, timestomp flags, deleted records, and data streams
- 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/mft/index.md to help me query NTFS MFT 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.
See what you can query
Example output · captured
- Connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT entry, full_path, is_deleted FROM mft.main.read_mft(getvariable('mft_sample'))
| entry | full_path | is_deleted |
|---|---|---|
| 0 | $MFT | false |
| 5 | . | false |
| 11 | Windows | false |
| 12 | Windows\System32 | false |
| 20 | Windows\System32\cmd.exe | false |
Quick start
Choose where to run NTFS MFT, 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 'mft' AS mft (
TYPE vgi,
LOCATION 'github-auto://Query-farm/vgi-mft'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'mft' AS mft (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-mft:0.5.0'
);
3. Run a query
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT entry, full_path, is_deleted FROM mft.main.read_mft(getvariable('mft_sample'))
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 'mft' AS mft
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT entry, full_path, is_deleted FROM mft.main.read_mft(getvariable('mft_sample'))
Query Farm operates NTFS MFT 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 mft as the catalog alias for the query below.
4. Run a query
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT entry, full_path, is_deleted FROM mft.main.read_mft(getvariable('mft_sample'))
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 'mft' AS mft (
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 'mft' AS mft (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-mft:0.5.0'
);
Overview
Parse the NTFS $MFT into a forensic filesystem timeline: path reconstruction, the SI/FN MACB timestamp pair, timestomp detection, deleted-record recovery, and alternate data streams — straight into SQL.
Parse a collected NTFS $MFT (Master File Table) into a full forensic filesystem timeline — one row per FILE record — without a per-host CLI run and with zero egress. Built for DFIR / incident-response / threat-hunt teams who want to timeline thousands of collected $MFTs and join the result to known-bad paths, hashes, and rules in one query.
Key concepts. The $MFT is NTFS's index of every file and directory. Each FILE record carries the metadata this worker turns into columns: the full path reconstructed by walking parent references, logical and physical sizes, allocated / deleted and file / directory flags, alternate data streams, and inline resident content. Deleted-but-resident records are recovered by default.
The timestomp engine. $STANDARD_INFORMATION is user-writable (the Win32 SetFileTime API and anti-forensic tools rewrite it) while $FILE_NAME is kernel-only, so a standard-information timestamp that predates its file-name counterpart — naturally impossible — and whole-second values are strong anti-forensic tells. Both MACB timestamp quads are first-class columns.
Built on the permissively-licensed mft crate (omerbenamram); the NTFS on-disk layout is documented openly by Microsoft and the forensics community.
Sources and references
- Master File Table (Microsoft Learn)
- libyal NTFS format documentation — FILE records, attributes and timestamps
- omerbenamram/mft — the Rust
$MFTparser this worker builds on (docs.rs)
Catalog
Everything mft exposes once attached — read straight from the worker's
released build.
main 1 view · 8 functions
NTFS $MFT forensics: a filesystem timeline, per-record decode and validation, the timestomp heuristic, and attribute / $DATA-stream fan-out.
Schema examples (6)
The headline forensic timeline: one row per FILE record with its reconstructed path and deleted flag.
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT entry, full_path, is_deleted FROM mft.main.read_mft(getvariable('mft_sample'));
| entry | full_path | is_deleted |
|---|---|---|
| 0 | $MFT | false |
| 5 | . | false |
| 11 | Windows | false |
| 12 | Windows\System32 | false |
| 20 | Windows\System32\cmd.exe | false |
Hunt for timestomped records — the SI-vs-FN heuristic exposed as a plain WHERE clause.
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT full_path FROM mft.main.read_mft(getvariable('mft_sample')) WHERE is_timestomp_suspect;
Surface every alternate data stream (a classic malware hiding spot) via streams mode.
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT full_path, ads_name FROM mft.main.read_mft(getvariable('mft_sample'), mode := 'streams') WHERE ads_name IS NOT NULL;
Profile the attribute makeup of a whole $MFT: feed every record entry from the read_mft timeline into attributes(), label each attribute type with its purpose from the ntfs_attribute_types reference view, and count the records and attribute instances per type.
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT a.type_id, t.type_name, t.purpose, count(DISTINCT a.entry) AS records, count(*) AS instances FROM mft.main.attributes((FROM (SELECT getvariable('mft_sample') AS blob, entry FROM mft.main.read_mft(getvariable('mft_sample'))))) AS a JOIN mft.main.ntfs_attribute_types AS t ON t.type_id = a.type_id GROUP BY ALL ORDER BY a.type_id;
2 more examples
Explain each timestomp suspect in the read_mft timeline: re-score its $STANDARD_INFORMATION and $FILE_NAME MACB columns with timestomp() to list which heuristic reasons fired (the timeline itself only carries the is_timestomp_suspect flag).
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT full_path, si_created, fn_created, mft.main.timestomp({'created': si_created, 'modified': si_modified, 'accessed': si_accessed, 'mft_modified': si_mft_modified}, {'created': fn_created, 'modified': fn_modified, 'accessed': fn_accessed, 'mft_modified': fn_mft_modified}).reasons AS reasons FROM mft.main.read_mft(getvariable('mft_sample')) WHERE is_timestomp_suspect ORDER BY full_path;
Pair each path in the read_mft timeline with its DOS 8.3 short name, unnesting the full $FILE_NAME list that mft_record() decodes for the entry (the timeline keeps only the primary Win32 name).
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT t.full_path, f.name AS short_name FROM mft.main.read_mft(getvariable('mft_sample')) AS t, unnest(mft.main.mft_record(getvariable('mft_sample'), t.entry).fn) AS u(f) WHERE f.namespace = 'DOS' ORDER BY t.full_path;
ntfs_attribute_types
Reference registry mapping each NTFS attribute type code to its canonical name and purpose — the vocabulary behind the type_id / type_name columns of the attributes() function. A static, credential-free lookup you can browse or join.
Browse the whole NTFS attribute-type registry, lowest code first.
SELECT type_id, type_name, purpose
FROM mft.main.ntfs_attribute_types
ORDER BY type_id;
Look up the name and purpose of attribute type 128 (the $DATA attribute).
SELECT type_name, purpose
FROM mft.main.ntfs_attribute_types
WHERE type_id = 128;
full_path (blob BLOB, entry UBIGINT)
Reconstruct one $MFT entry's full path from parent references
Reconstruct the full filesystem path of one record (entry 20) in the sample $MFT.
SELECT mft.main.full_path((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft')), 20) AS full_path;
mft_record (blob BLOB, entry UBIGINT)
Fully decode one $MFT record into a lossless STRUCT view
-
entryUBIGINT
-
sequenceUSMALLINT
-
in_useBOOLEAN
-
is_dirBOOLEAN
-
base_refUBIGINT
-
lsnUBIGINT
-
hard_linksUSMALLINT
-
siSTRUCTSTRUCT 6 fields
-
createdTIMESTAMP
-
modifiedTIMESTAMP
-
accessedTIMESTAMP
-
mft_modifiedTIMESTAMP
-
dos_attrUINTEGER
-
usnUBIGINT
-
-
fnSTRUCT[]STRUCT[] 10 fields
-
nameVARCHAR
-
namespaceVARCHAR
-
parent_entryUBIGINT
-
parent_seqUSMALLINT
-
createdTIMESTAMP
-
modifiedTIMESTAMP
-
accessedTIMESTAMP
-
mft_modifiedTIMESTAMP
-
logical_sizeUBIGINT
-
physical_sizeUBIGINT
-
-
dataSTRUCTSTRUCT 4 fields
-
residentBOOLEAN
-
logical_sizeUBIGINT
-
physical_sizeUBIGINT
-
resident_bytesBLOB
-
-
adsSTRUCT[]STRUCT[] 3 fields
-
nameVARCHAR
-
logical_sizeUBIGINT
-
residentBOOLEAN
-
-
attributesSTRUCT[]STRUCT[] 4 fields
-
type_idUINTEGER
-
type_nameVARCHAR
-
residentBOOLEAN
-
nameVARCHAR
-
Fully decode one sample $MFT record, exposing its primary name and how many alternate data streams it carries.
SELECT r.fn[1].name AS primary_name, len(r.ads) AS ads_count
FROM (SELECT mft.main.mft_record((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft')), 22) AS r);
Pair each path in the read_mft timeline with its DOS 8.3 short name, unnesting the full $FILE_NAME list that mft_record() decodes for the entry (the timeline keeps only the primary Win32 name).
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT t.full_path, f.name AS short_name FROM mft.main.read_mft(getvariable('mft_sample')) AS t, unnest(mft.main.mft_record(getvariable('mft_sample'), t.entry).fn) AS u(f) WHERE f.namespace = 'DOS' ORDER BY t.full_path;
record_header (blob BLOB, entry UBIGINT)
Probe one $MFT record's FILE header without decoding attributes
-
signatureVARCHAR
-
sequenceUSMALLINT
-
in_useBOOLEAN
-
is_dirBOOLEAN
-
base_refUBIGINT
-
lsnUBIGINT
-
used_sizeUINTEGER
-
allocated_sizeUINTEGER
Probe just the FILE-record header of one sample record (entry 12): signature, directory flag, and sequence number.
SELECT h.signature, h.is_dir, h.sequence
FROM (SELECT mft.main.record_header((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft')), 12) AS h);
timestomp (si STRUCT of 4 fields, fn STRUCT of 4 fields)
Score the SI-vs-FN timestomp heuristic over two MACB quads
-
createdTIMESTAMP
-
modifiedTIMESTAMP
-
accessedTIMESTAMP
-
mft_modifiedTIMESTAMP
-
createdTIMESTAMP
-
modifiedTIMESTAMP
-
accessedTIMESTAMP
-
mft_modifiedTIMESTAMP
Flag a record whose $STANDARD_INFORMATION quad predates its $FILE_NAME quad — the naturally-impossible ordering timestomping produces.
SELECT mft.main.timestomp({'created': TIMESTAMP '2009-01-01', 'modified': TIMESTAMP '2009-01-01', 'accessed': TIMESTAMP '2009-01-01', 'mft_modified': TIMESTAMP '2009-01-01'}, {'created': TIMESTAMP '2020-01-01', 'modified': TIMESTAMP '2020-01-01', 'accessed': TIMESTAMP '2020-01-01', 'mft_modified': TIMESTAMP '2020-01-01'}).suspect AS suspect;
Explain each timestomp suspect in the read_mft timeline: re-score its $STANDARD_INFORMATION and $FILE_NAME MACB columns with timestomp() to list which heuristic reasons fired (the timeline itself only carries the is_timestomp_suspect flag).
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT full_path, si_created, fn_created, mft.main.timestomp({'created': si_created, 'modified': si_modified, 'accessed': si_accessed, 'mft_modified': si_mft_modified}, {'created': fn_created, 'modified': fn_modified, 'accessed': fn_accessed, 'mft_modified': fn_mft_modified}).reasons AS reasons FROM mft.main.read_mft(getvariable('mft_sample')) WHERE is_timestomp_suspect ORDER BY full_path;
well_formed (blob BLOB, entry UBIGINT)
Validate one $MFT record; never panics on corrupt input
Validate one sample record (entry 20) — a clean record reports ok = true with kind 'ok'.
SELECT w.ok, w.kind
FROM (SELECT mft.main.well_formed((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft')), 20) AS w);
read_mft (glob_or_blob ANY, host := VARCHAR, mode := VARCHAR)
Parse a collected NTFS $MFT into a forensic filesystem timeline
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT entry, full_path, is_deleted FROM mft.main.read_mft(getvariable('mft_sample')) ORDER BY entry;
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT full_path FROM mft.main.read_mft(getvariable('mft_sample')) WHERE is_timestomp_suspect ORDER BY full_path;
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT full_path, ads_name FROM mft.main.read_mft(getvariable('mft_sample'), mode := 'streams') WHERE ads_name IS NOT NULL ORDER BY full_path;
attributes (relation TABLE)
Fan each MFT record's attributes into rows (relation in/out)
List every attribute (type, residency, ADS name, size) of one sample $MFT record.
SELECT entry, type_name, resident, name, logical_size
FROM mft.main.attributes((FROM (SELECT content AS blob, 22::UBIGINT AS entry FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'))));
Profile the attribute makeup of a whole $MFT: feed every record entry from the read_mft timeline into attributes(), label each attribute type with its purpose from the ntfs_attribute_types reference view, and count the records and attribute instances per type.
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT a.type_id, t.type_name, t.purpose, count(DISTINCT a.entry) AS records, count(*) AS instances FROM mft.main.attributes((FROM (SELECT getvariable('mft_sample') AS blob, entry FROM mft.main.read_mft(getvariable('mft_sample'))))) AS a JOIN mft.main.ntfs_attribute_types AS t ON t.type_id = a.type_id GROUP BY ALL ORDER BY a.type_id;
SELECT type_name, resident, name, logical_size
FROM mft.main.attributes((FROM (SELECT content AS blob, 22::UBIGINT AS entry FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'))))
ORDER BY attribute_id;
streams (relation TABLE)
Fan each MFT record's $DATA streams into rows (relation in/out)
List the $DATA streams (primary + each ADS) of one sample $MFT record.
SELECT entry, name, logical_size, resident
FROM mft.main.streams((FROM (SELECT content AS blob, 22::UBIGINT AS entry FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'))));
SELECT name, logical_size, resident
FROM mft.main.streams((FROM (SELECT content AS blob, 22::UBIGINT AS entry FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'))))
ORDER BY name NULLS FIRST;
Try these queries
Hunt for timestomped records — the SI-vs-FN heuristic exposed as a plain WHERE clause.
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT full_path FROM mft.main.read_mft(getvariable('mft_sample')) WHERE is_timestomp_suspect
Uses read_mft
Profile the attribute makeup of a whole $MFT: feed every record entry from the read_mft timeline into attributes(), label each attribute type with its purpose from the ntfs_attribute_types reference view, and count the records and attribute instances per type.
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT a.type_id, t.type_name, t.purpose, count(DISTINCT a.entry) AS records, count(*) AS instances FROM mft.main.attributes((FROM (SELECT getvariable('mft_sample') AS blob, entry FROM mft.main.read_mft(getvariable('mft_sample'))))) AS a JOIN mft.main.ntfs_attribute_types AS t ON t.type_id = a.type_id GROUP BY ALL ORDER BY a.type_id
Explain each timestomp suspect in the read_mft timeline: re-score its $STANDARD_INFORMATION and $FILE_NAME MACB columns with timestomp() to list which heuristic reasons fired (the timeline itself only carries the is_timestomp_suspect flag).
SET VARIABLE mft_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'));
SELECT full_path, si_created, fn_created, mft.main.timestomp({'created': si_created, 'modified': si_modified, 'accessed': si_accessed, 'mft_modified': si_mft_modified}, {'created': fn_created, 'modified': fn_modified, 'accessed': fn_accessed, 'mft_modified': fn_mft_modified}).reasons AS reasons FROM mft.main.read_mft(getvariable('mft_sample')) WHERE is_timestomp_suspect ORDER BY full_path
Browse the whole NTFS attribute-type registry, lowest code first.
SELECT type_id, type_name, purpose
FROM mft.main.ntfs_attribute_types
ORDER BY type_id
Uses ntfs_attribute_types
List the $DATA streams (primary + each ADS) of one sample $MFT record.
SELECT entry, name, logical_size, resident
FROM mft.main.streams((FROM (SELECT content AS blob, 22::UBIGINT AS entry FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft'))))
Uses streams
Probe just the FILE-record header of one sample record (entry 12): signature, directory flag, and sequence number.
SELECT h.signature, h.is_dir, h.sequence
FROM (SELECT mft.main.record_header((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-mft/v0.2.0/data/sample.mft')), 12) AS h)
Uses record_header
13 more examples in the Catalog, each listed under the table or function it uses.
NTFS MFT 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
Registry hives
Security & forensics
Parse offline Windows Registry hive files into SQL rows for forensics, with transaction-log replay and deleted-key recovery
Windows event logs (EVTX)
Security & forensics
Parse Windows .evtx event-log files into queryable SQL rows for forensics and incident response
Disassembler
Security & forensics
Disassemble binaries and shellcode, then triage their sections, imports, strings, and MITRE ATT&CK capabilities