ChakraÒýÇæÖÐJIT±àÒëÓÅ»¯Àú³ÌÖеÄÊý×éÀàÐÍ»ìÏýÎó²îÆÊÎö
Ðû²¼Ê±¼ä 2018-12-18ChakraÊÇÒ»¸öÓÉ΢ÈíΪMicrosoft Edgeä¯ÀÀÆ÷¿ª·¢µÄJavaScriptÒýÇæ¡£ËüÔÚÒ»¸ö×ÔÁ¦µÄCPU½¹µãÉϼ´Ê±±àÒë¾ç±¾£¬Óëä¯ÀÀÆ÷²¢ÐС£±¾ÎÄÖ÷Òª¶ÔChakraÒýÇæÖÐJIT±àÒëÓÅ»¯Àú³ÌÖеÄÊý×éÀàÐÍ»ìÏýÎó²î¾ÙÐÐÆÊÎö¡£
JavaScriptÒýÇæµÄÐÔÄܶÔÕû¸öä¯ÀÀÆ÷µÄÓ°ÏìÖÁ¹ØÖ÷Òª£¬ JIT±àÒëÓÅ»¯ÊÇΪÁËÌá¸ßChakraÒýÇæÐÔÄÜ¡£µ±ÔÚÑ»·Óï¾äÖÐÖظ´Ö´ÐÐͳһ¶Î¾ç±¾´úÂëʱ£¬ÈôÊÇÚ¹ÊÍÖØÊÓ¸´Ö´ÐÐÏà¹ØµÄ×Ö½ÚÂ룬ЧÂÊ»áºÜµÍ¡£JIT¿ÉÒÔ½«Ô´´úÂëÖ±½ÓÌìÉúÆøеָÁÔÚÏÂÒ»´ÎÖ´ÐÐʱֱ½ÓÖ´ÐлúеָÁî¡£ÔÚChakraÖÐÖ»Óе±Ä¿µÄº¯Êý»òÕßÑ»·Óï¾ä±»ÆµÈÔŲÓÃʱ²Å»áÆôÓÃJIT±àÒ룬JIT±àÒëºóÌìÉúÁËÏìÓ¦µÄ»úеָÁÏÂÒ»´ÎŲÓõ½Õâ¸öÓï¾ä»òÊǺ¯Êýʱ¾Í»áÖ±½ÓÖ´ÐлúеָÁî¡£
Ò»µ©JITÌìÉúÍê³É£¬³ÌÐò¾Í¿ÉÒÔÖ±½ÓŲÓÃJITÌìÉúµÄ»úеָÁî¡£ÓÉÓÚJITÊÇÖ±½Ó±àÒëΪ»úеָÁîµÄ£¬ÒÔÊÇÐèÒªÔ¤Ïȼٶ¨²Ù×÷Ä¿µÄµÄÀàÐÍ¡£ÈôÊDz»Öª×ãJITµÄ¼ÙÉèµÄ»°£¬´ËJIT´úÂë¾Í²»¿ÉÖ´ÐУ¬²»È»¾Í»á±¬·¢ÀàÐÍ»ìÏýµÄ¹ýʧ¡£Òò´ËJIT´úÂëÖÐÉè¼ÆÁËbailout¹¦Ð§£¬Ò»µ©·¢Ã÷²»Öª×ã¼ÙÉè¾Í¾ÙÐÐbailout£¬bailout»á·ÅÆúÖ´ÐÐJIT´úÂëת»ØʹÓÃÚ¹ÊÍÆ÷¼ÌÐøÖ´ÐÐ×Ö½ÚÂë¡£

2¡¢Êý×éÀàÐÍ»ìÏý˼Ð÷
ChakraÊý×é¿ÉÒÔ·ÖΪÈýÀ࣬»®·ÖÊÇNativeIntArray¡¢NativeFloatArrayºÍVarArray¡£NativeIntArrayºÍNativeFloatArrayÊý×éת»¯³ÉVarArrayÊý×éÀú³ÌÖлὫÊý×éÖеÄÔÊý¾Ýͨ¹ýÒì»ò0xfffc000000000000ת»¯ÎªVarArrayÖеÄÊý¾Ý¡£Ò²¾ÍÊÇ˵VarArray»áͨ¹ýÊý×éÖÐÔªËصĸßλÀ´ÅжÏÊý×éÖеÄÔªËØÊÇÊý¾ÝÕվɹ¤¾ß¡£
NativeIntArrayºÍNativeFloatArrayÖ®¼ä»ìÏýÒ»Ñùƽ³£²»¿É´øÀ´Çå¾²ÎÊÌ⣬¿ÉÊǵ±Õâ¶þÕߺÍVarArray»ìÏýÖ®ºó¾Í»á·ºÆðÊý¾ÝºÍ¹¤¾ßÎÞ·¨Çø·ÖµÄÎÊÌâ¡£
ÏÈ¿´Ò»¶Î¼òÆÓ´úÂë¡£

