Skip to main content

wasm-tools

wasm-tools is a pure-Python WebAssembly parser, disassembler, and security triage toolkit. It decodes core modules and Component Model binaries, produces objdump-style disassembly, extracts strings with linear-memory provenance, builds a static call graph, and emits a structured JSON report with capability and risk analysis. It never executes the code it parses, and the library has zero runtime dependencies.

AI-DECLARATION: auto

Documentation site

The full documentation is published at appthreat.github.io/wasm-tools and lives in this repository under docs/. The site is plain markdown served by docsify, so every page is readable both on GitHub and in the browser. Highlights:

Page Contents
Getting started Installation and first commands
CLI reference Every flag, output format, and index semantics
Format primer What the bytes in a .wasm file mean
JSON report reference The machine-readable contract
Findings and signals Every analysis rule, threshold, and severity
Analyst guide Triage recipes for unknown binaries
Lessons 1 to 10 Hands-on tutorials against the repo fixtures
Architecture Parser internals and design decisions
Development guide Extending opcodes, sections, visitors, and rules

Quick start

pip install wasm-tools
wasm-tools module.wasm --headers     # section map
wasm-tools module.wasm -d            # disassembly
wasm-tools module.wasm --json --analysis-only   # risk tier, capabilities, findings

From Python:

from wasm_tools.api import parse_wasm_file

report = parse_wasm_file("module.wasm")
print(report["analysis"]["summary"]["risk_tier"])
for finding in report["analysis"]["findings"]:
    print(finding["id"], finding["severity"], finding["title"])

Every command is safe on untrusted files: parse failures land in report["errors"] instead of raising, and nothing in the pipeline evaluates the decoded code.

What the tool reports

The JSON report (documented field by field in the reference) includes section tables, function bodies with decoded instructions, imports and exports, memory and table limits, data segments, extracted strings with secret and IoC screening, a labeled call graph with reachability, toolchain fingerprints from producers and target_features custom sections, and, for Component Model binaries, the full interface inventory with per-core-module reports.

The analysis layer on top is heuristic by design and intended for triage. It infers host capability tokens (fs.path, network, process.terminate, and others), detects WASI and JavaScript-interface modules, classifies the binary format, computes behavior profiles, and raises stable-id findings (WASM-CAP-001 through WASM-STR-007) with severity, evidence, and remediation text. Exact rule behavior is in FINDINGS.md.

Supported coverage

The decoder covers the WebAssembly binary format through the post-3.0 proposals: SIMD, threads, GC, exception handling, memory64 and table64, wide arithmetic, half-precision, custom page sizes, and shared limits, plus Component Model binaries. The coverage matrix records implementation status per area against the bundled spec snapshot under specification/wasm-latest/. Spec validation and text-format (.wat) parsing are deliberate scope exclusions; the tool decodes and reports, it does not judge correctness.

Trust and provenance

The source code in this repository was fully generated by AI assistants, with human edits limited to formatting and minor changes. Treat the codebase as useful but review it before depending on it in a security workflow. The repository reflects that posture: parser failures are covered by malformed-input tests, end-to-end tests assert exact disassembly substrings, and the error model keeps malformed files from crashing batch pipelines.

Development

poetry install
poetry run pytest -q
poetry run python tests/fixtures/build.py   # requires WABT wat2wasm

The development guide covers the extension recipes (opcodes, sections, visitors, analysis rules) and the conventions that keep the error model and output contract stable.

License

This project is licensed under the MIT License. See LICENSE for details.

The inputs to the AI agents came from the WebAssembly specification, the WABT project, and the author's knowledge of Python and WebAssembly. The outputs are original code generated by the AI agents based on those inputs. It is possible this project is therefore not MIT-licensed due to the presence of third-party specification text in the training data. The author has made a good faith effort to generate original code and to avoid copying any specific text from the specification, but this cannot be guaranteed. Users should review the code and the specification to ensure compliance with their licensing needs.

Metadata

Release files for wasm-tools 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wasm-tools 2.1.0
File Size Uploaded
wasm_tools-2.1.0.tar.gz 53.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wasm-tools 2.1.0
File Interpreter ABI Platform
wasm_tools-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 109.3 kB

Release files / wasm_tools-2.1.0.tar.gz

Download URL wasm_tools-2.1.0.tar.gz
Size 53.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fbfd4a962462e6128eb37446957d9ccac4e18b34d2cb894821697139d12f26d4
BLAKE2b-256 checksum
How to use checksums
daf93a6260818f6b7b7aa23b204a06e8a8ea6cb1f7d64cd2ab47eb1afaefe332
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.

Transparency log

Release files / wasm_tools-2.1.0-py3-none-any.whl

Download URL wasm_tools-2.1.0-py3-none-any.whl
Size 55.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
237d68dd5767c639a3a76633ebfc628062ec3d5da48be902ffa62b351f8d61f9
BLAKE2b-256 checksum
How to use checksums
136f4d9a1e23bc9b50fc65b7afa73992cac27f263fc10668c5fe963250299e1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page