Skip to content
Memory corruption Disclosed report Advanced

AddressSanitizer: SEGV [@ vixl::Memory::Read]

A crafted WebAssembly module causes a segmentation fault inside the ARM64 simulator used by the JavaScript engine when the exported function is called. The crash is a read from an invalid address in the simulator's memory access code, which could potentially be a memory-safety issue, though the reporter is unsure whether it is security-sensitive or simulator-only.

Gary Kwong Follow

Originally disclosed on Mozilla

  • Fixed in 17 days
  • Paid in 18 days
  • Disclosed after 17 days

This is test.wrapper, test.wasm is attached.

JavaScript
new WebAssembly.Instance(new WebAssembly.Module(read(scriptArgs[0], "binary"))).exports.g();
AddressSanitizer:DEADLYSIGNAL
=================================================================
==12641==ERROR: AddressSanitizer: SEGV on unknown address 0x7f3ffab5ffff (pc 0x55d9235f5166 bp 0x7fff7587aac0 sp 0x7fff7587a120 T0)
==12641==The signal is caused by a READ memory access.
    #0 0x55d9235f5165 in short vixl::Memory::Read<short, unsigned long>(unsigned long) /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/Simulator-vixl.h:69:5
    #1 0x55d9235f5165 in short vixl::Simulator::Read<short>(unsigned long) /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/Simulator-vixl.cpp:1042:12
    #2 0x55d9235f5165 in vixl::Simulator::LoadStoreHelper(vixl::Instruction const*, long, vixl::AddrMode) /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/Simulator-vixl.cpp:1077:24
    #3 0x55d9234f1a99 in vixl::Decoder::VisitLoadStoreUnsignedOffset(vixl::Instruction const*) /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/Decoder-vixl.cpp:876:1
    #4 0x55d9234f1a99 in vixl::Decoder::DecodeLoadStore(vixl::Instruction const*) /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/Decoder-vixl.cpp:386:11
    #5 0x55d9235ee91f in vixl::Decoder::Decode(vixl::Instruction const*) /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/Decoder-vixl.h:158:5
    #6 0x55d9235ee91f in vixl::Simulator::ExecuteInstruction() /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/MozSimulator-vixl.cpp:224:13
    #7 0x55d9235ee91f in vixl::Simulator::Run() /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/Simulator-vixl.cpp:70:5
    #8 0x55d9235e4af0 in vixl::Simulator::RunFrom(vixl::Instruction const*) /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/Simulator-vixl.cpp:78:3
    #9 0x55d9235e4af0 in vixl::Simulator::call(unsigned char*, int, ...) /home/skygentoo/trees/mozilla-central/js/src/jit/arm64/vixl/MozSimulator-vixl.cpp:312:3
    #10 0x55d923eb121a in js::wasm::Instance::callExport(JSContext*, unsigned int, JS::CallArgs) /home/skygentoo/trees/mozilla-central/js/src/wasm/WasmInstance.cpp:2135:10
    #11 0x55d923f04d0d in WasmCall(JSContext*, unsigned int, JS::Value*) /home/skygentoo/trees/mozilla-central/js/src/wasm/WasmJS.cpp:1964:19
    #12 0x55d921beb695 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /home/skygentoo/trees/mozilla-central/js/src/vm/Interpreter.cpp:498:13
    #13 0x55d921beb695 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /home/skygentoo/trees/mozilla-central/js/src/vm/Interpreter.cpp:590:12
    #14 0x55d921bd4f97 in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /home/skygentoo/trees/mozilla-central/js/src/vm/Interpreter.cpp:643:10
    #15 0x55d921bd4f97 in js::CallFromStack(JSContext*, JS::CallArgs const&) /home/skygentoo/trees/mozilla-central/js/src/vm/Interpreter.cpp:647:10
    #16 0x55d921bd4f97 in Interpret(JSContext*, js::RunState&) /home/skygentoo/trees/mozilla-central/js/src/vm/Interpreter.cpp:3294:16
    #17 0x55d921bb7cea in js::RunScript(JSContext*, js::RunState&) /home/skygentoo/trees/mozilla-central/js/src/vm/Interpreter.cpp:468:13
    #18 0x55d921bf17f3 in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JS::Handle<JSObject*>, JS::Handle<JS::Value>, js::AbstractFramePtr, JS::MutableHandle<JS::Value>) /home/skygentoo/trees/mozilla-central/js/src/vm/Interpreter.cpp:835:13
    #19 0x55d921f0de1e in JS_ExecuteScript(JSContext*, JS::Handle<JSScript*>) /home/skygentoo/trees/mozilla-central/js/src/vm/CompilationAndEvaluation.cpp:457:10
    #20 0x55d921a549c5 in RunFile(JSContext*, char const*, _IO_FILE*, CompileUtf8, bool) /home/skygentoo/trees/mozilla-central/js/src/shell/js.cpp:974:10
    #21 0x55d921a531a4 in Process(JSContext*, char const*, bool, FileKind) /home/skygentoo/trees/mozilla-central/js/src/shell/js.cpp:1565:14
    #22 0x55d9219fac9c in ProcessArgs(JSContext*, js::cli::OptionParser*) /home/skygentoo/trees/mozilla-central/js/src/shell/js.cpp:10347:10
    #23 0x55d9219fac9c in Shell(JSContext*, js::cli::OptionParser*, char**) /home/skygentoo/trees/mozilla-central/js/src/shell/js.cpp:11046:10
    #24 0x55d9219ed396 in main /home/skygentoo/trees/mozilla-central/js/src/shell/js.cpp:11812:12
    #25 0x7f41fe924e8a in __libc_start_main (/lib64/libc.so.6+0x23e8a)
    #26 0x55d921926029 in _start (/home/skygentoo/shell-cache/js-64-asan-armsim64-linux-x86_64-fd1683e51ec5/js-64-asan-armsim64-linux-x86_64-fd1683e51ec5+0x2009029)

AddressSanitizer can not provide additional info.

Run with --fuzzing-safe --no-threads --no-baseline --no-ion test.wrapper test.wasm, compile with AR=ar sh ./configure --enable-simulator=arm64 --enable-address-sanitizer --disable-jemalloc --with-ccache --enable-gczeal --enable-debug-symbols --disable-tests, tested on m-c rev fd1683e51ec5.

Not sure if this is s-s or if it's ARM64 simulator-only, I'd leave it to Julian/Lars. Bisection result coming soon...

The original report as published on Mozilla's Bugzilla, by Gary Kwong. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the ARM64 simulator's load/store handling does not validate the computed address before reading, so a crafted WebAssembly module can make it read from an unmapped address.

Impact

A crafted WebAssembly module could crash the engine through an out-of-bounds read in the ARM64 simulator; the reporter is unsure whether this is security-sensitive or limited to the simulator.

What the attacker needed

Crafted WebAssembly module; ARM64 simulator build

How it was found

  1. Load the attached WebAssembly module in the JavaScript shell.
  2. Call the exported function g on the instance.
  3. Observe the AddressSanitizer segmentation fault in the ARM64 simulator.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

WebAssembly is a way to run compiled code inside a browser or JavaScript engine. Here a specially crafted WebAssembly file made the engine's ARM64 simulator crash while reading memory, which is a sign of a memory-safety bug. The reporter is not yet sure whether this affects real devices or only the simulator used for testing.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Gary Kwong

View all

42 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.