Õâ¶Î´úÂëÔÚJITÓÅ»¯ºóµÄÌåÏÖÐÎʽÊÇÕâÑùµÄ¡£

ÈôÊÇÔÚxxx²Ù×÷Àú³ÌÖн«NativeArrayµÄÀàÐ͸ÄÄð³ÉÁËVarArray£¬²¢ÇÒJITµÄÓÅ»¯Àú³Ì²¢Ã»Óмì²âµ½ÕâÖÖת±äµÄ»°£¬2.3023e-320¾Í»á±»¿´³ÉfloatÊý¾Ý´æ·Å½øÈëVarArrayµÄÔªËØÖУ¬ÓÉÓÚÕâ¸öÀú³ÌÖÐÊý×éµÄת±äÊÇʼÁÏδ¼°µÄ£¬ÒÔÊÇ2.3023e-320²¢Ã»ÓÐͨ¹ýÓë0xfffc000000000000Òì»ò¶øÄð³ÉÒ»¸ö¿ÉÒÔ±»VarArrayʶ±ðµÄfloat£¬ÒÔÊÇVarArray¹¤¾ßÔÚ¶ÁÈ¡¸ÃÔªËØʱ»á½«Æäµ±³ÉÒ»¸ö¹¤¾ßÀ´´¦Öóͷ£¡£
ΪÁËʵÏÖÊý×éµÄÀàÐÍ»ìÏý£¬xxx²Ù×÷Ö÷Á÷µÄ˼Ð÷ÓÐÁ½ÖÖ£¬Ò»ÖÖÊÇͨ¹ýûÓмì²âµÄ»Øµ÷À´ÐÞ¸ÄÊý×éµÄÀàÐÍ£¬µÚ¶þÖÖÊÇͨ¹ýºÏÀíµÄº¯ÊýÀ´ÐÞ¸ÄÊý×éµÄÀàÐÍ¡£ÏÂÃæͨ¹ýһЩʵÀý¾ÙÐмòÒªÆÊÎö¡£
2.1 ˼Ð÷Ò»£ºÍ¨¹ý»Øµ÷ÐÞ¸ÄÊý×éÀàÐÍ
ÏÈÀ´¿´Ò»¸ö¼òÆÓµÄÀý×Ó£¬Í¨¹ý»Øµ÷ÐÞ¸ÄÊý×éÀàÐÍ¡£

funcµÄJITÖ÷ҪƬ¶ÏÈçÏ£º

ƾ֤ÉÏÊö´úÂ룬¿ÉÒÔ¿´µ½call raxÖ®ºó²¢Ã»ÓÐÑéÖ¤Êý×éaÊÇ·ñÕýµ±¾ÍÖ±½Ó¾ÙÐÐÁ˸³Öµ¡£ÄÇôÔõÑù¸Ä±äÊý×éaµÄÀàÐÍÄØ£¿ÎÒÃÇÀ´¿´×îºóÒ»´Î¶ÔfuncµÄŲÓá£

Îó²î¾ç±¾½«Ò»¸ö¹¤¾ßÖ±½Ó¸³Öµ¸øÁ˲ÎÊýc£¬²¢ÇÒÔÚÕâ¸ö¹¤¾ßÉϹÒÁËÒ»¸övalueOf»Øµ÷£¬cÒª¸³Öµ¸øtypedÊý×éb£¬¶øbÖеÄÔªËØÖ»ÄÜÊÇUint32ÀàÐÍ£¬ÒÔÊÇJIT»á¶Ô²ÎÊýc¾ÙÐÐÒ»¸öת»»£¨Óõ½ToInt32£©£¬Õâ»á´¥·¢cµÄvalueOf»Øµ÷£¬Ôڻص÷º¯ÊýÖÐͨ¹ýa[0]={}¸øÊý×éa¸³Öµ£¬Õâ»á½«aÓÉNativeFloatArrayÄð³ÉVarArray£¬´ËºóÐø´úÂëÓÉÓÚûÓмì²éaÊý×é¸Ä±äÒÔÊǼÌÐø½«Æä¿´³ÉNativeFloatArray¸³ÖµÔì³ÉÁËÀàÐÍ»ìÏý¡£
²¹¶¡×ÓÅ®ÂëÈçÏ¡£

