LinuxÄÚºËÀ¶ÑÀÐÒéÕ»Îó²î£¨BleedingTooth£©Ê¹ÓÃÆÊÎöÓ븴ÏÖ
Ðû²¼Ê±¼ä 2021-04-16Îó²î¸ÅÊö
2020Äê10Ô£¬¹È¸èÇå¾²Ñо¿Ö°Ô±Åû¶ÁËÈý¸öLinuxÄÚºËÀ¶ÑÀÐÒéÕ»Îó²î£¬¿Éµ¼ÖÂÔ¶³Ì´úÂëÖ´ÐУ¬±»³ÆΪBleedingTooth¡£ÕâÈý¸öÎó²îÖУ¬Ò»¸öÊǶÑÒç³ö£¬±àºÅΪCVE-2020-24490£»ÁíÒ»¸öÊÇÀàÐÍ»ìÏý£¬±àºÅΪCVE-2020-12351£¬×îºóÒ»¸öÊÇÐÅϢй¶£¬±àºÅΪCVE-2020-12352¡£¿ËÈÕ£¬¹È¸èÇå¾²Ñо¿Ö°Ô±ÓÖÅû¶ÁËBleedingToothÖÐCVE-2020-12351ºÍCVE-2020-12352×éºÏµÄÎó²îʹÓü°Ï¸½Ú£¬²¢ÔÚÀ¶ÑÀ4.0Ï£¬ÊµÏÖÁËÁãµã»÷Ô¶³Ì´úÂëÖ´ÐС£
Îó²îÆÊÎö
CVE-2020-12351
¸ÃÎó²î·ºÆðÔÚnet/bluetooth/l2cap_core.cÖС£l2cap_recv_frame()ÊÇÆÊÎöºÍ´¦Öóͷ£l2capÐÒéÊý¾Ý°üµÄº¯Êý¡£´úÂëʵÏÖÈçÏÂËùʾ£º
»ñȡͨµÀcidºÍl2capÊý¾Ý°ü³¤¶Èlen¡£´úÂëʵÏÖÈçÏÂËùʾ£º
ƾ֤²î±ðµÄͨµÀcid£¬½øÈë²î±ðµÄ×ÓÀú³Ì¾ÙÐд¦Öóͷ££¬½øÈël2cap_data_channel()º¯Êý¡£´úÂëʵÏÖÈçÏÂËùʾ£º
Ê×ÏÈ£¬Í¨¹ýcidÕÒµ½Í¨µÀchan£»ÈôÊÇûÓÐÕÒµ½£¬ÅжÏcidÊÇ·ñΪL2CAP_CID_A2MP£»ÈôÊÇÊÇ£¬Å²ÓÃa2mp_channel_create()½¨ÉèÒ»¸öеÄͨµÀchan¡£a2mp_channel_create()º¯ÊýʵÏÖÈçÏÂËùʾ£º
ŲÓÃamp_mgr_create()½¨Éèmgr£¬ÔÚamp_mgr_create()º¯ÊýÖУ¬´úÂëʵÏÖÈçÏÂËùʾ£º
ŲÓÃa2mp_chan_open()½¨ÉèͨµÀchan£¬¸Ãº¯Êý½«³õʼ»¯Ò»²¿·ÖÊý¾Ý£¬´úÂëʵÏÖÈçÏÂËùʾ£º
È罫chan->mode³õʼ»¯ÎªL2CAP_MODE_ERTM¡£chan->data¸³ÖµÎªmgr£¬ÀàÐÍΪstruct amp_mgr¡£Àֳɽ¨Éèa2mpͨµÀ·µ»Øµ½l2cap_data_channel()ÖУ¬´úÂëʵÏÖÈçÏÂËùʾ£º
ƾ֤chan->modeµÄ²î±ð£¬½øÈë²î±ðµÄdata´¦Öóͷ£×ÓÀú³Ì£¬µ±modeΪL2CAP_MODE_ERTMºÍL2CAP_MODE_STREAMINGʱ£¬½øÈël2cap_data_rcv()º¯ÊýÖУ¬´úÂëʵÏÖÈçÏÂËùʾ£º
¸ÃifÌõ¼þÖУ¬»áŲÓÃsk_filter()º¯Êý£¬´Ëʱchan->dataΪ²ÎÊý¡£¶øsk_filter()º¯Êý½ç˵ÈçÏÂËùʾ£º
µÚÒ»¸ö²ÎÊýÀàÐÍΪstruct sock£¬¶øchan->dataÀàÐÍΪstruct amp_mgr£¬±¬·¢ÀàÐÍ»ìÏý¡£
CVE-2020-12352
¸ÃÎó²îÊÇ·ºÆðÔÚa2mpÐÒéÖУ¬Îó²î´úÂëλÓÚnet/bluetooth/a2mp.c£¬¶à¸öº¯ÊýʹÓÃδ³õʼ»¯µÄ½á¹¹Ì壬½«Êý¾Ý·µ»Øµ½Óû§²ã£¬µ¼ÖÂÐÅϢй¶£¬¿Éй¶ÄÚºËÕ»ÉϵÄÄÚ´æÊý¾Ý¡£Îó²îÔÀí½ÏΪ¼òÆÓ£¬ÒÔa2mp_getinfo_req()º¯ÊýΪÀý£¬¸Ãº¯ÊýÊÇÏìÓ¦getinfoÇëÇóʱŲÓõģ¬´úÂëʵÏÖÈçÏÂËùʾ£º
ÐÐ304£¬Í¨¹ýreq->id»ñÈ¡hdev£¬ÈôÊDz»±£´æhdev»òhdev->type²»ÊÇHCI_AMP£¬½øÈëifÓï¾äÖУ¬½ç˵struct a2mp_info_rspÀàÐ굀 rsp£¬¸Ã½á¹¹Ìå½ç˵ÈçÏÂËùʾ£º
ÆäֻʹÓÃÁËrsp.idºÍrsp.status£¬ÆäËûµÄÊý¾ÝÓòδʹÓÃҲδ³õʼ»¯£¬¿ÉÒÔй¶16×Ö½ÚÊý¾Ý£¬È»ºóŲÓÃa2mp_send()º¯Êý½«ÏìÓ¦°ü·¢Ë͵½Óû§²ã£¬Ð¹Â¶ÄÚ´æÊý¾Ý¡£
CVE-2020-24490
¸ÃÎó²îÖ»ÄÜÔÚbluetooth 5.0Ï´¥·¢£¬ÔÚbluetooth 5.0֮ǰ£¬HCI¾ÙÐй㲥µÄ×î´óÊý¾Ý³¤¶ÈΪ0x1F£¬0x20-0xFF±£´æ¡£ÈçÏÂËùʾ£º
ÔÚbluetooth 5.0ÖУ¬¸Ãlength×î´óÀ©Õ¹µ½229×Ö½Ú¡£ÈçÏÂËùʾ£º
¸ÃÎó²î´úÂëλÓÚnet/bluetooth/hci_event.cÖУ¬ÔÚ´¦Öóͷ£HCI_LE_Extended_Advertising_ReportÊÂÎñÖУ¬Î´ÅжϹ㲥Êý¾Ý³¤¶È×î´óÖµ£¬ºóÐø¿½±´¹ã²¥Dataµ¼ÖÂÒç³ö¡£Å²ÓÃÀú³ÌÈçÏÂËùʾ£º
process_adv_report()º¯Êý´¦Öóͷ£¹ã²¥Êý¾Ý£¬½«¹ã²¥Êý¾Ý¿½±´µ½·¢Ã÷µÄ×°±¸ÖУ¬´úÂëʵÏÖÈçÏÂËùʾ£º
ŲÓÃstore_pending_adv_report()º¯Êý£¬¸Ãº¯ÊýʵÏֹ㲥Êý¾Ý¿½±´£¬´úÂëʵÏÖÈçÏÂËùʾ£º
ÆäÖУ¬discovery_state½á¹¹Ìå½ç˵ÈçÏÂËùʾ£º
last_adv_dataÊý¾Ý¾ÞϸΪHCI_MAX_AD_LENGTH£¬¹²31×Ö½Ú£¬µ±Ö´ÐÐmemcpyʱ±¬·¢Òç³ö¡£
ʹÓÃÆÊÎöÓ븴ÏÖ
¿ØÖÆ´úÂëÖ´ÐÐÁ÷³Ì
Ç°ÎÄÆÊÎöµ½CVE-2020-12351ÀàÐÍ»ìÏýÊÇÔÚsk_filter()º¯ÊýÖб¬·¢µÄ£¬sk_filter()º¯ÊýŲÓÃsk_filter_trim_cap()º¯Êý£¬¸Ãº¯Êý´úÂëʵÏÖÈçÏ£º
¸Ãº¯ÊýµÚÒ»¸ö²ÎÊýΪsk£¬²ÎÊýÀàÐÍΪsock½á¹¹Ì壬Õⲿ·Ö´úÂëÖжÔskºÍskbµÄ¼ì²éÈÝÒ×Èƹý¡£½ÓÏÂÀ´Òªº¦´úÂëÈçÏÂËùʾ£º
ÐÐ113£¬¶Ôsk->sk_filter¾ÙÐнâÒýÓã¬ÈôÊÇÀֳɻñÈ¡filterÖ¸Õ룬½øÈëÐÐ115¡£ÐÐ119£¬Å²ÓÃbpf_prog_run_save_cb()º¯Êý£¬²ÎÊý»®·ÖΪfilter->progºÍskb£¬¸Ãº¯Êý´úÂëʵÏÖÈçÏÂËùʾ£º
È»ºó£¬ÐÐ676£¬Å²ÓÃ__bpf_prog_run_save_cb()º¯Êý£¬¸Ãº¯ÊýʵÏÖ´úÂëÈçÏ£º
½Ó×Å£¬ÐÐ662£¬Å²ÓÃBPF_PROG_RUN(prog,skb)£¬¸Ãº¯Êý½ç˵Ϊһ¸öºê£¬ÊµÏÖ´úÂëÈçÏÂËùʾ£º
Ò»ÆðŲÓÃÏÂÀ´£¬×îÖÕ»áŲÓõ½ºì¿òÖеĴúÂ룬¼ò»¯Ò»ÏÂŲÓÃÀú³ÌΪ£º
sk->sk_filter->prog->bpf_func(skb, sk->sk_filter->prog->insnsi)¡£Òò´Ë£¬Ö»Òª¿ØÖÆsk->sk_filter¾Í¿ÉÒÔ¿ØÖÆÖ´ÐÐÁ÷³Ì¡£
¶ÑÅçռλ
º¯Êýsk_filter()µÄµÚÒ»¸ö²ÎÊýÀàÐÍΪstruct sock£¬¶øÏÖʵ´«ÈëµÄ²ÎÊýÀàÐÍΪstruct amp_mgr£¬¿ÉÒÔ½ÓÄɶÑÅç128¾ÞϸµÄÄÚ´æ¿é¾ÙÐÐռλ£¬Î±Ôìamp_mgr ¹¤¾ß¡£ÕâÀïÓиöÎÊÌ⣬sk->sk_filterÔÚsockÖеÄÆ«ÒÆΪ0x110£¬¶øamp_mgr½á¹¹Ìå¾ÞϸΪ0x70£¬Æ«ÒÆÒѾÁè¼ÝÁ˹æÄ£¡£Òª½â¾öÕâ¸öÎÊÌ⣬ÕâÀï¿ÉÒÔ½ÓÄÉÈçÏÂÇÉÃîµÄ¶ÑÅç½á¹¹£º
½á¹¹Ìåamp_mgrÔÚkmalloc-128ÀàÐ͵ÄslubÖб»·ÖÅÉ£¬´ÓµÚÈý¸ö¿é×îÏÈ£¬amp_mgr½á¹¹ÌåÆ«ÒÆ0x10´¦£¬¿ÉÒÔ±»Î±Ôì³Ésk_filter£¬±ã¿ÉÒÔÖª×ãsk¶Ôsk_filterÓòµÄ½âÒýÓ㬲¢ÇÒ¿É¿Ø¡£
½á¹¹ÔغÉ
ͨ¹ý¶ÑÅçռλ¿ØÖÆ´úÂëÖ´ÐÐÁ÷³Ìºó£¬½ÓÏÂÀ´¾ÍÊǽṹ¹¥»÷Ôغɡ£¿ÉÒÔ½ÓÄɶÑÅç1024¾ÞϸµÄÄÚ´æ¿éȥαÔìl2cap_chan¹¤¾ß£¬ÓÉÓڽṹÌå¾ÞϸΪ792£¬ÕýºÃÂäÔÚkmalloc-1024 slub¿éÖУ¬²¢ÇÒa2mpͨµÀÒ²ÊôÓÚl2capͨµÀÖУ¬ÊÍ·Åa2mpͨµÀʱ£¬l2capͨµÀÒ²½«±»ÊÍ·Å£¬²Ù¿ØÆðÀ´½ÏΪÎÞа£¬×îÖսṹÈçÏÂËùʾ£º
й¶l2cap_chan¹¤¾ßµØµã
ͨ¹ý¶ÑÅç½á¹¹ºÍ½¨ÉèÊÍ·Ål2cap_chanͨµÀµÈһϵÁвÙ×÷ºó£¬¿ÉÄܱ£´æÒ»¸öÖ¸Ïòkmalloc-1024ÄÚ´æ¿éµØµãµÄl2cap_chan¹¤¾ß£¬¿ÉÒÔͨ¹ýCVE-2020-12352Îó²îй¶һ¸öÄÚºËÕ»ÉÏÃæµÄÄں˵ص㣬ÈçÏÂͼÖкì¿òËùʾ£º
ͨ¹ý¸ÃÄڵصصã¼õÈ¥Ò»¸ö0x110Æ«ÒƱã¿ÉÒÔÕÒµ½Ò»¸öl2cap_chan¹¤¾ßµØµã£¬¿ÉÒÔͨ¹ýamp_mgr½á¹¹ÌåÄÚ´æµØµã¼ì²éÒ»ÏÂÊÇ·ñ׼ȷ£¬ÓÉÓÚamp_mgr½á¹¹ÌåÆ«ÒÆ0x18´¦Îªl2cap_chanÖ¸Õ룬ÈçÏÂͼÖкì¿òËùʾ£º
ÀÖ³Éй¶l2cap_chan¹¤¾ßµØµãºó£¬È»ºóÈ¥Ìî³äamp_mgr½á¹¹ÌåÆ«ÒÆ0x10´¦µÄÊý¾ÝÓò¡£
¸´ÏÖ²âÊÔ
ÎÒÃÇÔÚubuntu 5.4.0-26-genericϵͳϸ´ÏÖ²âÊÔÎó²îʹÓã¬Ö´ÐÐÀú³ÌÈçÏ£º
Àֳɷ´µ¯root¼¶shell£¬ÈçÏÂËùʾ£º
²Î¿¼Á´½Ó£º
[1]https://google.github.io/security-research/pocs/linux/bleedingtooth/writeup
[2]https://github.com/google/security-research/security/advisories/GHSA-ccx2-w2r4-x649
[3]https://github.com/google/security-research/security/advisories/GHSA-7mh3-gq28-gfrq
[4]https://github.com/google/security-research/security/advisories/GHSA-h637-c88j-47wq
ÓÅ·¢¹ú¼ÊÍøÕ¾¹ÙÍøÆð¾¢·ÀÓùʵÑéÊÒ£¨ADLab£©
ADLab½¨ÉèÓÚ1999Ä꣬ÊÇÖйúÇå¾²ÐÐÒµ×îÔ罨ÉèµÄ¹¥·ÀÊÖÒÕÑо¿ÊµÑéÊÒÖ®Ò»£¬Î¢ÈíMAPPÍýÏë½¹µã³ÉÔ±£¬¡°ºÚȸ¹¥»÷¡±¿´·¨Ê×ÍÆÕß¡£×èÖ¹ÏÖÔÚ£¬ADLabÒÑͨ¹ýCVEÀÛ¼ÆÐû²¼Çå¾²Îó²î½ü1100¸ö£¬Í¨¹ý CNVD/CNNVDÀÛ¼ÆÐû²¼Çå¾²Îó²î1000Óà¸ö£¬Ò»Á¬¼á³Ö¹ú¼ÊÍøÂçÇå¾²ÁìÓòÒ»Á÷Ë®×¼¡£ÊµÑéÊÒÑо¿Æ«Ïòº¸Ç²Ù×÷ϵͳÓëÓ¦ÓÃϵͳÇå¾²Ñо¿¡¢ÖÇÄÜÖÕ¶ËÇå¾²Ñо¿¡¢ÎïÁªÍøÖÇÄÜ×°±¸Çå¾²Ñо¿¡¢WebÇå¾²Ñо¿¡¢¹¤¿ØϵͳÇå¾²Ñо¿¡¢ÔÆÇå¾²Ñо¿¡£Ñо¿Ð§¹ûÓ¦ÓÃÓÚ²úÆ·½¹µãÊÖÒÕÑо¿¡¢¹ú¼ÒÖصã¿Æ¼¼ÏîÄ¿¹¥¹Ø¡¢×¨ÒµÇå¾²·þÎñµÈ¡£