¡¾Ô­´´Îó²î¡¿WebAssembly¸ßΣÎó²îÓ°ÏìEdgeºÍSafariä¯ÀÀÆ÷

Ðû²¼Ê±¼ä 2019-03-26

Îó²î¸ÅÊö


2018Äê10Ô £¬ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøADLab·¢Ã÷ä¯ÀÀÆ÷WebAssemblyÄ £¿é±£´æ¸ßΣÎó²î £¬²¢µÚһʱ¼äת´ïÆ»¹ûºÍ΢Èí¹Ù·½¾ÙÐÐÐÞ¸´¡£¸ÃÎó²îλÓÚ¶ÔÓ¦ä¯ÀÀÆ÷JavaScriptÒýÇæ(JavaScriptCore/ChakraCore)ÓëWebAssemblyÄ £¿éµÄ½Ó¿Ú £¬¿ÉͬʱӰÏìEdge¡¢Safariä¯ÀÀÆ÷¡£


2019Äê3ÔÂ25ÈÕ £¬Æ»¹ûÐû²¼ÁËÕë¶Ô¸ÃÎó²îµÄÇå¾²²¹¶¡£¨CVE-2019-6201£©£»Î¢ÈíµÄ¶ÔÓ¦Îó²î²¹¶¡ÒÑÓÚ2019Äê2ÔÂ12ÈÕÐû²¼¡£ÌáÐÑ¿í´óÓû§¾¡¿ì½«ä¯ÀÀÆ÷Éý¼¶µ½×îа汾¡£


Îó²îÓ°Ïì¹æÄ£


Microsoft Windows 10²Ù×÷ϵͳµÄEdgeä¯ÀÀÆ÷
Apple iOS/macOS²Ù×÷ϵͳµÄSafariä¯ÀÀÆ÷
ÆäËûƽ̨ÉÏ»ùÓÚWebKitµÄ×é¼þºÍ²úÆ·


Îó²î¼òÎö


¹¥»÷Õß¿Éͨ¹ýÈ«ÐĽṹµÄhtmlÍøÒ³ £¬Ê¹Óû§ÔÚʹÓÃä¯ÀÀÆ÷»á¼ûÍøҳʱ´¥·¢Îó²î¡£¸ÃÎó²îÔÚä¯ÀÀÆ÷Îó²îʹÓÃÖпÉÒÔÖ±½Ó×÷ΪfakeobjÔ­Óͨ³£addrofÓëfakeobjÔ­ÓïÍŽá¿ÉÒÔÖ±½Ó»ñµÃí§Òâ´úÂëÖ´ÐеÄÄÜÁ¦ £¬ÔÚһЩÌØÊâÇéÐÎÏ £¬µ¥¶ÀʹÓÃfakeobjÔ­ÓïÒ²¿ÉÒÔÍê³ÉÎó²îʹÓá£


¸ÃÎó²îµÄ¼òÒªÆÊÎöÈçÏ£¨ÒÔSafari/WebKit CVE-2019-6201ΪÀý£©£º
WebAssemblyModuleRecord::linkÈÏÕæÆÊÎöWebAssemblyÄ £¿éÖеĸ÷¸ö½á¹¹ £¬ÔÚÆÊÎöµ¼³ö±íʱ £¬ÓУº

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


ÔÚ¼ÓÔص¼³öµÄÈ«¾Ö±äÁ¿Ê± £¬ÓÐWasm::I32¡¢Wasm::I64¡¢Wasm::F32¡¢Wasm::F64ËÄÖÖÀàÐÍ £¬ÊÇWebAssembly±ê×¼ÖÐÖ¸¶¨µÄÊý¾ÝÀàÐÍ(descriptor) £¬»®·ÖÌåÏÖ32λ¡¢64λµÄÕûÊýºÍ¸¡µãÊý £¬ÔÚ.wasmÎļþÖÐÓÃÒ»¸ö×Ö½ÚÈ·¶¨£»Ëæºóƾ֤±äÁ¿ÀàÐ͵ij¤¶È´Ó.wasmÎļþÖмÌÐøÈ¡³öÏêϸÊý¾Ý(value) £¬·â×°³ÉJSValue¹©JavaScriptÉÏÏÂÎÄʹÓá£


ÒÔ¡°case Wasm::F64ΪÀý¡± £¬debug°æµÄ´úÂë»á¼ì²éÍâÀ´Êý¾ÝÊÇ·ñÊÇÒ»¸öÇкÏIEEE754±ê×¼µÄË«¾«¶È¸¡µãÊý£º

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


Release°æ±¾»áÔÚ±àÒëÀú³Ì½«isImpureNaNÕâÒ»¼ì²éÈ¥µô £¬´ËʱÍâÀ´Êý¾ÝÈôÊÇÊÇÒ»¸öNaN(Not a Number) £¬ÀýÈç0xffff000000888888 £¬ÔÚͨ¹ý¼Ó·¨(+DoubleEncodeOffset)·â×°³ÉJSValueʱ»á±¬·¢Òç³ö £¬Äð³É0x888888¡£ÓÉÓÚSafariµÄboxing¹æÔò £¬ÕâÑùµÄÒ»¸öJSValue»á±»¿´³ÉÖ¸Õë £¬Òò¶ø±¬·¢ÀàÐÍ»ìÏýÎó²î¡£


Îó²îÐÞ²¹ÔòÌìÕæÀÃÂþµØ°ÑÈ¥µôµÄ¼ì²é²¹»ØÀ´£º

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


Edgeä¯ÀÀÆ÷µÄÎó²îºÍ²¹¶¡Ò²ºÜÊÇÏàËÆ£º


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


