← 返回列表

iOS DeviceCheck:苹果设备身份链与黑灰产对抗的攻防博弈

单站 矛和盾的故事 发布 Tue, 13 Jan 2026 19:00:00 +0800 入库 2026-11-18T06:52:26

原创 矛和盾的故事 2026-01-13 19:00 北京

DeviceCheck 的核心目标是在保护用户隐私的前提下,为开发者提供一种持久化的设备标记能力。即使 App 被卸载重装,甚至设备被恢复出厂设置,DeviceCheck 存储的 2-bit 状态依然可以被保留。这使得它成为了对抗“新用户薅羊毛”、“设备封禁”等场景的利器。

设备型号:iphone 14、iOS 版本:16.4.1、越狱方案:Dopamine

工具链:Frida16.1.4、IDA pro 9.2

对于大多数互联网风控攻防业务来说,真正棘手的往往不是单个请求本身,而是背后那一整套“批量造设备、批量刷行为”的自动化体系。正是在这样的背景下,从最初的简单模拟请求,到如今的设备指纹伪造、群控刷量,攻防对抗从未停止。在这一背景下,Apple 推出的 DeviceCheck(以及后续的 App Attest)成为了 iOS 平台上反作弊与反爬虫的重要防线。

DeviceCheck 的核心目标是在保护用户隐私的前提下,为开发者提供一种持久化的设备标记能力。即使 App 被卸载重装,甚至设备被恢复出厂设置(在某些条件下),DeviceCheck 存储的 2-bit 状态依然可以被保留。这使得它成为了对抗“新用户薅羊毛”、“设备封禁”等场景的利器。

然而,对于安全研究人员和黑灰产从业者而言,DeviceCheck 也是一个必须攻克的堡垒。本文将基于逆向工程视角,简单剖析 DeviceCheck 的底层实现,揭示其加密流程,并探讨在越狱环境下进行攻防对抗的可行性。

还是老规矩,先上整体框架图以方便理解整体,激活流程:

这里说的激活,就是由 mobileactivationd + Apple 服务器 参与的那种“和苹果聊一聊,我是谁、能不能用”的流程,而不是普通 App 级别的登录。

小结一句:

只要 Apple 觉得“我有理由重新确认你这台机器的身份/状态”,就会触发 mobileactivationd 跑激活。

从苹果的角度,这一整套“激活”设计,主要是为了解决三大问题:防伪造、防偷盗、统一发证。DeviceCheck / AppAttest 其实都是站在这套基础设施上实现的。

激活是苹果“设备生命周期管理”的关键环节:

激活完成后,mobileactivationd 会产出一套“设备根身份”:

主要通过copyAnswer:方法采集设备唯一性相关信息

UniqueChipID:    "6871544955xxxxxx", 

ChipID:          "33040",

BoardId:         "24",

SecurityDomain:  "1",

SerialNumber:    "F6X439xxxxxx",

BuildVersion:    "20E252",

UniqueDeviceID:  "00008110-303C30C91A0xxxxxx"

// 获取设备信息

void __fastcall create_baa_info_sub_1000EEDCC(__SecKey *a1, id a2, _QWORD *a3)