Ò»Ñùƽ³£À´Ëµ£¬ChakraÒýÇæÔÚ¶ÔJITÖеĻص÷¾ÙÐÐÓÅ»¯Ê±»á˼Á¿Ò»¸ö½Ð×öImplicitCallFlagsµÄ±ê¼Çλ£¬Í¨¹ýÕâ¸ö±ê¼Ç룬¾Í¿ÉÒÔ¼ì²âÓû§º¯ÊýÊÇ·ñ¿ÉÄܱ»Å²Óã¬ÈôÊÇÊǵĻ°¾Í»áÆô¶¯bailout»ò¾ÙÐÐÏà¹Ø¼ì²â¡£¿ÉÊÇÕâÖÖ»úÖƱ£´æһЩÎÊÌ⣬ºÃ±ÈImplicitCallFlags±ê¼Çλ¾¿¾¹ÔÚʲôλÖûᱻÖÃ룬ËüÊÇ·ñÄܱ£»¤ËùÓб£´æ»Øµ÷º¯ÊýµÄλÖã¿
Ò»¸öµä·¶µÄÀý×Ó£ºCVE-2017-11802

Õâ¸öÎó²î½ÏÁ¿¼òÆÓ£¬±£´æÓÚRegexHelper::StringReplaceº¯ÊýÖУ¬regexpµÄreplaceÒªÁ죬¿ÉÒÔ½ç˵һ¸ö»Øµ÷º¯Êý£¬¿ÉÊÇÔÚ×ÅʵÏÖÖв¢Ã»ÓжԻص÷º¯Êý¾ÙÐб£»¤£¬Ò²¾ÍÊÇ˵¿ÉÒÔÖ±½ÓÔÚregexpµÄreplaceÒªÁìÖÐÐÞ¸ÄÊý×éÀàÐͶø²»±»JIT¼ì²âµ½¡£

¸ÃÎó²îµÄ²¹¶¡Ò²½ÏÁ¿¼òÆÓ£¬Í¨¹ý¶ÔÁ½´¦Å²Óûص÷µÄλÖÃÌí¼ÓExecuteImplicitCallÑéÖ¤£¬¾Í¿ÉÒÔÐÞ²¹¸ÃÎó²î¡£Õâ¸ö²¹¶¡Í¬Ê±ÐÞ²¹ÁËÒ»´¦Î»ÓÚJavascriptArray::ArraySpeciesCreateÖеÄÓÉÓÚ½¨Éèй¤¾ß¶øµ¼ÖµĻص÷¡£

ÕâÖÖ»úÖÆÔÚʵÏÖºÍÓÅ»¯Àú³ÌÖÐÓÐûÓÐ覴ÃÄØ£¿ÏÂÃæÀ´¿´ÁíÒ»¸öÀý×ÓCVE-2018-0840¡£

ÕâÊÇÒ»¸öÖ±½Ó¶ÔExecuteImplicitCallº¯Êý¾ÙÐжԿ¹µÄÎó²î£¬ÆäÎÊÌâ×Ô¼ºÔÚÓÚExecuteImplicitCallº¯ÊýµÄʵÏÖ£¬Æä´úÂëƬ¶ÏÈçÏ¡£

º¯ÊýÊ×ÏÈ»áÖ´ÐÐimplicitCallÈ»ºó²Å»á¸üÐÂImplicitCallFlags£¬´¿´â´Óº¯Êý×Ô¼ºÀ´Ë¼Á¿ËƺõûʲôÎÊÌ⣬¿ÉÊÇÕâÄÚÀïºöÂÔÁËÒ»¸ö¿ÉÄܾÍÊǻص÷ÔÚÖ´ÐÐÀú³ÌÖÐÈôÊÇ·ºÆðÁËÒ»¸öÒì³£¸ÃÔõô´¦Öóͷ££¬POCÖеÄtypeofʵÏÖλÓÚJavascriptOperators::TypeofElemº¯ÊýÖУ¬ºÍÎó²îÓйصĴúÂëÈçÏ¡£

