WebAssembly / WebAssembly/wabt

wasm-decompile: Assertion `exp_stack.size() >= nagrs' failure cause DoS

Open
#2,317 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
8.1k
Forks
827
Avg merge
4d 6h
Merged PRs (30d)
18

Description

Environments

OS : Ubuntu 18.04 5.4.0-150-generic
Commit : e97d53c5fcbb604fc36432df4fc117d13558d7fd
Version : 1.0.34

Vulnerability Description

Affected Tool : wasm-decompile
Affected Version : <= 1.0.34
Impact : Denial of Service

  • The assertion 'exp_stack.size() >= nargs' fail in /include/wabt/decompiler-ast.h in wabt 1.0.34 can cause a denial of service(assertion failure) via a crafted wasm file.

PoC

1. Input File

wasm-decompile-DOS-poc02.zip

2. Reproduce

$ ~/wabt/bin/wasm-decompile wasm-decompile-DOS-poc02

3. Stack Trace

$ ~/wabt/bin/wasm-decompile wasm-decompile-DOS-poc02
wasm-decompile: ../../../../include/wabt/decompiler-ast.h:98: wabt::Node &wabt::AST::InsertNode(wabt::NodeType, wabt::ExprType, const wabt::Expr *, wabt::Index): Assertion `exp_stack.size() >= nargs' failed.
Aborted

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with wasm-decompile using wasm-decompile-DOS-poc02 and inspect the assertion at include/wabt/decompiler-ast.h:98. Trace the crafted input through the decompiler and verify that the assertion failure is prevented and the tool handles the input without aborting.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers, security, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.