¡¾Ô­´´Îó²î¡¿Î¢ÈíIE/Edge¾ç±¾ÒýÇæÎó²îCVE-2020-0768ÆÊÎö

Ðû²¼Ê±¼ä 2020-03-13

΢ÈíÔÚ¿ËÈÕÐû²¼µÄ²¹¶¡Í¨¸æÖУ¬ÐÞ¸´ÁËÒ»¸öÓÉÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøADLabÇå¾²Ñо¿Ô±Ìá½»µÄÎó²î£¬Îó²î±àºÅΪCVE-2020-0768¡£Îó²îλÓÚChakraCoreÒýÇæ´úÂë¿âÖУ¬¿ÉͬʱӰÏìInternet Explorer 11ºÍMicrosoft Edge (»ùÓÚEdgeHTML)ä¯ÀÀÆ÷¡£¸ÃÎó²îÊÇÒ»¸öÄÚ´æÆÆËðÐÍÎó²î£¬ÓÐÔ¶³Ì´úÂëÖ´ÐеÄΣº¦£¬Òò´Ë΢Èí½«ÆäÆÀ¼¶Îª¡°ÑÏÖØ¡±£¬²¢ÖÂлADLab¡£


Ó¦¶Ô²½·¥


ʹÓÃWindows×Ô¶¯¸üлòÊÖ¶¯ÏÂÔز¹¶¡°üÐÞ¸´Îó²î¡£


Îó²îºÍ²¹¶¡ÆÊÎö


PART1


±¾Îó²îÊÇChakraCoreÒýÇæÔÚJIT±àÒëÀú³ÌÖУ¬¼òµ¥Ö¸ÁîµÄÊý¾ÝÁ÷ÆÊÎö¹ýʧ£¬µ¼ÖµıäÁ¿»îÔ¾ÐÔÆÊÎöºÍ¼Ä´æÆ÷·ÖÅÉÍÉ»¯¡£Ê×ÏÈ£¬´ÓÎó²îÑù±¾µÄ¿ØÖÆÁ÷ͼ×îÏÈ¡£


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


ÆäÖУ¬ÔÚBlock 4ÓÐÈçϵÄ×Ö½ÚÂ룺


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


·ûºÅs10´ú±í[1337]£¬s6´ú±íconstÐÞÊεÄarr¡£Æ¾Ö¤±àÒëÔ­ÀíµÄÊõÓ±äÁ¿»ñÈ¡½ç˵ֵ³ÆΪdef£¬±äÁ¿Öµ±»Ê¹ÓóÆΪuse£¬ÔÚInitConstÖ¸ÁîÖÐs6±»def£¬s10±»use£¬ËæºóÔÚStElemCÕâÌõÖ¸ÁîÏ£¬s6±»use¡£¿ÉÒÔ¿´µ½s6Óës10¹ØϵÇ×½ü£¬s6¿ÉÒÔ¿´×÷s10ƾ֤ÁíÒ»ÖÖÒªÁì¶Ôͳһ±äÁ¿µÄÒýÓã¬ChakraCore³ÆΪcopy-prop·ûºÅ¶Ôԭʼ·ûºÅµÄÒýÓᣵ«µ÷ÊÔÏÔʾ£¬ÕâÀﱬ·¢Á˹ýʧ¡£


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


ÔÆÔÆÒ»À´ÐγÉÁËԭʼ·ûºÅΪs10£¬copy-prop·ûºÅΪs6£¬¼´s6->s10µÄ¼üÖµ¶Ô¡£ÆäÕ»»ØËÝλÓÚ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


¹ýʧ¼üÖµ¶ÔÊÇƾ֤Êý¾ÝÁ÷ÆÊÎöµÄ¹ýʧЧ¹ûµÃ³öµÄ¡£Ëæºó£¬Õâ¸ö¼üÖµ¶Ô±»¼ÓÈëÁËBlock 4ÖÐblockOptData->capturedValues->copyPropSyms£¬ÆäÕ»»ØËÝλÓÚ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


Ëæºó£¬ÔÚJIT ForwardPassÕâÑùÒÔÇ°ÏòºóµÄÓÅ»¯Àú³ÌÖУ¬Block 4µÄblockOptData->capturedValues±»ºÏ²¢¸øBlock 5£¬ÆäÖаüÀ¨s6->s10ÕâÒ»¼üÖµ¶Ô£¬ÆäÕ»»ØËÝλÓÚ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


ÔÙÖ®ºó£¬ÔÚJIT BackwardPassÕâÑù´ÓºóÏòÇ°µÄÓÅ»¯Àú³ÌÖУ¬Block 5µÄupwardExposedUsesͨ¹ý»á¼ûblockOptData->capturedValues->copyPropSyms£¬°Ñs6->s10ÕâÒ»¼üÖµ¶Ô¼ÓÈë¡£ÆäÕ»»ØËÝλÓÚ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


upwardExposedUsesÔÚ±àÒëÔ­ÀíÖб»³ÆΪ¡°ÏòÉÏ̻¶µÄʹÓá±£¬ËüÊDZäÁ¿»îÔ¾ÐÔÆÊÎöµÄ¶Ô³ÆÀú³Ì¡£ËæºóÔÚ·´ÏòÈö²¥µÄÀú³ÌÖУ¬º¬ÓÐÉÏÊö¼üÖµ¶ÔµÄupwardExposedUses±»×ª´ï¸øBlock 4¡¢Block 3ºÍBlock 2¡£¶ø×÷ΪLoop HeaderµÄBlock 2½«ÆäupwardExposedUsesÓÃÓÚ»îÔ¾ÐÔÆÊÎöºÍºóÐøµÄ¼Ä´æÆ÷·ÖÅÉÀú³Ì¡£


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


