Lodash¿âÔ­ÐÍÎÛȾÎó²î£¨CVE-2019-10744£©

Ðû²¼Ê±¼ä 2019-07-12

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


Åä¾°ÐÎò


Lodash ÊÇÒ»¸ö JavaScript ¿â £¬°üÀ¨¼ò»¯×Ö·û´®¡¢Êý×Ö¡¢Êý×é¡¢º¯ÊýºÍ¹¤¾ß±à³ÌµÄ¹¤¾ß £¬¿ÉÒÔ×ÊÖú³ÌÐòÔ±¸üÓÐÓõرàдºÍά»¤ JavaScript ´úÂë¡£²¢ÇÒÊÇÒ»¸öÊ¢ÐÐµÄ npm ¿â £¬½öÔÚGitHub ÉϾÍÓÐÁè¼Ý 400 Íò¸öÏîĿʹÓà £¬LodashµÄÆÕ¼°ÂʺÜÊǸß £¬Ã¿ÔµÄÏÂÔØÁ¿Áè¼Ý 8000 Íò´Î¡£½üÆÚ±»±¬³öÒ»¸öÑÏÖصÄÔ­ÐÍÎÛȾÎó²î¡£


Îó²îÁбí


CVE ID  £º   CVE-2019-10744
Îó²îÆ·¼¶£º   ¸ßΣ
CVSSÆÀ·Ö£º   7.3
Ó°Ïì¹æÄ££º   4.17.11֮ǰµÄËùÓа汾

Îó²îÏêÇé


ͨ¹ý½á¹¹º¯ÊýÖØÔصķ½·¨ £¬Lodash ¿âÖеĺ¯Êý defaultsDeep ºÜÓпÉÄܻᱻÓÕÆ­Ìí¼Ó»òÐÞ¸Ä Object.prototype µÄÊôÐÔ £¬×îÖÕ¿ÉÄܵ¼Ö Web Ó¦ÓóÌÐò±ÀÀ£»ò¸Ä±äÆäÐÐΪ £¬Ïêϸȡ¾öÓÚÊÜÓ°ÏìµÄÓÃÀý¡£


Pony by Snyk


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

Ô­ÐÍÎÛȾÊÇÒ»¸öÓ°Ïì JavaScript µÄÎó²î¡£Ô­ÐÍÎÛȾÊÇÖ¸½«ÊôÐÔ×¢ÈëÏÖÓÐ JavaScript ÓïÑԽṹԭÐÍ£¨È繤¾ß£©µÄÄÜÁ¦¡£JavaScript ÔÊÐíËùÓй¤¾ßÊôÐÔ±»¸ü¸Ä £¬ÀýÈçÈç_proto_ £¬constructorºÍprototype¡£¹¥»÷Õßͨ¹ý×¢ÈëÆäËüÖµÀ´Ê¹ÓÃÕâЩÊôÐÔÀ´ÁýÕÖ»òÎÛȾ»ù´¡¹¤¾ßµÄ JavaScript Ó¦ÓóÌÐò¹¤¾ßÔ­ÐÍ¡£ÕâÑùºÜ¿ÉÄÜ»áÓ°ÏìÓ¦ÓóÌÐòͨ¹ýÔ­ÐÍÁ´´¦Öóͷ£ JavaScript ¹¤¾ßµÄÀú³Ì £¬´Ó¶øµ¼Ö¾ܾø·þÎñ»òÔ¶³Ì´úÂëÖ´ÐС£


Ô­ÐÍÎÛȾµÄÁ½ÖÖÖ÷Òª·½·¨£º


²»Çå¾²µÄObjectµÝ¹éºÏ²¢


°´Â·¾¶½ç˵ÊôÐÔ


²»Çå¾²µÄ¹¤¾ßµÝ¹éºÏ²¢


Ò×Êܹ¥»÷µÄµÝ¹éºÏ²¢º¯ÊýµÄÂß¼­×ñÕÕÒÔϸ߼¶Ä£×Ó£º

ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢
µ±Ô´¹¤¾ß°üÀ¨ÃûΪ_proto_defined with Object.defineProperty()µÄÊôÐÔʱ £¬¼ì²éÊôÐÔÊÇ·ñ±£´æ²¢ÇÒÊÇÄ¿µÄºÍԴת´ïÉϵŤ¾ßµÄÌõ¼þ £¬²¢ÇҺϲ¢½«ÓëÄ¿µÄ¾ÙÐеݹé £¬×÷ΪԭÐÍObjectºÍÔ´µÄObject½ç˵¡£

È»ºó¹¥»÷ÕßÔÚ Object Ô­ÐÍÉϸ´ÖÆÊôÐÔ¡£


¿Ë¡²Ù×÷ÊÇÒ»¸öÌØÊâµÄ²»Çå¾²µÝ¹éºÏ²¢×ÓÀà £¬Ëü±¬·¢ÔÚ¶Ô¿Õ¹¤¾ß¾ÙÐеݹéºÏ²¢Ê±£ºmerge({},source)¡£


lodash ºÍ Hoek ÊÇÒ×ÊܵݹéºÏ²¢¹¥»÷Ó°Ïì¡£


°´Â·¾¶½ç˵ÊôÐÔ


ÓÐһЩ JavaScript ¿âʹÓà API ƾ֤¸ø¶¨Â·¾¶½ç˵¹¤¾ßµÄÊôÐÔÖµ¡£Í¨³£ÊÜÓ°ÏìµÄº¯Êý°üÀ¨´ËÊðÃû£ºtheFunction(object, path, value)

ÈôÊǹ¥»÷Õß¿ÉÒÔ¿ØÖÆ¡°Â·¾¶¡±µÄÖµ £¬Ôò¿ÉÒÔ½«´ËÖµÉèÖÃΪ_proto_.myValue¡£

·À·¶´ëÊ©


¶³½á  Object.prototype  £¬Ê¹Ô­ÐͲ»¿ÉÀ©³äÊôÐÔ

½¨Éè JSON schema

¹æ±Ü²»Çå¾²µÄµÝ¹éÐԺϲ¢º¯Êý

ʹÓÃÎÞÔ­Ð͹¤¾ß £¬Í»ÆÆÔ­ÐÍÁ´²¢±ÜÃâÎÛȾ¡£

½ÓÄÉÐ嵀 Map Êý¾ÝÀàÐÍ £¬È¡´ú Object ÀàÐÍ


ËäȻԭÐÍÎÛȾÎó²îÓ°ÏìºÜÊÇÑÏÖØ £¬¿ÉÊǹ¥»÷ÕßÏëҪʹÓÃËü²¢Ã»ÓÐÄÇôÈÝÒ× £¬ËûÃÇÐèÒªÉîÈëÏàʶÿ¸ö Web Ó¦ÓõÄÊÂÇéÔ­Àí¡£

ÐÞ¸´½¨Òé


½¨ÒéÉý¼¶lodashµ½4.17.12


²Î¿¼Á´½Ó


https://snyk.io/blog/snyk-research-team-discovers-severe-prototype-pollution-security-vulnerabilities-affecting-all-versions-of-lodash/
https://snyk.io/vuln/SNYK-JS-LODASH-450202
https://snyk.io/blog/snyk-research-team-discovers-severe-prototype-pollution-security-vulnerabilities-affecting-all-versions-of-lodash/
https://snyk-rules-pre-repository.s3.amazonaws.com/snapshots/master/patches/npm/lodash/20190702/lodash_20190702_0_0_1f8ea07746963a535385a5befc19fa687a627d2b.patch