{

id v4; // x25

id v5; // x20

void *v6; // x21

id v7; // x20

int v8; // w5

int v9; // w6

int v10; // w7

id v11; // x19

NSArray *v12; // x21

void *v13; // x27

NSNumber *v14; // x0

int v15; // w5

int v16; // w6

int v17; // w7

NSNumber *v18; // x24

void *v19; // x22

id v20; // x23

void *v21; // x27

void *v22; // x22

char *v23; // x0

char *v24; // x23

__int64 v25; // x25

char *i; // x28

__SecKey *v27; // x24

int v28; // w5

int v29; // w6

int v30; // w7

const void *v31; // x9

void *v32; // x27

void *v33; // x26

void *v34; // x23

void *v35; // x19

_BOOL4 v36; // w9

__SecKey *v37; // x20

void *v38; // x23

_BOOL4 v39; // w24

_BOOL4 v40; // w19

NSNumber *v41; // x26

id v42; // x22

int v43; // w1

__SecKey *v44; // x21

int v45; // w5

int v46; // w6

int v47; // w7

id v48; // x20

__SecKey *v49; // x0

int v50; // w5

int v51; // w6

int v52; // w7

CFDataRef v53; // x21

int v54; // w5

int v55; // w6

int v56; // w7

__int64 v57; // x0

int v58; // w5

int v59; // w6

int v60; // w7

char v61; // w22

int v62; // w24

int v63; // w5

int v64; // w6

int v65; // w7

__SecKey *v66; // x19

int v67; // w5

int v68; // w6

int v69; // w7

unsigned int v70; // w28

void *v71; // x21

__SecKey *v72; // x22

int v73; // w5

int v74; // w6

int v75; // w7

int v76; // w5

int v77; // w6

int v78; // w7

id v79; // x19

int v80; // w5

int v81; // w6

int v82; // w7

void *v83; // x21

id v84; // x22

NSNumber *v85; // x25

NSNumber *v86; // x19

NSNumber *v87; // x21

unsigned __int8 v88; // w22

int v89; // w5

int v90; // w6

int v91; // w7

NSNumber *v92; // x19

unsigned int v93; // w20

int v94; // w5

int v95; // w6

int v96; // w7

const __CFString *v97; // x4

int v98; // w1

int v99; // w2

id v100; // x20

int v101; // w5

int v102; // w6

int v103; // w7

__SecKey *v104; // x0

int v105; // w5

int v106; // w6

int v107; // w7

NSFileManager *v108; // x20

NSFileManager *v109; // x21

void *v110; // x22

unsigned __int8 v111; // w23

int v112; // w5

int v113; // w6

int v114; // w7

id v115; // x20

id v116; // x20

int v117; // w5

int v118; // w6

int v119; // w7

id v120; // x20

void *v121; // x21

id v122; // x20

int v123; // w5

int v124; // w6

int v125; // w7

id v126; // x20

void *v127; // x21

id v128; // x20

int v129; // w5

int v130; // w6

int v131; // w7

id v132; // x20

__SecKey *v133; // x21

id v134; // x20

int v135; // w5

int v136; // w6

int v137; // w7

id v138; // x20

__SecKey *v139; // x21

id v140; // x20

int v141; // w5

int v142; // w6

int v143; // w7

id v144; // x21

void *v145; // x26

int v146; // w5

int v147; // w6

int v148; // w7

__SecKey *v149; // x0

int v150; // w5

int v151; // w6

int v152; // w7

CFDataRef v153; // x0

int v154; // w5

int v155; // w6

int v156; // w7

CFDataRef v157; // x24

int v158; // w1

id v159; // x26

id v160; // x21

int v161; // w5

int v162; // w6

int v163; // w7

__SecKey *v164; // x19

__CFString **v165; // x8

CFDataRef v166; // x26

CFDataRef v167; // x2

void *v168; // x20

id v169; // x21

void *v170; // x20

void *v171; // x21

void *v172; // x0

void *v173; // x23

int v174; // w5

int v175; // w6

int v176; // w7

void *v177; // x20

int v178; // w5

int v179; // w6

int v180; // w7

void *v181; // x20

void *v182; // x21

void *v183; // x0

void *v184; // x20

int v185; // w5

int v186; // w6

int v187; // w7

void *v188; // x20

int v189; // w5

int v190; // w6

int v191; // w7

void *v192; // x20

void *v193; // x21

void *v194; // x0

void *v195; // x20

int v196; // w5

int v197; // w6

int v198; // w7

int v199; // w5

int v200; // w6

int v201; // w7

int v202; // w5

int v203; // w6

int v204; // w7

__SecKey *v205; // x0

void *v206; // x20

id v207; // x21

void *v208; // x20

void *v209; // x21

id v210; // x22

void *v211; // x21

unsigned int v212; // w19

void *v213; // x22

id v214; // x23

void *v215; // x21

void *v216; // x22

id v217; // x23

void *v218; // x21

void *v219; // x22

id v220; // x23

void *v221; // x21

void *v222; // x22

id v223; // x23

void *v224; // x23

int v225; // w5

int v226; // w6

int v227; // w7

void *v228; // x22

id v229; // x23

__SecKey *v230; // x21

__SecKey *v231; // x24

void *v232; // x28

id v233; // x27

void *v234; // x25

void *v235; // x26

__SecKey *v236; // x23

void *v237; // x22

id v238; // x19

const void *v239; // x20

__SecKey *v240; // x21

__SecKey *v241; // x0

id v242; // x19

NSDictionary *v243; // x22

void *v244; // x24

__CFString **v245; // x8

void *v246; // x0

id v247; // x0

void *v248; // x22

char v249; // w23

id v250; // x19

id v251; // x23

int v252; // w5

int v253; // w6

int v254; // w7

id v255; // x19

id v256; // x24

int v257; // w5

int v258; // w6

int v259; // w7

char is_darwinos; // w0

id v261; // x19

id v262; // x21

int v263; // w5

int v264; // w6

int v265; // w7

id v266; // x24

NSData *v267; // x24

int v268; // w5

int v269; // w6

int v270; // w7

CFDataRef v271; // x2

int v272; // w5

int v273; // w6

int v274; // w7

char v275; // [xsp+0h] [xbp-3B0h]

char v276; // [xsp+0h] [xbp-3B0h]

void *v277; // [xsp+8h] [xbp-3A8h]

__SecKey *v278; // [xsp+18h] [xbp-398h]

__SecKey *v279; // [xsp+20h] [xbp-390h]

void *v280; // [xsp+28h] [xbp-388h]

void *v281; // [xsp+30h] [xbp-380h]

void *v282; // [xsp+38h] [xbp-378h]

__SecKey *v283; // [xsp+40h] [xbp-370h]

__SecKey *v284; // [xsp+48h] [xbp-368h]

__SecKey *cf; // [xsp+50h] [xbp-360h]

id v286; // [xsp+58h] [xbp-358h]

id v287; // [xsp+58h] [xbp-358h]

char v288[8]; // [xsp+60h] [xbp-350h]

__SecKey *v289; // [xsp+68h] [xbp-348h]

__SecKey *v290; // [xsp+70h] [xbp-340h]

const void *v291; // [xsp+78h] [xbp-338h]

id v292; // [xsp+80h] [xbp-330h]

id v293; // [xsp+80h] [xbp-330h]

__SecKey *v294; // [xsp+88h] [xbp-328h]

__SecKey *v295; // [xsp+88h] [xbp-328h]

CFDataRef v296; // [xsp+90h] [xbp-320h]

unsigned int v297; // [xsp+98h] [xbp-318h]

NSData *v298; // [xsp+98h] [xbp-318h]

CFDataRef v299; // [xsp+A0h] [xbp-310h]

id v300; // [xsp+A8h] [xbp-308h]

id v301; // [xsp+B0h] [xbp-300h]

id v302; // [xsp+B8h] [xbp-2F8h]

_BOOL4 v303; // [xsp+C0h] [xbp-2F0h]

_BOOL4 v304; // [xsp+C0h] [xbp-2F0h]

id v305; // [xsp+C0h] [xbp-2F0h]

id v306; // [xsp+C8h] [xbp-2E8h]

id v307; // [xsp+D0h] [xbp-2E0h]

NSNumber *v308; // [xsp+D8h] [xbp-2D8h]

NSNumber *v309; // [xsp+E0h] [xbp-2D0h]

id v310; // [xsp+E8h] [xbp-2C8h]

id v311; // [xsp+F0h] [xbp-2C0h]

id v312; // [xsp+F8h] [xbp-2B8h]

NSNumber *v313; // [xsp+100h] [xbp-2B0h]

id v314; // [xsp+108h] [xbp-2A8h]

id v315; // [xsp+110h] [xbp-2A0h]

__SecKey *v316; // [xsp+118h] [xbp-298h]

unsigned int v317; // [xsp+118h] [xbp-298h]

id v318; // [xsp+120h] [xbp-290h]

id v319; // [xsp+128h] [xbp-288h]

CFDataRef v320; // [xsp+130h] [xbp-280h]

id v321; // [xsp+138h] [xbp-278h]

NSNumber *v322; // [xsp+140h] [xbp-270h]

__SecKey *v323; // [xsp+148h] [xbp-268h]

id v324; // [xsp+148h] [xbp-268h]

id v325; // [xsp+148h] [xbp-268h]

id v327; // [xsp+158h] [xbp-258h] BYREF

id v328; // [xsp+160h] [xbp-250h] BYREF

id v329; // [xsp+168h] [xbp-248h] BYREF

id v330[2]; // [xsp+170h] [xbp-240h] BYREF

id v331; // [xsp+180h] [xbp-230h] BYREF

id v332; // [xsp+188h] [xbp-228h] BYREF

id v333; // [xsp+190h] [xbp-220h] BYREF

id v334[3]; // [xsp+198h] [xbp-218h] BYREF

id v335[2]; // [xsp+1B0h] [xbp-200h] BYREF

id v336[2]; // [xsp+1C0h] [xbp-1F0h]

id v337[2]; // [xsp+1D0h] [xbp-1E0h]

id v338[2]; // [xsp+1E0h] [xbp-1D0h]

CFErrorRef error; // [xsp+1F0h] [xbp-1C0h] BYREF

id v340[12]; // [xsp+1F8h] [xbp-1B8h] BYREF

_QWORD v341[12]; // [xsp+258h] [xbp-158h] BYREF

char v342[8]; // [xsp+2B8h] [xbp-F8h] BYREF

_QWORD v343[3]; // [xsp+338h] [xbp-78h] BYREF

__int64 vars8; // [xsp+3B8h] [xbp+8h]

v4 = objc_retain(a2);

error = 0;

v5 = objc_retainAutoreleasedReturnValue(+[GestaltHlpr getSharedInstance](&OBJC_CLASS___GestaltHlpr, "getSharedInstance"));

v6 = objc_msgSend(v5, "copyAnswer:", CFSTR("s7nuHoZIYNoOHCqT9iyZkQ"));

objc_release(v5);

v319 = v6;

v7 = objc_retainAutoreleasedReturnValue((id)isKindOfClass_0(v6));

objc_release(v7);

if ( !v7 )

{

v322 = 0;

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

244,

-1,

0,

(int)CFSTR("Failed to retrieve %@."),

v8,

v9,

v10,

(char)CFSTR("s7nuHoZIYNoOHCqT9iyZkQ")));