ÉÏÊöÀú³Ì¿ÉÒÔͨ¹ýÏÂͼÀ´ÌåÏÖ¡£¿ÉÒÔ¿´µ½£¬¹ýʧµÄÊý¾Ý¾­ÓÉÁËÕýÏòÈö²¥ºÍ·´ÏòÈö²¥£¬×îÖÕÔÚÑ­»·ÌåµÄËùÓйæÄ£¶¼±»ÎÛȾ¡£


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


Ëæºó£¬ÓÉÓÚÉÏÊö¹ýʧÊý¾Ý£¬ÔÚJITµÄ¼Ä´æÆ÷·ÖÅÉÀú³ÌΪs10ÅÌËã³öÁ˹ýʧµÄÉúÃüÖÜÆÚ£¬ÆäÉúÃüÖÜÆÚºá¿çÑ­»·µÄ×îÏȵ½¿¢Ê¡£ÓÚÊÇÒõ²îÑô´í£¬JIT²åÈëÁËÒ»¸öMOVÖ¸ÁÐÎÈçMOV labelReg, mem£¬µ«²¢Ã»Óгõʼ»¯Æäinstr->src->m_offset£¬¸ÃֵʼÖÕΪ0¡£ÔÚ×îºóÌìÉúÆøеÂëµÄʱ¼ä£¬ÌìÉúÁËÒ»¸öÖ¸ÏòÕ»Ö¡Ö¸Õ롢ƫÒÆΪ0µÄ¶ÁÄÚ´æ²Ù×÷£¬ÌåÏÖΪ[EBP+0x0]»ò[RBP+0x0]¡£


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


ÕâÑù£¬Ò»¸ö·ÇÔ¤ÆÚµÄÄÚ´æ»á¼û°Ñ²»·¨µÄÊý¾Ý¶ÁÈëÁËJavaScriptÒýÇæÉÏÏÂÎÄ£¬ËæºóÔÚBailOut»òÆäËûÇéÐλáÒýÓõ½£¬ÕâÑùµÄ²»·¨Êý¾Ý½«»áÔì³ÉÀàÐÍ»ìÏý¡£


PART2


Ôì³ÉÉÏÊö¹ýʧÊý¾ÝÈö²¥µÄÔµ¹ÊÔ­ÓÉÔÚÓÚInitConstÕâÒ»Ö¸Áî×ÅʵûÓÐÔÚChakraCoreµÄJIT´úÂëÖлñµÃ׼ȷµÄÊý¾ÝÁ÷ÆÊÎö£¬Òò´ËÔÚ΢ÈíµÄÐÞ¸´ÖУ¬ÔÚJIT¸Õ×îÏȽéÈëµÄʱ¼ä£¬InitConstÖ¸Áî¾Í±»Ìæ»»³ÉLd_AÖ¸Áî¡£


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


ChakraCoreÍêÕûʵÏÖÁ˶ÔLd_AÖ¸ÁîµÄÊý¾ÝÁ÷ÆÊÎö¡£´Ëʱ£¬ÔÚÆÊÎöForward PassÖУ¬·¢Ã÷Block 4ÖеļüÖµ¶Ô²»ÔÙÊÇs6->s10£¬¶øÊÇs10->s6£¬Ò²¾ÍÊÇ˵s10ÊÇԭʼ·ûºÅ£¬s6ÊÇÒýÓÃs10µÄcopy-prop·ûºÅ¡£ÔÆÔÆÒ»À´£¬×ÔÈ»²»»áÔì³É¹ýʧÊý¾ÝµÄÈö²¥¡£Î¢ÈíÔÚIE11ä¯ÀÀÆ÷ÖÐʹÓÃÁËÏàͬµÄ´úÂëÀ´ÐÞ²¹Õâ¸öÎó²î¡£


ÊÂʵÉÏ£¬ÔÚECMAScript 6±ê×¼ÖУ¬constÐÞÊηûÓÃÀ´ÌåÏÖÒ»¸ö±äÁ¿ÔÚ½ç˵֮ºó²»¿ÉÔÙ±»¸³Öµ£¬ÊÇÓï·¨ÌõÀíµÄÔ¼Êø£»¶øJavaScriptÒýÇæÖеÄJITÀú³ÌʼÖÕ±¬·¢ÔÚÚ¹ÊÍÖ´ÐÐÖ®ºó£¬ÈôÊÇconstÐÞÊηûµÄÔ¼ÊøÔÚÚ¹ÊÍÖ´Ðн׶α»Î¥·´£¬½«»áÁ¬Ã¦Í˳ö£¬²»»áÓÅ»¯Ö´ÐÐJITÀú³Ì¡£Òò´Ë£¬JITÀú³ÌÖ»ÐèҪ˼Á¿Êý¾ÝÁ÷ÎÊÌ⣬¶ø²»±Ø˼Á¿constÐÞÊηûµÄÔ¼Êø¡£ÓÉÓÚChakraCoreÔÚJITµÄÓÅ»¯½×¶ÎÓëÚ¹ÊÍÖ´Ðн׶ÎʹÓÃͳһÌ×ÖÐÐÄÓïÑÔ£¬²»¹ÜÊÇLd_AÕÕ¾ÉInitConst¶¼¼æÈÝJITµÄÈ«Àú³Ì£¬±¾Îó²î¿ÉÒÔÃ÷È·ÒÔΪÊÇÒ»¸öÓªÒµÂß¼­Îó²î¡£


²Î¿¼Á´½Ó£º

1.https://portal.msrc.microsoft.com/en-us/security-guidance/acknowledgments

2.https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-0768