»Øµ÷»áͨ¹ýExecuteImplicitCallº¯Êý¾ÙÐÐŲÓ㬿ÉÊǻص÷º¯Êý»á´¥·¢Ò»¸öÒì³££¬¸ÃÒì³£»á±»TypeofElem²¶»ñ£¬Ò²¾ÍÊÇ˵ExecuteImplicitCallº¯ÊýÖиüÐÂImplicitCallFlagsµÄ²Ù×÷±»Ìø¹ýÁË£¬ÓÉÓÚ±ê¼ÇλûÓб»¸üУ¬ÒÔÊÇÓÅ»¯Àú³ÌÖеÄÏìÓ¦ÅÅ´í»úÖÆÒ²¾ÍûÓб»ÌìÉú£¬×îÖÕµ¼ÖÂÁËÎó²îµÄ±¬·¢¡£
ÁíÍâÒ»¸öÎÊÌâÊÇCVE-2018-8556£¬Í¨¹ý²¹¶¡ÐÅÏ¢¿ÉÒÔÖªµÀÎó²î±£´æÓÚGlobOptBailOut.cppµÄMayNeedBailOnImplicitCallº¯ÊýÖУ¬´ÓÃû×Ö¿ÉÒÔÍƲ⣬Õâ¸öº¯ÊýÖ÷ÒªÈÏÕæÅжÏJITÓÅ»¯Àú³ÌÖÐÊÇ·ñ¶ÔImplicitCallÌìÉúbailout´úÂë¡£

Ôڸú¯Êý¶Ô¹¤¾ßµÄlengthÊôÐÔ¾ÙÐлñÈ¡µÄ²Ù×÷ÖУ¬ÅжϷµ»ØÖµµÄÂß¼·ºÆðÁËÎÊÌâ¡£

´ÓÂß¼ÉÏ¿´£¬stringºÍÖª×ãIsAnyArray²¢ÇÒ²»¼´ÊÇObjectWithArrayµÄ¹¤¾ß¶¼ÊÇ¿ÉÒÔͨ¹ýÑéÖ¤µÄ£¬Ò²¾ÍÊÇ˵typedarrayÒ²ÊÇÖª×ãÌõ¼þµÄ¡£


ÈôÊÇÒª¸ø¹¤¾ß»ñÈ¡lengthµÄ²Ù×÷¼Ó»Øµ÷»òÕß¹ýÂ˲Ù×÷£¬¹¤¾ßµÄlengthÊôÐÔµÄconfigurableÌØÕ÷±ØÐèΪtrue£¬stringºÍarrayµÄlength¶¼ÇкÏÕâ¸ö¼Ù¶¨£¬¿ÉÊÇtypedarrayÈ´ÊǸöÆÆÀý£¬ÒÔÊÇ¿ÉÒÔͨ¹ý¸øtypedarrayµÄlengthÊôÐԼӻص÷µÄ²Ù×÷£¬È¥Ö´ÐÐÓû§½ç˵µÄ´úÂëÀ´´¥·¢ÀàÐÍ»ìÏýÎó²î¡£
2.2 ˼Ð÷¶þ£ºÍ¨¹ýºÏÀíµÄº¯ÊýŲÓÃÐÞ¸ÄÊý×éÀàÐÍ
½ÓÏÂÀ´¿´µÚ¶þÖÖ˼Ð÷£¬Í¨¹ýºÏÀíº¯ÊýŲÓÃÀ´´¥·¢Êý×éÀàÐ͸ı䡣ÔÚһЩº¯Êý´¦Öóͷ£ÖУ¬ÓÉÓÚ¹¦Ð§Ôµ¹ÊÔÓÉ»áŲÓÃToVarArrayº¯Êý¶ÔÊý×éÀàÐ;ÙÐиı䡣
ÏÂÃæ¾ÙÀý˵Ã÷¡£

optº¯ÊýµÄJITÓÅ»¯´úÂëÈçÏ£º

¿ÉÒÔ¿´µ½£¬ÔÚcall raxÖ®ºó²¢Ã»ÓоÙÐÐÊý×éÀàÐ͵ļì²â¾ÍÖ±½Ó¸³ÖµÁË£¬ÄÇôÕâ¸öcallÖо¿¾¹±¬·¢ÁËʲôÄØ£¿Õâ¸öcallŲÓÃÁËJavascriptOperators::OP_InitProtoº¯ÊýÀ´³õʼ»¯proto£¬ÔÚ×îºóÒ»´ÎoptŲÓÃʱ£¬½«array¿´³Éproto¸øÁËÊôÐÔÁ´£¬ÔÚ¶ÔÊôÐÔÁ´¸³ÖµÊ±£¬ÈôÊǸ³Öµ²ÎÊýÊÇÒ»¸öNativeÊý×éµÄ»°»á½«Æäת»»ÎªVarArray£¨Å²ÓÃÁËToVarArrayº¯Êý£©¡£ÆäŲÓú¯ÊýÕ»ÈçÏ¡£