v302 = 0;

v31 = 0;

v306 = 0;

v307 = 0;

v315 = 0;

v299 = 0;

v300 = 0;

v310 = 0;

v311 = 0;

v313 = 0;

v308 = 0;

v309 = 0;

v318 = 0;

v321 = 0;

v27 = 0;

a1 = 0;

v32 = 0;

v33 = 0;

v34 = 0;

v35 = 0;

LABEL_18:

v320 = 0;

v316 = 0;

LABEL_46:

v296 = 0;

v298 = 0;

v312 = 0;

v314 = 0;

v44 = 0;

LABEL_47:

v72 = 0;

v301 = 0;

v305 = 0;

goto LABEL_180;

}

v11 = objc_alloc((Class)&OBJC_CLASS___NSMutableArray);

v343[0] = CFSTR("1.2.840.113635.100.8.4");

v343[1] = CFSTR("1.2.840.113635.100.8.5");

v343[2] = CFSTR("1.2.840.113635.100.8.7");

v12 = objc_retainAutoreleasedReturnValue(+[NSArray arrayWithObjects:count:](&OBJC_CLASS___NSArray, "arrayWithObjects:count:", v343, 3));

v13 = objc_msgSend(v11, "initWithArray:", v12);

objc_release(v12);

v14 = objc_retainAutoreleasedReturnValue(+[NSNumber numberWithUnsignedInt:](&OBJC_CLASS___NSNumber, "numberWithUnsignedInt:", 0));