¿ÉÒÔ¿´µ½ £¬ÔÚWebAssembly±ê×¼µÄʵÏÖÖÐ΢Èí¡¢Æ»¹û·¸ÁËÀàËƵĹýʧ £¬µ¼ÖÂÎó²îµÄÃæÄ¿Ò²¼«ÆäÏàËÆ £¬Îó²îÔ­ÀíÒ²²¢²»Öش󡣸ÃÎó²îÊÇÔÚWebAssembly¹¦Ð§ÊµÏÖʱֱ½ÓÒýÈëµÄ £¬ÔÚEdge¡¢SafariÖÐÒÑDZÔÚÁË2Äê¡£


ÁíÒ»·½Ãæ £¬ÓÉÓÚJavaScriptÒýÇæÒ²ÎÞ·¨ÓÅÒìµØʵÏÖi64ÀàÐ͵ÄWebAssembly±äÁ¿ £¬Òò´ËÎÞÂÛÊÇSafari/WebKitÕÕ¾ÉEdge¶¼¾Ü¾ø¶Ô¸ÃÀàÐͼ°¾ÙÐд¦Öóͷ£¡£MDNÒ²ÔÚWebAssemblyµ¼³öº¯ÊýÕ½ÚÌáµ½£º¡°ÈôÊÇÄãʵÑéŲÓÃÒ»¸ö½ÓÊÜ»ò·µ»ØÒ»¸öi64ÀàÐ͵¼³öµÄwasmº¯Êý £¬ÏÖÔÚËü»áÅ׳öÒ»¸ö¹ýʧ £¬ÓÉÓÚJavaScriptûÓÐ׼ȷµÄ·½·¨À´±êʶһ¸öi64¡£²»¹ý £¬ÕâÔÚδÀ´¿ÉÄÜ»á¸Ä±ä¡ª¡ªÔÚδÀ´µÄ±ê×¼ÖÐ £¬½«Ë¼Á¿ÐµÄi64ÀàÐÍ¡£½ìʱ £¬wasm¿ÉÒÔʹÓÃËü¡±¡£


Õâ¸øÎÒÃǵÄÆôʾ£º


ÐÂÊÖÒÕ¡¢Ð±ê×¼»á´øÀ´ÐµĹ¥»÷Ãæ £¬±ê×¼µÄʵÏÖÀú³Ì¿ÉÄÜ»áÅãͬÇå¾²ÎÊÌâ¡£
²î±ðÄ £¿éñîÊÊʱ¿ÉÄÜ»áÍ»ÆÆÄ³Ä £¿éÄÚ²¿µÄ¼ÙÉè £¬ÐèÒªÉóÉ÷¿´´ý¡£
ƾ֤¸ÃÎó²îµÄÌصã £¬ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøADLabÒÑÒ»Á¬·¢Ã÷ÁËÈô¸ÉÎó²îºÍ´úÂëÎÊÌâ £¬²¢ÒÑת´ï³§É̾ÙÐÐÐÞ¸´¡£


Îó²îʱ¼äÖá


2018Äê10ÔÂ30ÈÕ £¬ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøADLabÏòÆ»¹ûÌá½»Îó²î¡£
2018Äê11ÔÂ6ÈÕ £¬ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøADLabÏò΢ÈíÌá½»Îó²î¡£
2018Äê11ÔÂ27ÈÕ £¬Æ»¹ûÔÚWebKit´úÂë¿âÖÐÐÞ¸´Îó²î¡£
2019Äê1ÔÂ24ÈÕ £¬Î¢ÈíÔÚChakraCore´úÂë¿âÖÐÐÞ¸´Îó²î¡£
2019Äê2ÔÂ12ÈÕ £¬Î¢ÈíΪEdgeä¯ÀÀÆ÷ÍÆËÍÇå¾²ÐÔ¸üР£¬²¢Åû¶CVE±àºÅ¡£
2019Äê3ÔÂ25ÈÕ £¬Æ»¹ûΪSafariä¯ÀÀÆ÷µÈ²úÆ·ÍÆËÍÇå¾²ÐÔ¸üР£¬²¢Åû¶CVE±àºÅ¡£


Çå¾²½¨Òé


×°Öó§ÉÌÍÆË͵ÄÇå¾²ÐÔ¸üР£¬¸üÐÂÖÁ×îа汾¡£
ΪÁËÀû±ãÉçÇøТ˳´úÂë £¬Edge¡¢SafariÔÚÄڵij£¼ûä¯ÀÀÆ÷²úÆ·ÍùÍù½«½¹µãÒýÇæ×é¼þ¿ªÔ´ £¬¶ø¿ªÔ´´úÂë¿ÍÕ»ÖеÄÿ´Î²¹¶¡Ìá½»¾ù°üÀ¨²¿·ÖÎó²îÐÅÏ¢¡£Òò´ËÔÚ³§ÉÌÕýʽÅû¶Îó²î²¢Îª²úÆ·ÍÆËͲ¹¶¡Ö®Ç° £¬ºÚ¿ÍÓÐÒ»¸ö½á¹¹Îó²îPOCµÄ¹¥»÷ʱ¼ä´°¡£ÎªÁËËõСÕâһʱ¼ä´° £¬ÖÕ¶ËÓû§Ó¦ÊµÊ±×°Öó§ÉÌÌṩµÄÇå¾²ÐÔ¸üС£


²Î¿¼Á´½Ó£º

https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2019-0607
https://support.apple.com/en-us/HT209599
https://developer.mozilla.org/zh-CN/docs/WebAssembly/Exported_functions


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