´ËʱÊý×éµÄÀàÐÍÒѾ±¬·¢Á˸ıä¶øJIT²¢Ã»Óмì²éµ½ÕâÒ»µãÒÔÊDZ¬·¢ÁËÎó²î¡£
ÔÙÀ´¿´Ò»¸ö½ÏΪÖØ´óµãµÄÀý×ÓCVE-2018-0835¡£

¸ÃÎó²î±£´æÓÚJavascriptArray::ReverseHelperº¯ÊýÖУ¬º¯Êý»áŲÓÃJavascriptArray::FillFromPrototypes£¬¸Ãº¯Êýͨ¹ý±éÀúprototypeÀ´Ìî³äarray¡£

ÔÚ³ÌÐòÖУ¬º¯ÊýÈ·±£prototypeÖеÄarray²»¿ÉÊÇNativeArray¡£

Ò²¾ÍÊÇ˵£¬ÈôÊÇprototypeÊÇNativeArrayÊý×éÔò»á±»³ÌÐòת»»ÎªVarArray£¬ÈôÊÇÄܹ»Ê¹Ò»¸öÊý×éµÄprototypeΪNativeArray£¬¾Í¿ÉÒÔͨ¹ýÊý×éµÄReverseÒªÁ콫ÆäprototypeµÄNativeArrayת»»ÎªVarArray¡£²»¹ýÕâÀïÉÐÓÐÒ»¸öÎÊÌâ¾ÍÊÇÔõÑùÈ·±£prototypeÊÇNativeArray£¬Ò»Ñùƽ³£ÇéÐÎÏÂÈôÊÇÒ»¸öÊý×é±»¿´³Éprototype£¬ÔòËü»á±»×ª»¯ÎªVarArray¡£
ÔÚJavascriptArray::EntrySortÖб£´æÈçÏ´úÂë¡£

ÈôÊÇarrÊÇÒ»¸öNativeArray£¬ËüÊ×ÏÈ»áÄð³ÉÒ»¸öVarArrayÖ´ÐÐsort»Øµ÷£¬ÔÙ±ä»ØNativeArray£¬ÈôÊÇÄܹ»Ôڻص÷Öн«Õâ¸öarr¸³¸øprototype£¬Ö®ºóËüµÄÀàÐÍÓÖ»á±ä»ØÀ´£¬ÕâÑù¾Í¿ÉÒÔ»ñµÃÒ»¸öÀàÐÍ»ìÏýÎó²î¡£
2.3 ˼Ð÷Èý£ºMissingItem
CVE-2018-0953ͬÑùÒ²ÊÇͨ¹ýº¯ÊýŲÓÃÐÞ¸ÄÊý×éÀàÐÍ£¬Õâ¸öÎó²îÌØÊâÖ®´¦ÔÚÓÚÒý³öÁËÁíÒ»¸ö¹Ø×¢µã£¬¼´Êý×éµÄMissingItem¡£MissingItemÊÇÒ»¸öÊýÖµ£¬ÔÚ64λ³ÌÐòÉϼ´ÊÇ0x8000000280000002¡£ChakraÒýÇæÔÚÊý×齨ÉèµÄʱ¼ä»áʹÓÃÕâ¸öÖµ¶ÔÊý×éÔªËؾÙÐгõʼ»¯£¬ÌåÏÖÊý×éÖиÃÔªËØ»¹Î´¾ÙÐи³Öµ£¬ÁíÍâÊý×黹»á±£´æÒ»¸ö±ê¼Ç루NoMissingValues£©À´±ê¼Ç´ËÊý×éÊÇ·ñÓÐδ±»¸³ÖµµÄÔªËØ¡£
ÏÈ¿´¿´ÏÂÃæÕâ¶Î´úÂë¡£

µ±Ö´ÐÐÊý×éµÄ¸³Öµ²Ù×÷£¬Å²ÓÃÁËNativeArrayµÄSetItemº¯Êý£¬SetItemº¯ÊýʵÏÖÈçÏ¡£