v322 = v14;

if ( !v4 )

{

v36 = 0;

v297 = 0;

v37 = 0;

v320 = 0;

v38 = 0;

v310 = 0;

v311 = 0;

v300 = 0;

v315 = 0;

v306 = 0;

v39 = 0;

v40 = 1;

v41 = (NSNumber *)&off_100E66CB8;

v308 = (NSNumber *)&off_100E66CB8;

v309 = (NSNumber *)&off_100E66CA0;

goto LABEL_20;

}

v18 = v14;

v323 = a1;

v19 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("OIDSToInclude")));

v20 = objc_retainAutoreleasedReturnValue((id)isKindOfClass());

objc_release(v20);

objc_release(v19);

if ( v20 )

{

v321 = v13;

*(_OWORD *)v337 = 0u;

*(_OWORD *)v338 = 0u;

*(_OWORD *)v335 = 0u;

*(_OWORD *)v336 = 0u;

v21 = v4;

v22 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("OIDSToInclude")));

v23 = (char *)objc_msgSend(v22, "countByEnumeratingWithState:objects:count:", v335, v342, 16);

if ( v23 )

{

v24 = v23;

v25 = *(_QWORD *)v336[0];

while ( 2 )

{

for ( i = 0; i != v24; ++i )

{

if ( *(_QWORD *)v336[0] != v25 )

objc_enumerationMutation(v22);

v27 = (__SecKey *)objc_retainAutoreleasedReturnValue((id)isKindOfClass_1(*((_QWORD *)v335[1] + (_QWORD)i)));

objc_release(v27);

if ( !v27 )

{

v4 = v21;

v277 = objc_retainAutoreleasedReturnValue(objc_msgSend(v21, "objectForKeyedSubscript:", CFSTR("OIDSToInclude")));

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

263,

-2,

0,

(int)CFSTR("Invalid options (%@): %@"),

v76,

v77,

v78,

(char)CFSTR("OIDSToInclude")));

objc_release(v277);

objc_release(v22);

v302 = 0;

v31 = 0;

v306 = 0;

v307 = 0;

v315 = 0;

v300 = 0;

v310 = 0;

v311 = 0;

v318 = 0;

goto LABEL_93;

}

}

