Wasm Baseline inline memory.copy omits source-side bounds checks for custom page sizes, causing source OOB reads without trap
Categories
(Core :: JavaScript: WebAssembly, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr140 | --- | unaffected |
| firefox151 | --- | disabled |
| firefox152 | --- | disabled |
| firefox153 | --- | disabled |
People
(Reporter: github, Unassigned)
References
(Blocks 2 open bugs)
Details
(4 keywords)
Attachments
(1 file)
|
1.36 KB,
text/javascript
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36
Steps to reproduce:
- Build Firefox with ENABLE_WASM_CUSTOM_PAGE_SIZES enabled (Nightly aarch64 x86_64 defaults include this).
- Run SpiderMonkey shell with Baseline compiler path (default) using the attached wasm testcase.
- Execute memory.copy with crafted parameters that cause source range to cross custom-page memory boundary: src=5 dst=0 len=12 or src=6 dst=0 len=11 where the first source chunk is in-bounds but later chunks
exceed memory bounds.
Actual results:
The Baseline inline memory.copy path reused omitted bounds-check state after the first source load. For custom page sizes where offset guard limit is zero, later source loads proceeded without trap even when
crossing memory boundary. Observed output:
VULNERABLE: source OOB src=5 dst=0 len=12: no trap dst[0..3]=70,71,72,73
VULNERABLE: source OOB src=6 dst=0 len=11: no trap dst[0..3]=71,72,73,74
Regression test failed with:
Error: assertion failed: expected exception RuntimeError, no exception thrown
Control tests with FX0003_WASM_COMPILER=optimizing or FX0003_WASM_COMPILER=ion passed, isolating the issue to Baseline inline path.
Expected results:
memory.copy must trap with RuntimeError: index out of bounds when source range crosses wasm memory bounds, regardless of page size configuration. Each source load in the inline copy loop should be bounds-checked
for custom page sizes where offset guard is zero.
Updated•6 months ago
|
Comment 1•6 months ago
|
||
This is currently disabled in 153.
Updated•6 months ago
|
Updated•6 months ago
|
Comment 2•6 months ago
|
||
The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.
Comment 3•6 months ago
|
||
Increasing severity to S2 since this is now a sec-high bug.
Comment 5•5 months ago
|
||
This is in fact also a duplicate of 2026383.
Updated•1 month ago
|
Description
•