µ±¸øNativeArray¸³ÖµÊ±£¬ÈôÊÇÕâ¸öÖµ¼´ÊÇMissingItem£¬¿ÉÒÔ½«NativeArrayת»¯ÎªVarArray¡£ÓÅ»¯Âß¼¼ÙÉè¶ÔÊý×é¾ÙÐи³ÖµÊÇÒ»¸öºÜÇå¾²µÄ²Ù×÷£¬Ö»Òª´«Èë²ÎÊý²»ÊÇÒ»¸ö¹¤¾ßÄÇô¾Í²»»á¸Ä±äÊý×éÀàÐÍ£¬¿ÉÊDz¢Ã»ÓÐ˼Á¿µ½ÈôÊǸ³ÖµµÄÖµ¼´ÊÇMissingItemµÄ»°»áÒýÆðÊý×éÀàÐ͵Äת±ä£¬ÕýÊÇÕâÖÖÊèºöµ¼ÖÂÁËÎó²îµÄ±¬·¢¡£
Õâ¸öÎó²î×Ô¼ººÜÊǺÃÃ÷È·£¬¿ÉÊÇMissingItem×Ô¼ºÓÖÒý³öÁËÒ»Á¬´®µÄÎÊÌâ¡£¸ÃÎó²îµÄ²¹¶¡³ÌÐòÐÞ²¹ÁËͨ¹ýOP_SetElementIÀ´Å²ÓÃSetItemµÄÇéÐΣ¬¿ÉÊÇÕâÑùÐÞ²¹Ô¶Ô¶²»·ó£¬ÓÉÓڶԸú¯ÊýŲÓõÄλÖÃ×ÅʵºÜÊǶ࣬ÓÚÊÇÕÒÎó²îµÄ˼Ð÷Äð³ÉÁËÑ°ÕÒΪNativeArray¸³ÖµµÄÖÖÖÖ·¾¶µÄÎÊÌâ¡£
CVE-2018-0953µÄÎó²î·¢Ã÷ÕßlokihardtÔÚ²¹¶¡ÐÞ²¹ºóÓÖÌá³öÁ½ÖÖ˼Ð÷À´Èƹý²¹¶¡£¬µÚÒ»¸öÊÇͨ¹ýarraypushÀ´Å²ÓÃSetItem¡£
´¥·¢Îó²î´úÂëÈçÏ£º

ÓÉÓÚͨ¹ýpush¶ÔÊý×é¾ÙÐвåÈëµÄ²Ù×÷»áŲÓÃSetItem£¬ÒÔÊÇÊý×é¸Ä±äµÄÇéÐÎÈÔÈ»»á±£´æ¡£

µÚ¶þ¸ö˼Ð÷ÊÇÏÈÖ±½ÓÐÞ¸ÄÊý×éµÄÔªËØ£¬ÔÙͨ¹ýcancatÀ´ÐÞ¸ÄÊý×éÀàÐÍ¡£Îó²î´¥·¢´úÂëÈçÏ£º

POCÊ×ÏÈͨ¹ýsetÐÞ¸ÄÁËÊý×éÖÐÔªËصÄÖµ¡£

¶ÔÓ¦µÄJIT´úÂëÊÇÕâÑùµÄ¡£

ÔÚÐÞ¸ÄÁËÊý×éÔªËغ󣬴´Á¢ÁËÒ»¸öÓÐMissingItem¿ÉÊÇHasNoMissingValuesµÄarray¡£
½Óמ籾ŲÓÃÁËtriggerº¯Êý£¬ÓÉÓÚÊý×éµÄHasNoMissingValues±ê¼ÇλΪÕ棬ÏÂͼ´úÂëÖеÄÌõ¼þÊÇÖª×ãµÄ¡£

ÓÉÓÚÊý×éÓÐÁËMissingItem£¬ÒÔÊÇ¿ÉÒÔ¾ÙÐе½ÈçÏ·ÖÖ§¡£