v24 = (char *)objc_msgSend(v22, "countByEnumeratingWithState:objects:count:", v335, v342, 16);

if ( v24 )

continue;

break;

}

}

objc_release(v22);

v4 = v21;

v13 = objc_retainAutoreleasedReturnValue(objc_msgSend(v21, "objectForKeyedSubscript:", CFSTR("OIDSToInclude")));

objc_release(v321);

v18 = v322;

}

v321 = v13;

if ( (unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.8.1"))

&& ((sub_100C87320() & 1) != 0 || (unsigned int)sub_100C87330()) )

{

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

276,

-2,

0,

(int)CFSTR("Boot manifest not available in rOS or diagnosticsOS."),

v28,

v29,

v30,

v275));

v302 = 0;

v31 = 0;

v306 = 0;

v315 = 0;

v300 = 0;

v310 = 0;

v311 = 0;

v318 = 0;

goto LABEL_92;

}

v304 = ((unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.8.1")) & 1) != 0

|| ((unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.8.7")) & 1) != 0

|| ((unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.8.10.1")) & 1) != 0

|| ((unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.8.10.2")) & 1) != 0

|| (unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.8.10.3"));

v70 = (unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.8.7"));

if ( ((unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.8.2")) & 1) != 0

|| (unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.8.11.1")) )

{

v71 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("nonce")));

v72 = (__SecKey *)objc_retainAutoreleasedReturnValue((id)isKindOfClass_2());

objc_release(v72);

objc_release(v71);

if ( !v72 )

{

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

295,

-2,

0,

(int)CFSTR("Missing required option: %@"),

v73,

v74,

v75,

(char)CFSTR("nonce")));

v302 = 0;

v31 = 0;

v306 = 0;

v307 = 0;

v315 = 0;

v316 = 0;

v299 = 0;

v300 = 0;

v310 = 0;

v311 = 0;

v318 = 0;

v27 = 0;

a1 = 0;

v32 = 0;

v33 = 0;

v34 = 0;

v35 = 0;

v7 = 0;

v320 = 0;

v296 = 0;

v298 = 0;

v312 = 0;

v314 = 0;

v44 = 0;

LABEL_96:

v301 = 0;

v305 = 0;

v313 = (NSNumber *)&off_100E66CB8;

v308 = (NSNumber *)&off_100E66CB8;

v309 = (NSNumber *)&off_100E66CA0;

goto LABEL_180;

}

v318 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("nonce")));

}

else

{

v318 = 0;

}

v83 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("CertType")));

v84 = objc_retainAutoreleasedReturnValue((id)isKindOfClass_0(v83));

objc_release(v84);

objc_release(v83);

v293 = v4;

if ( v84 )

{

v85 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("CertType")));

objc_release(v18);

v86 = objc_retainAutoreleasedReturnValue(+[NSNumber numberWithUnsignedInt:](&OBJC_CLASS___NSNumber, "numberWithUnsignedInt:", 0));

if ( -[NSNumber isEqualToNumber:](v85, "isEqualToNumber:", v86) )

{

objc_release(v86);

v18 = v85;

}

else

{

v87 = objc_retainAutoreleasedReturnValue(+[NSNumber numberWithUnsignedInt:](&OBJC_CLASS___NSNumber, "numberWithUnsignedInt:", 1));

v88 = -[NSNumber isEqualToNumber:](v85, "isEqualToNumber:", v87);

objc_release(v87);

objc_release(v86);

v18 = v85;

if ( (v88 & 1) == 0 )

{

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

306,

-2,

0,

(int)CFSTR("Invalid value for option (%@): %@"),

v89,

v90,

v91,

(char)CFSTR("CertType")));

v302 = 0;

v31 = 0;

v306 = 0;

v307 = 0;

v315 = 0;

v316 = 0;

v299 = 0;

v300 = 0;

v310 = 0;

v311 = 0;

v27 = 0;

a1 = 0;

v32 = 0;

v33 = 0;

v34 = 0;

v35 = 0;

v7 = 0;

v320 = 0;

v296 = 0;

v298 = 0;

v314 = 0;

v44 = 0;

v72 = 0;

v301 = 0;

v305 = 0;

v322 = v85;

v312 = 0;

v313 = (NSNumber *)&off_100E66CB8;

v308 = (NSNumber *)&off_100E66CB8;

v309 = (NSNumber *)&off_100E66CA0;

v4 = v293;

goto LABEL_180;

}

}

}

v92 = objc_retainAutoreleasedReturnValue(+[NSNumber numberWithUnsignedInt:](&OBJC_CLASS___NSNumber, "numberWithUnsignedInt:", 1));

v93 = -[NSNumber isEqualToNumber:](v18, "isEqualToNumber:", v92);

objc_release(v92);

v322 = v18;

if ( v93 )

{

v4 = v293;

if ( ((unsigned int)objc_msgSend(v319, "boolValue") & 1) == 0 )

{

v97 = CFSTR("Certificate type not supported on this platform: %@");

v276 = (char)v18;

v98 = 313;

v99 = -3;

goto LABEL_89;

}

if ( ((unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.6.71.1")) & 1) == 0 )

{

v97 = CFSTR("Missing required OID for certificate type (%@): %@");

v276 = (char)v18;

v98 = 318;

LABEL_66:

v99 = -2;

LABEL_89:

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

v98,

v99,

0,

(int)v97,

v94,

v95,

v96,

v276));

LABEL_90:

v302 = 0;

v31 = 0;

v306 = 0;

v315 = 0;

v300 = 0;

v311 = 0;

LABEL_91:

v310 = 0;

LABEL_92:

v307 = 0;

v27 = 0;

LABEL_93:

a1 = 0;

v32 = 0;

v33 = 0;

v34 = 0;

v299 = 0;

v35 = 0;

goto LABEL_94;

}

}

else

{

v4 = v293;

if ( ((unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.6.71.1")) & 1) != 0

|| ((unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.6.71.2")) & 1) != 0

|| (unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.6.71.3")) )

{

v97 = CFSTR("Invalid OID(s) for requested certificate type: %@");

v276 = (char)v18;

v98 = 325;

goto LABEL_66;

}

}

if ( (unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.6.71.1"))

&& (v168 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("MFiProperties"))),

v169 = objc_retainAutoreleasedReturnValue((id)isKindOfClass_2()),

objc_release(v169),

objc_release(v168),

v169) )

{

v170 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("MFiProperties")));

v171 = objc_msgSend(v170, "length");

objc_release(v170);

v172 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("MFiProperties")));

v173 = v172;

if ( v171 != (void *)32 )

{

objc_msgSend(v172, "length");

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

333,

-2,

0,

(int)CFSTR("Invalid value for option (%@): unexpected size (%lu)"),

v174,

v175,

v176,

(char)CFSTR("MFiProperties")));

objc_release(v173);

goto LABEL_90;

}

}

else

{

v173 = 0;

}

v311 = v173;

if ( (unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.6.71.2")) )

{

v177 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("MFiPPUID")));

v44 = (__SecKey *)objc_retainAutoreleasedReturnValue((id)isKindOfClass_1(v177));

objc_release(v44);

objc_release(v177);

if ( !v44 )

{

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

343,

-2,

0,

(int)CFSTR("Missing required option: %@"),

v178,

v179,

v180,

(char)CFSTR("MFiPPUID")));

v302 = 0;

v31 = 0;

v306 = 0;

v315 = 0;

v300 = 0;

LABEL_135:

v310 = 0;

v307 = 0;

v27 = 0;

a1 = 0;

v32 = 0;

v33 = 0;

v34 = 0;

v298 = 0;

v299 = 0;

v35 = 0;

v7 = 0;

v320 = 0;

v316 = 0;

v296 = 0;

v312 = 0;

v314 = 0;

goto LABEL_95;

}

v181 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("MFiPPUID")));

