ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøADLab£ºChrome í§Òâ´úÂëÖ´ÐÐÎó²îÆÊÎö
Ðû²¼Ê±¼ä 2021-04-164ÔÂ13ÈÕ£¬ÍâÑóÇå¾²Ñо¿Ö°Ô±ÔÚÉ罻ýÌåÉÏÐû²¼ÁËChrome µÄ0Day Îó²î£¨°Ý¼û²Î¿¼Á´½Ó[1]£©£¬Îó²î±àºÅΪCVE-2021-21220£¬²¢ÔÚgithubÉϹûÕæÁ˸ÃÎó²îµÄPOCÒÔ¼°Ê¹ÓôúÂ룬Ïà¹ØµÄʹÓôúÂëÔڹرÕɳºÐµÄÇéÐÎÏ¿ɵִïÔ¶³Ì´úÂëÖ´ÐС£ÓÉÓÚchromium Ïà¹Ø¿ò¼ÜµÄÆÕ±éÓ¦Ó㬸ÃÎó²îÔÚÆäËûä¯ÀÀÆ÷»ò¾ç±¾ÒýÇæÖÐÈÔÓб£´æµÄ¿ÉÄÜ¡£¸ÃÎó²îÔÚchrome 90.0.4430.72°æ±¾ÒѾÐÞ¸´£¬ÌáÐÑ¿í´óÓû§ÊµÊ±¸üе½×îа汾£¨°Ý¼û²Î¿¼Á´½Ó[2]£©£¬ÒÔ¹æ±Ü¸ÃÎó²î±£´æµÄ¹¥»÷Σº¦¡£
ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøADLabÆÊÎö·¢Ã÷£¬¸ÃÎó²î±£´æÓÚChrome µÄJavaScript ÆÊÎöÒýÇæV8ÖУ¬POCÖ÷Òª´úÂëÈçÏ£º
ÔÚPOC line4Ö´ÐÐÒì»ò²Ù×÷,(2**31)^0=-2147483648¡£Æ¾Ö¤ECMA±ê×¼£¨°Ý¼û²Î¿¼Á´½Ó[3]£©£¬Òì»òµÄЧ¹ûÊÇ32λÕûÊý£º
ÔÚv8 SimplifiedLowering½×¶Î£¬ÔöÌíÁ˶ÔÒì»òµÄЧ¹ûÖ´ÐÐChangeInt32ToInt64µÄ²Ù×÷£º
SimplifiedLowering Ö´Ðкó£¬Òì»òµÄÀàÐͱ»±ê¼ÇΪWord32:
ÔÚMachineOperatorOptimizer½×¶Î£¬ÓÉÓÚÊǺÍ0×öÒì»ò£¬ÒÔÊÇÓÃ×ó²Ù×÷ÊýÈ¡´úÒì»ò²Ù×÷¡£
´ËʱµÄ½á¹¹Í¼ÈçÏ£¬¿ÉÒÔ¿´³öÒì»òµÄЧ¹ûÊÇWord32|TypeUint32:
ÔÚÖ¸ÁîÑ¡Ôñʱ£¬¹ØÓÚVisitChangeInt32ToInt64²Ù×÷£¬Æ¾Ö¤ÆäÊäÈëÀàÐÍÑ¡Ôñ²Ù×÷Â룺
ÒÔÊÇ£¬ÕâÀïµÄ²Ù×÷ÂëÊÇkX64Movl²Ù×÷Â룬¸ÃÖ¸ÁîÔÚ½«Ô´²Ù×÷ÊýÒÆÖÁÄ¿µÄλÖÃʱ²¢²»×ö·ûºÅÀ©Õ¹£¬ÕâÑùÔÚPOCline4ÖÐxµÄֵΪ2147483649£¬ÓÚÊÇÔÚpoc line12µÄλÖ㬱àÒëÆ÷×ÅʵʹÓõÄÊÇx=1µÄÖµ×÷Ϊ½¨ÉèÊý×éµÄ³¤¶È¡£ÕâÊDZàÒëÆ÷δÔøÔ¤ÍƲâµÄÇéÐΡ£
ÔÚ±äÁ¿µÄ¹æÄ£ÆÊÎöÖУ¬±àÒëÆ÷ÒÔΪ½¨ÉèµÄÊý×鳤¶ÈÊÇ0:
ÔÚÖ´ÐÐPOPʱ£¬»áÏÈÅжÏÊý×éµÄ³¤¶ÈÊÇ·ñΪ0£¬ÈôÊDz»ÊǾͻὫÆ䳤¶È¼õ1£º
ÓÉÓÚÊý×鳤¶ÈÀο¿£¬±àÒëÆ÷ÔÚLoadElimination µÄÀú³ÌÖлá¾ÙÐг£Á¿ÕÛµþ£¬ÔÚ´úÂë·¾¶×ßµ½ÕâÀïµÄʱ¼äͨ¹ýStoreField²Ù×÷½«Êý×éµÄ³¤¶ÈÖ±½Ó¸³ÖµÎª-1£º
ÓÉÓÚÊÇsmi£¬ÒÔÊÇÊÇ0xfffffffe£º
´òÓ¡Êý×鳤¶È£º
Õâʱ³¬³¤µÄÊý×é¾Í³ö¯ÁË£¬ÈÎÓÉÄãÍæÁË¡£´Ó²¹¶¡±ÈÕÕÉÏÀ´¿´£¨°Ý¼û²Î¿¼Á´½Ó[4]£©£¬¹ØÓÚChangeInt32ToInt64½«ÆäÊäÈë×÷ΪÓзûºÅ¿´´ý£¬ÕâÑù¾Í×èÖ¹Á˸ÃÎó²îͨ¹ý¸Ã·¾¶´¥·¢¡£
¹ØÓÚʹÓõIJ¿·Ö£¬»ù±¾ÊÇÀÏÌ×·£¬ÕâÀï¾Í²»ÔÙ׸Êö¡£
²Î¿¼Á´½Ó£º
[1]https://twitter.com/r4j0x00/status/1381643526010597380
[2]https://www.google.com/chrome/
[3]https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
[4]https://chromium-review.googlesource.com/c/v8/v8/+/2820971/3/src/compiler/backend/x64/instruction-selector-x64.cc#1379
ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøÆð¾¢·ÀÓùʵÑéÊÒ£¨ADLab£©
ADLab½¨ÉèÓÚ1999Ä꣬ÊÇÖйúÇå¾²ÐÐÒµ×îÔ罨ÉèµÄ¹¥·ÀÊÖÒÕÑо¿ÊµÑéÊÒÖ®Ò»£¬Î¢ÈíMAPPÍýÏë½¹µã³ÉÔ±£¬¡°ºÚȸ¹¥»÷¡±¿´·¨Ê×ÍÆÕß¡£×èÖ¹ÏÖÔÚ£¬ADLabÒÑͨ¹ýCVEÀÛ¼ÆÐû²¼Çå¾²Îó²î½ü1100¸ö£¬Í¨¹ý CNVD/CNNVDÀÛ¼ÆÐû²¼Çå¾²Îó²î1000Óà¸ö£¬Ò»Á¬¼á³Ö¹ú¼ÊÍøÂçÇå¾²ÁìÓòÒ»Á÷Ë®×¼¡£ÊµÑéÊÒÑо¿Æ«Ïòº¸Ç²Ù×÷ϵͳÓëÓ¦ÓÃϵͳÇå¾²Ñо¿¡¢ÖÇÄÜÖÕ¶ËÇå¾²Ñо¿¡¢ÎïÁªÍøÖÇÄÜ×°±¸Çå¾²Ñо¿¡¢WebÇå¾²Ñо¿¡¢¹¤¿ØϵͳÇå¾²Ñо¿¡¢ÔÆÇå¾²Ñо¿¡£Ñо¿Ð§¹ûÓ¦ÓÃÓÚ²úÆ·½¹µãÊÖÒÕÑо¿¡¢¹ú¼ÒÖصã¿Æ¼¼ÏîÄ¿¹¥¹Ø¡¢×¨ÒµÇå¾²·þÎñµÈ¡£