InternalFillFromPrototypeº¯Êý»á¶ÔbuggyÊý×éprototypeÁ´ÉÏËùÓй¤¾ßŲÓÃEnsureNonNativeArray£¬Ò²¾ÍÊÇ˵»á¶ÔarrŲÓÃEnsureNonNativeArray£¬ÕâÑù¾Í¿ÉÒÔÐÞ¸ÄÆäÊý×éÀàÐÍ£¬¿ÉÊÇJITÒýÇæ²¢²»ÖªµÀarrÀàÐÍÒѾ¸Ä±ä£¬ÒÔÊǻᵼÖÂÀàÐÍ»ìÏý¡£
Õë¶Ô´ËÎÊÌ⣬ChakraµÄÊÂÇéÖ°Ô±×îÏÈ´ó¹æÄ£µÄ¼ì²éNativeArrayµÄinput£¬ÔÚLowerStElemC¡¢
GenerateProfiledNewScObjArrayFastPath¡¢GenerateHelperToArrayPopFastPathµÈÖî¶àº¯ÊýÉÏÌí¼ÓÁËMissItemµÄ¼ì²â£¨ÓÉÓÚÐÞ²¹º¯Êý½Ï¶à£¬ÕâÀï¾Í·×Æçһö¾ÙÁË£¬ÏêÇéÇë²Î¿¼µØµãhttps://github.com/Microsoft/ChakraCore/commit/91bb6d68bfe0455cde08aaa5fbc3f2e4f6cc9d04£©¡£
¿ÉÊÇ£¬Í¨¹ýÈçÏ´úÂëŲÓõÄOP_Memsetº¯Êý²¢Ã»ÓжÔvalue¾ÙÐмì²é£¬ÈÔÈ»¿ÉÒÔÓÃÀ´½á¹¹ÓµÓÐMissingItem¿ÉÊÇHasNoMissingValuesµÄarray£¬²¢Í¨¹ýconcatÀ´»ñµÃÒ»¸öÀàÐÍ»ìÏýÎó²î¡£

ÖµµÃÒ»ÌáµÄÊÇ£¬ÔÚ11ÔµIJ¹¶¡ÖÐChakraÖ±½Ó¶ÔconcatÒªÁì×öÁËÑÏ¿áµÄ´¦Öóͷ££¬´ÓÇéÐÎÉÏÍƲâÓ¦¸ÃÊÇÕÒµ½ÁËеÄÒªÁìÀ´½«MissingItemдÈëarray£¬µ«ÓÉÓÚÍøÉÏûÕÒµ½ÏìÓ¦µÄÐÅÏ¢£¬ÔÙ¼ÓÉϲ¹¶¡²¢Ã»ÓжԽ«ÖµÐ´ÈëarrayµÄ´úÂë¾ÙÐÐÐÞ²¹£¬·´¶øÏÞÖÆÁËconcat£¬ÒÔÊÇÒ²ÎÞ·¨ÅжÏÏêϸÇéÐΡ£

2.4 ˼Ð÷ËÄ£º½«Êý×éαװ³É¹¤¾ß
×îºóÒ»ÖÖ˼Ð÷£¬Í¨¹ýÒÉ»óChakraÒýÇ棬ʹÆäÔÚÌìÉúJIT´úÂëÀú³ÌÖйýʧµÄ½«NativeArray¿´³ÉÆäËû¹¤¾ß£¬ÒÔÖÁÓÚûÓÐÔÚÊʵ±µÄλÖÃÌí¼Ó¼ì²é´úÂë¡£
¹ûÕæµÄÀý×ÓÊÇCVE-2018-8466¡£

ChakraʹÓÃJavascriptArray::GetArrayForArrayOrObjectWithArrayÀ´ÅжϹ¤¾ßÊÇ·ñÊÇarray£¬ÆäÂß¼ÈçÏÂËùʾ¡£

ͨ¹ýCrossSite classÀ´wrapÒ»¸ö¹¤¾ßµÄʱ¼ä»áÌæ»»¸Ã¹¤¾ßµÄÐé±í£¬ÒÔÊDZ»wrappingµÄÊý×齫²»»á±»Ê¶±ðΪÊý×飬Õ⽫µ¼ÖÂÎÞ·¨ÔÚ׼ȷµÄµØ·½ÌìÉú¶ÔÊý×éÀàÐ͵ļì²é²¢±¬·¢ÀàÐÍ»ìÏýÎó²î¡£
²¹¶¡³ýÁËÑéÖ¤Ðé±íÊÇ·ñÊÇarray¹¤¾ßÖ®Í⣬»¹¼ì²éÁ˹¤¾ßÊÇ·ñÊDZ»CrossSite wrapµÄÊý×é¡£

ÁíÒ»¸öÀý×ÓÊÇCVE-2018-8542£¬Æä²¹¶¡ÔÚValueType::MergeWithObjectÖС£