v182 = objc_msgSend(v181, "length");

objc_release(v181);

v183 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("MFiPPUID")));

v184 = v183;

if ( (unsigned __int64)v182 >= 0x25 )

{

objc_msgSend(v183, "length");

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

348,

-2,

0,

(int)CFSTR("Invalid value for option (%@): unexpected size (%lu)"),

v185,

v186,

v187,

(char)CFSTR("MFiPPUID")));

objc_release(v184);

v302 = 0;

v31 = 0;

v306 = 0;

v315 = 0;

v300 = 0;

goto LABEL_91;

}

v35 = objc_retainAutoreleasedReturnValue(objc_msgSend(v183, "stringByPaddingToLength:withString:startingAtIndex:", 36, &stru_100E61E50, 0));

objc_release(v184);

if ( !v35 )

{

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

357,

-2,

0,

(int)CFSTR("Failed to pad string."),

v199,

v200,

v201,

v275));

v302 = 0;

v31 = 0;

v306 = 0;

v307 = 0;

v315 = 0;

v299 = 0;

v300 = 0;

v310 = 0;

v27 = 0;

a1 = 0;

v32 = 0;

v33 = 0;

v34 = 0;

LABEL_94:

v7 = 0;

v320 = 0;

v316 = 0;

v296 = 0;

