Technical architecture
exav is a Cargo workspace of focused crates rather than one binary, plus two WebAssembly packages built outside the workspace with their own profile. How the scanner works inside is in How scanning works, and how the extractor does in How extraction works.
How the crates compose
Section titled “How the crates compose”The CLI (which is also the daemon) drives the scanning engine, exav-core,
which also builds its own WASI binary, exav-wasm (feature wasi-bin). Two
front ends use the extractor, exav-unpack: the archive grep and
@exav/unpack-wasm. @exav/viewer’s wasm modules use only exav-render.
exav-core hashes images through exav-imagehash (the image-hash
feature), which decodes them with exav-render. exav-render reads DWG and DXF
with exav-unpack’s drawing parsers (its dwg feature), and its text layer
reads HTML and the XML parts of documents with exav-unpack’s (its text
feature). That layer, the text a reader sees in a document, is also what the
scanner (exav-core’s visible-text feature) and the archive grep (its
text feature) read documents through; the scanner draws nothing.
exav-update, behind the http-update feature (part of http), sits to the
side, feeding fresh signatures out of band.
exav-render is one crate, with the office converters in it as modules:
spreadsheets (sheets) to XLSX, presentations and drawings (slides) to
PPTX and text documents (docs) to DOCX, each behind a feature
(office-sheets, office-slides, office-docs, or office for the three),
and a common module they share (ZIP packages, ODF’s XML, code pages,
compound files, iWork archives) that is not public. None is in the default
feature set. Under the office features the crate adds zip, quick-xml,
encoding_rs, md-5 and sha1 to its dependencies (flate2, which they use
too, is already there for the image decoders). The scanner links all of them
already, through exav-unpack, so visible-text-office adds code but no crate.
The viewer builds sheets, slides and docs into one wasm module each.
Every arrow points down: nothing calls anything above it, which is what lets the extraction, decoding and hashing crates be taken on their own. Dashed arrows are optional dependencies, each behind the Cargo feature it is labelled with.
Every crate in the graph is #![forbid(unsafe_code)] except exav, whose
daemon calls libc to fork its workers, set their limits, handle signals and
pass file descriptors between processes.
The unsafe that remains is in dependencies (see
Dependencies).
Extraction touches hostile bytes first and hardest, so it lives in its own crate with its own budget and panic containment. It also means one piece can be used alone: a build system that needs to look inside archives does not need a virus scanner, and a reverse engineer who wants to unpack a packed executable needs neither.
exav-pe-emu sits below the extractor for the same reason. Running a packer’s stub
is the one place where the scanner executes attacker-authored control flow
rather than parsing attacker-authored data, so it is its own crate with its own
budgets and no way to reach a syscall.
Each crate has its own page, with install instructions, API, and examples:
exav-unpack and @exav/unpack-wasm
under Archive extraction, @exav/viewer under File viewer, and the rest
under Subprojects.