¸Ãº¯ÊýÖ÷ÒªÓÃÓںϲ¢Á½¸ö¹¤¾ß£¬¿ÉÒÔ¿´µ½²¹¶¡Ìí¼ÓÁËÑéÖ¤£¬ÓÃÓÚÈ·¶¨Á½¸ö¹¤¾ßÖÐÊÇ·ñÓÐÊý×飬ÔÙÊÓ²ìÒ»ÏÂû´ò¹ý²¹¶¡µÄÎÊÌâ´úÂ룬ÈôÊÇÁ½¸ö¹¤¾ß¶¼²»ÊÇUninitializedObject£¬ÔòºÏ²¢ÎªObject¹¤¾ß£¬´óÖ¿ÉÒÔ»ñÖªÎó²î±¬·¢µÄÔµ¹ÊÔÓÉ£¬ÔÚÖ´Ðе½Õâ¾äµÄʱ¼äÈôÊÇÁ½¸ö¹¤¾ßÖÐÓÐÒ»¸öÊÇÊý×飬Ôںϲ¢Ê±Êý×é»á±»¿´³É¹¤¾ßÀ´´¦Öóͷ££¬ÓÅ»¯Àú³ÌÖÐÒýÇæ°ÑºÏ²¢µÄÊý×é¿´³ÉÁ˹¤¾ß£¬ÄÇô¶ÔÊý×éÀàÐÍÊÇ·ñ¸Ä±äµÄ¼ì²âËäÈ»¾Í²»±»ÐèÒª£¬ÓÚÊÇ×îÖÕµ¼ÖÂÁËÀàÐÍ»ìÏý¡£

3¡¢×Ü ½á
ÔÚÒÑÍùÒ»Äê×óÓÒ£¬JIT±àÒëÓÅ»¯Àú³ÌÖеÄÀàÐÍ»ìÏýÊÇChakraÎó²îÍÚ¾ò·½ÃæµÄÒ»¸öÖ÷Òª¹Ø×¢µã¡£´ÓÔçÆÚµÄʹÓÃδ±»±£»¤µÄ»Øе÷Õý³£º¯ÊýÀ´ÐÞ¸ÄÊý×éÀàÐÍ£¬ÔÙµ½Ñ°ÕÒÑéÖ¤Àú³ÌÖеÄÂß¼ÎÊÌ⣬ʹÓÃÊý×éµÄMissingItemÌØÕ÷£¬½«Êý×éαװ³ÉÆäËûÀàÐ͹¤¾ß˼Ð÷£¬ÎÒÃÇ¿ÉÒÔ¿´µ½Ëæ×ÅÑо¿Õ߶ÔChakraÒýÇæµÄÉîÈëÑо¿£¬Îó²î±¬·¢µÄλÖÃÒѾ´Ó¼òÆӵŤ¾ßÒªÁìÖð²½ÏòJITÓÅ»¯´úÂëÌìÉúÀú³ÌÖб¬·¢µÄÖÖÖÖÂß¼ºÍÅжÏÎÊÌ⿿££¬Îó²îÍÚ¾òµÄÃż÷Ò²ÓÐÁËÏÔÖøµÄÌáÉý¡£
ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøÆð¾¢·ÀÓùʵÑéÊÒ£¨ADLab£©
ADLab½¨ÉèÓÚ1999Ä꣬ÊÇÖйúÇå¾²ÐÐÒµ×îÔ罨ÉèµÄ¹¥·ÀÊÖÒÕÑо¿ÊµÑéÊÒÖ®Ò»£¬Î¢ÈíMAPPÍýÏë½¹µã³ÉÔ±£¬¡°ºÚȸ¹¥»÷¡±¿´·¨Ê×ÍÆÕß¡£×èÖ¹ÏÖÔÚ£¬ADLabÒÑͨ¹ýCVEÀÛ¼ÆÐû²¼Çå¾²Îó²î½ü1000¸ö£¬Í¨¹ý CNVD/CNNVDÀÛ¼ÆÐû²¼Çå¾²Îó²î½ü500¸ö£¬Ò»Á¬¼á³Ö¹ú¼ÊÍøÂçÇå¾²ÁìÓòÒ»Á÷Ë®×¼¡£ÊµÑéÊÒÑо¿Æ«Ïòº¸Ç²Ù×÷ϵͳÓëÓ¦ÓÃϵͳÇå¾²Ñо¿¡¢Òƶ¯ÖÇÄÜÖÕ¶ËÇå¾²Ñо¿¡¢ÎïÁªÍøÖÇÄÜ×°±¸Çå¾²Ñо¿¡¢WebÇå¾²Ñо¿¡¢¹¤¿ØϵͳÇå¾²Ñо¿¡¢ÔÆÇå¾²Ñо¿¡£Ñо¿Ð§¹ûÓ¦ÓÃÓÚ²úÆ·½¹µãÊÖÒÕÑо¿¡¢¹ú¼ÒÖصã¿Æ¼¼ÏîÄ¿¹¥¹Ø¡¢×¨ÒµÇå¾²·þÎñµÈ¡£