v298 = 0;

v312 = 0;

v314 = 0;

v44 = 0;

LABEL_95:

v72 = 0;

goto LABEL_96;

}

v315 = objc_retainAutoreleasedReturnValue(objc_msgSend(v35, "dataUsingEncoding:", 4));

if ( !v315 )

{

v300 = v35;

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

363,

-2,

0,

(int)CFSTR("Failed to convert string to data."),

v202,

v203,

v204,

v275));

v302 = 0;

v31 = 0;

v306 = 0;

v315 = 0;

goto LABEL_91;

}

}

else

{

v35 = 0;

v315 = 0;

}

v300 = v35;

if ( !(unsigned int)objc_msgSend(v13, "containsObject:", CFSTR("1.2.840.113635.100.6.71.3")) )

{

v306 = 0;

goto LABEL_137;

}

v188 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("MFiData")));

v44 = (__SecKey *)objc_retainAutoreleasedReturnValue((id)isKindOfClass_2());

objc_release(v44);

objc_release(v188);

if ( !v44 )

{

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

370,

-2,

0,

(int)CFSTR("Missing required option: %@"),

v189,

v190,

v191,

(char)CFSTR("MFiData")));

v302 = 0;

v31 = 0;

v306 = 0;

goto LABEL_135;

}

v192 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("MFiData")));

