首页
社区
课程
招聘
[翻译]Pegasus内核漏洞分析与利用(上)(CVE-2016-4655/CVE-2016-4656)
发表于: 2016-10-18 14:39 5938

[翻译]Pegasus内核漏洞分析与利用(上)(CVE-2016-4655/CVE-2016-4656)

2016-10-18 14:39
5938
#define kOSSerializeBinarySignature "\323\0\0" /* 0x000000d3 */
enum {
    kOSSerializeDictionary      = 0x01000000U,
    kOSSerializeArray           = 0x02000000U,
    kOSSerializeSet             = 0x03000000U,
    kOSSerializeNumber          = 0x04000000U,
    kOSSerializeSymbol          = 0x08000000U,
    kOSSerializeString          = 0x09000000U,
    kOSSerializeData            = 0x0a000000U,
    kOSSerializeBoolean         = 0x0b000000U,
    kOSSerializeObject          = 0x0c000000U,
    kOSSerializeTypeMask        = 0x7F000000U,
    kOSSerializeDataMask        = 0x00FFFFFFU,
    kOSSerializeEndCollection   = 0x80000000U,
};
031000000024000000000000000000000000
0x000000d3 0x81000000 0x09000004 0x00414141 0x8b000001
<dict>
    <string>AAA</string>
    <boolean>1</boolean>
</dict>
<dict>                          <!-- dict, level 0 | END! -->
    <string>AAA</string>        <!-- string, level 1 -->
    <boolean>1</boolean>        <!-- bool, level 1 -->

    <string>BBB</string>        <!-- string, level 1 -->
    <boolean>1</boolean>        <!-- bool, level 1 -->

    <dict>                      <!-- dict, level 1 -->
        <string>CCC</string>    <!-- string, level 2 -->
        <boolean>1</boolean>    <!-- bool, level 2 | END! -->
    </dict>

    <string>DDD</string>        <!-- string, level 1 -->
    <boolean>1</boolean>        <!-- bool, level 1 | END! -->
</dict>
libkern/c++/OSUnserializeXML.cpp
OSObject* OSUnserializeXML(const char *buffer, size_t bufferSize, OSString **errorString)
{
    if (!buffer)
        return (0);
    if (bufferSize < sizeof(kOSSerializeBinarySignature))
        return (0);

    if (!strcmp(kOSSerializeBinarySignature, buffer))
        return OSUnserializeBinary(buffer, bufferSize, errorString);

    // XML must be null terminated
    if (buffer[bufferSize - 1]) return 0;

    return OSUnserializeXML(buffer, errorString);
}
   while (ok)
    {
        bufferPos += sizeof(*next);
        if (!(ok = (bufferPos <= bufferSize))) break;
        key = *next++;

        len = (key & kOSSerializeDataMask);
        wordLen = (len + 3) >> 2;
        end = (0 != (kOSSerializeEndCollecton & key));

        newCollect = isRef = false;
        o = 0; newDict = 0; newArray = 0; newSet = 0;

        switch (kOSSerializeTypeMask & key)
        {
            case kOSSerializeDictionary:
            ...

            case kOSSerializeArray:
            ...

            case kOSSerializeSet:
            ...

            case kOSSerializeObject:
            ...

            case kOSSerializeNumber:
            ...

            case kOSSerializeSymbol:
            ...

            case kOSSerializeString:
            ...

            case kOSSerializeData:
            ...

            case kOSSerializeBoolean:
            ...

            default:
                break;
        }

[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

上传的附件:
收藏
免费 3
支持
分享
最新回复 (1)
雪    币: 35
活跃值: (5254)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
wsc
2
好东西。
2016-10-18 17:26
0
游客
登录 | 注册 方可回帖
返回
//