LinuxÄÚºËTCPÐÒé¶à¸öSACK¹¦Ð§¾Ü¾ø·þÎñÎó²îÆÊÎö
Ðû²¼Ê±¼ä 2019-06-212019Äê6ÔÂ18ÈÕ£¬RedhatÐû²¼Ç徲ͨ¸æ£¬LinuxÄÚºËTCP/IPÐÒéÕ»±£´æ3¸öÇå¾²Îó²î£¨CVE-2019-11477/CVE-2019-11478/CVE-2019-11479£©£¬ÕâЩÎó²îÓë×î´ó·Ö¶Î´óС£¨MSS£©ºÍTCPÑ¡ÔñÐÔÈ·ÈÏ£¨SACK£©¹¦Ð§Ïà¹Ø£¬ÔÊÐíÔ¶³Ì¹¥»÷Õß¾ÙÐоܾø·þÎñ¹¥»÷¡£
Òªº¦¿´·¨
Êý¾Ý°üÖØ´«È·ÈÏ»úÖÆ
TCPÊý¾Ý°ü´«ÊäÀú³ÌÖУ¬À´×Ô»¬¶¯´°¿ÚµÄÊý¾Ý°üɥʧ¿ÉÄܶÔTCPÍÌÍÂÁ¿±¬·¢Ó°Ïì¡£TCPʹÓÃÀÛ»ýÈ·ÈÏ£¨ACK£©¼Æ»®½â¾ö¸ÃÎÊÌ⣬ÆäÖв»ÎüÊÕ²»ÔÚ»¬¶¯´°¿Ú×ó±ßÑصÄÎüÊնΣ¬Õâ»áÇ¿ÖÆ·¢ËÍ·½ÆÚ´ýÍù·µÊ±¼äÒÔÕÒ³öÿ¸öɥʧµÄÊý¾Ý°ü£¬»òÕß²»ÐëÒªµØÖØд«ÊäÒÑ׼ȷÎüÊյĶΣ¬´Ó¶ø½µµÍÕûÌåÍÌÍÂÁ¿¡£
×î´ó·Ö¶Î´óС£¨Maximum Segment Size£©
MSS£¨Maximum Segment Size£¬×î´ó±¨ÎĶδóС£©µÄ¿´·¨ÊÇÖ¸TCP²ãËùÄܹ»ÎüÊÕµÄ×î´ó·Ö¶Î¾Þϸ£¬¸ÃÖµÖ»°üÀ¨TCP¶ÎµÄÊý¾Ý²¿·Ö£¬²»°üÀ¨Option²¿·Ö¡£ÁíÍ⣬ÔÚTCPÊײ¿ÓÐÒ»¸öMSSÑ¡ÏÔÚÈý´ÎÎÕÊÖÀú³ÌÖУ¬TCP·¢ËͶËʹÓøÃÑ¡Ïî¸æË߶Է½×Ô¼ºËùÄܽÓÊܵÄ×î´ó·Ö¶Î¾Þϸ¡£
TSO£¨TCP Segmentation Offload£©
TSOÊÇÒ»ÖÖʹÓÃÍø¿¨À´¶Ô´óÊý¾Ý°ü¾ÙÐÐ×Ô¶¯·Ö¶Î£¬½µµÍCPU¸ºÔصÄÊÖÒÕ¡£ÆäÖ÷ÒªÊÇÑӳٷֶΡ£
GSO(Generic Segmentation Offload)
Îó²îÔÀí
CVE-2019-11477
¸Ãtcp_skb_cb½á¹¹Ìå´æ·Å×ÅTCPÿ¸öÊý¾Ý°üµÄ¿ØÖÆÐÅÏ¢£¬Æ¾Ö¤×¢ÊÍ¿ÉÖª£¬tcp_gso_segs/sizeÖ»ÓÃÓÚдÐÐÁÐÀú³ÌÖС£
½á¹¹Ìå×îºóÒ»¸ö³ÉÔ±ÊÇfrags[MAX_SKB_FRAGS]Êý¾Ý¡£MAX_SKB_FRAGSÉùÃ÷ÈçÏÂËùʾ£º
Êý¾Ý·ÖƬskb_frag_struct½á¹¹ÌåÈçÏÂËùʾ£º
ÔÚÕû¸öÐÒéÕ»²Ù×÷Àú³ÌÖУ¬Êý¾Ý°ü¼ÈÒª¾ÙÐÐIP±»·ÖƬµÄ£¬ÓÖÒª¾ÙÐÐTCP·Ö¶Î¡£´«ÊäÊý¾Ýʱ£¬ÐÒéÕ»»áƾ֤GSOÖµ£¬MSSÖµÒÔ¼°»¬¶¯´°¿ÚÈýÕßÖ®¼äµÄ¾Þϸ¹ØϵÅжÏÊÇ·ñ¾ÙÐзÖƬ¡£²¢Í¨¹ýtcp_set_skb_tso_segs()º¯ÊýÉèÖÃGSO£¬ÏêϸʵÏÖÈçÏÂͼËùʾ£º
ÈôÊÇskb->len´óÓÚmss_now£¬ÐÐ1207£¬½«tcp_gso_segsÉèÖÃΪskb->len/mss_now¡£ÐÐ1208£¬½«tcp_gso_sizeÉèÖÃΪmss_now¡£
ÈôÊÇÆôÓÃÁËSACK£¬ÔÚ±¬·¢¶ª°üºó£¬ÎüÊն˻᷵»ØSACK¿é£¬SACK¿éÖмͼ×Åɥʧ°üµÄÐòÁбàºÅ¡£·¢ËͶ˻áÆÊÎöSACK¿éÖмͼµÄɥʧ°üÐòÁбàºÅ£¬²¢ÖØд«Ê䣬²¢ÇÒÔÚÒ»¸ö»¬¶¯´°¿ÚÖпÉÄÜ°üÀ¨¶à¸öSACK¿é£¬SACK¿éÖÐÒ²¿ÉÄÜ°üÀ¨¶à¸öskbÐÐÁС£ÔÚTCPÖØ´«Êý¾Ý°üÀú³ÌÖУ¬¿ÉÒÔ½«¶à¸öskbÐÐÁкϲ¢µ½Ò»¸öskbÐÐÁÐÖоÙÐÐÖØ´«¡£
skb_shift()ºÍtcp_shifted_skb()Á½¸öº¯ÊýÖ÷ҪʵÏָù¦Ð§¡£ÖØ´«Àú³ÌÖжà¸öskbÐÐÁкϲ¢µ½Ò»¸öskbÐÐÁÐÖУ¬ÈôÊÇÌî³ä17¸ö·ÖƬµ½×î´óÈÝÁ¿£¬ 17*32*1024/8=69632£¬ÒѾ´óÓÚ65535£¬µ¼ÖÂÎÞ·ûºÅÕûÊýÒç³ö¡£
ÐÐ1299£¬ÅжÏtcp_gso_segsºÍpcountµÄ¾Þϸ£¬ÈôÊÇtcp_gas_segsСÓÚpcount£¬BUG_ON¶ÏÑÔ´¥·¢µ¼ÖÂÄÚºËÍ߽⡣
²¹¶¡Öл®·ÖÅжÏÁËskb->len+shift_len²»¿É´óÓÚ65535*8×Ö½ÚºÍtcp_skb_pcount(to) + pcount²»¿É´óÓÚ65535¡£µÚÒ»¸öÅжϣ¬skb->lenÊÇÌåÏÖsk_buff½á¹¹ÌåÖÐÌåÏÖpayload³¤¶È£¬shift_lenÌåÏÖÒªºÏ²¢µ½skbÖеÄpayload¡£
CVE-2019-11478
²¹¶¡ÔÚtcp_fragment()º¯ÊýÖмÓÈëÁË×îС¿Õ¼äÅжϡ£SkÊÇsock½á¹¹ÌåÀàÐÍ£¬Ã¿Ò»¸ötcpÁ´½Ó¶ÔÓ¦Ò»¸ö¡£ÒÔÊÇËùÓÐÒª·¢Ë͵ÄskbÊý¾Ý¾Þϸ¶¼ÒªÀÛ¼Óµ½sk->sk_wmem_queuedÖУ¬sk->sk_wmem_queuedÌåÏÖΪ¸ÃÌ×½Ó×ÖTCPдÐÐÁлº³åÇø¾Þϸ¡£Í¨³£ÔÚʹÓÃʱ¼äÐèÒªÅжϸÃÖµÊÇ·ñ¹»Óá£ÈçÏÂËùʾ£º
ƾ֤עÊÍ¿ÉÖª£¬ÅжÏ×îÐÂÅŶÓskb°üËùÐèµÄ×îС¿Éд¿Õ¼ä¡£²¹¶¡ÖУ¬ÅжÏÊ£Óà·¢ËÍ»º´æΪ´óÓÚ¼´ÊÇÄ¿½ñ·¢ËÍÐÐÁÐÕ¼ÓÿռäµÄÒ»°ë£¬¼´ÉÐÓÐ1/3ÒÔÉϵĿÕÓà¿Õ¼äʱ£¬²¢ÇÒСÓÚsk->sk_sndbuf·¢ËÍÉÏÏ޲ſÉÒÔÕý³£·¢ËÍ£¬²»È»¾ÍÅжÏTCPдÐÐÁÐÌ«´ó¡£
CVE-2019-11479
×èÖ¹Á˹¥»÷ÕßʹÓü«Ð¡MSSÖµ¡£
Ó°Ïì°æ±¾¼°²¹¶¡ÐÞ¸´
ʵʱ¸üÐÂ×îв¹¶¡»ò½ûÓÃSACKºÍ¹ýÂ˼«Ð¡MSSµÄÊý¾Ý°ü¡£
CVE-2019-11477 |
Ó°Ïì°æ±¾£º
|
½ûÓÃsack£º
|
|
²¹¶¡£º
|
|
CVE-2019-11478 |
Ó°Ïì°æ±¾£º
|
½ûÓÃsack£º
|
|
²¹¶¡£º
|
|
CVE-2019-11479 |
Ó°Ïì°æ±¾£º
|
¹ýÂËÏÂÁ
¹Ø±Õtcp_mtu_probing£º
|
|
²¹¶¡£º
|