v193 = objc_msgSend(v192, "length");

objc_release(v192);

v194 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("MFiData")));

v195 = v194;

if ( (unsigned __int64)v193 >= 0x4B0 )

{

objc_msgSend(v194, "length");

v324 = objc_retainAutoreleasedReturnValue((id)com_apple_MobileActivation_ErrorDomain(

(int)"create_baa_info",

375,

-2,

0,

(int)CFSTR("Invalid value for option (%@): unexpected size (%lu)"),

v196,

v197,

v198,

(char)CFSTR("MFiData")));

objc_release(v195);

v302 = 0;

v31 = 0;

v306 = 0;

goto LABEL_91;

}

v306 = v194;

LABEL_137:

v206 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("UseRKSigningInterface")));

v207 = objc_retainAutoreleasedReturnValue((id)isKindOfClass_0(v206));

objc_release(v207);

objc_release(v206);

if ( v207 )

{

v208 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("UseRKSigningInterface")));

v317 = (unsigned int)objc_msgSend(v208, "boolValue");

objc_release(v208);

}

else

{

v317 = 0;

}

v209 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("UseSoftwareGeneratedKey")));

v210 = objc_retainAutoreleasedReturnValue((id)isKindOfClass_0(v209));

objc_release(v210);

objc_release(v209);

if ( v210 )

{

v211 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("UseSoftwareGeneratedKey")));

v212 = (unsigned int)objc_msgSend(v211, "boolValue");

objc_release(v211);

}

else

{

v212 = 1;

}

v213 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("Validity")));

v214 = objc_retainAutoreleasedReturnValue((id)isKindOfClass_0(v213));

objc_release(v214);

objc_release(v213);

if ( v214 )

{

v215 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("Validity")));

v309 = objc_retainAutoreleasedReturnValue(

+[NSNumber numberWithUnsignedInteger:](

&OBJC_CLASS___NSNumber,

"numberWithUnsignedInteger:",

objc_msgSend(v215, "unsignedIntegerValue")));

objc_release(v215);

}

else

{

v309 = (NSNumber *)&off_100E66CA0;

}

v216 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("CACert")));

v217 = objc_retainAutoreleasedReturnValue((id)isKindOfClass_0(v216));

objc_release(v217);

objc_release(v216);

if ( v217 )

{

v218 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("CACert")));

v308 = objc_retainAutoreleasedReturnValue(

+[NSNumber numberWithUnsignedInteger:](

&OBJC_CLASS___NSNumber,

"numberWithUnsignedInteger:",

objc_msgSend(v218, "unsignedIntegerValue")));

objc_release(v218);

}

else

{

v308 = (NSNumber *)&off_100E66CB8;

}

v219 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("scrtAttestation")));

v220 = objc_retainAutoreleasedReturnValue((id)isKindOfClass_0(v219));

objc_release(v220);

objc_release(v219);

if ( v220 )

{

v221 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("scrtAttestation")));

v41 = objc_retainAutoreleasedReturnValue(

+[NSNumber numberWithUnsignedInteger:](

&OBJC_CLASS___NSNumber,

"numberWithUnsignedInteger:",

objc_msgSend(v221, "unsignedIntegerValue")));

objc_release(v221);

}

else

{

v41 = (NSNumber *)&off_100E66CB8;

}

v222 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("ClientAttestationData")));

v223 = objc_retainAutoreleasedReturnValue((id)isKindOfClass_2());

objc_release(v223);

objc_release(v222);

if ( !v223 )

{

v37 = 0;

v320 = 0;

goto LABEL_156;

}

v224 = objc_retainAutoreleasedReturnValue(objc_msgSend(v4, "objectForKeyedSubscript:", CFSTR("ClientAttestationPublicKey")));

v27 = (__SecKey *)objc_retainAutoreleasedReturnValue((id)isKindOfClass_2());

objc_release(v27);

objc_release(v224);

if ( !v27 )

{

v313 = v41;

`v324 = objc_r

原文链接:https://mp.weixin.qq.com/s?__biz=MzU3MDc0MTY1MA==&mid=2247484121&idx=1&sn=7edc9a634643c1387094163d87aace78