Bug 1031 - CVE-2022-2132
Summary: CVE-2022-2132
Status: RESOLVED FIXED
Alias: None
Product: DPDK
Classification: Unclassified
Component: vhost/virtio (show other bugs)
Version: unspecified
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Security Team
URL:
Depends on:
Blocks:
 
Reported: 2022-06-09 16:07 CEST by Cheng Jiang
Modified: 2022-08-29 20:14 CEST (History)
6 users (show)



Attachments
Virtio PMD based reproducer (6.22 KB, patch)
2022-06-22 09:44 CEST, Maxime Coquelin
Details | Diff
CVE-2022-2132 fix v1 (10.00 KB, application/x-tar)
2022-06-22 09:51 CEST, Maxime Coquelin
Details
CVE-2022-2132 fix v1 with LTS backports (40.00 KB, application/x-tar)
2022-07-21 19:24 CEST, Maxime Coquelin
Details
CVE-2022-2132 fix v2 with LTS backports (40.00 KB, application/x-tar)
2022-08-23 17:17 CEST, Maxime Coquelin
Details

Description Cheng Jiang 2022-06-09 16:07:01 CEST
Dear all:
      In copy_desc_to_mbuf function, the vhost header was assumed not across more than two descs.
      if (unlikely(buf_len < dev->vhost_hlen)) {
            buf_offset = dev->vhost_hlen - buf_len;
            vec_idx++;
            buf_addr = buf_vec[vec_idx].buf_addr;
            buf_iova = buf_vec[vec_idx].buf_iova;
            buf_len = buf_vec[vec_idx].buf_len;
            buf_avail  = buf_len - buf_offset;
      } else if ...
      
      If a malicious guest send a packet with the vhost header acrossing more then two descs, 
      the buf_avail will be overflow to a very large number near 4G.
      All the mbufs will be allocated, other guests traffic will be blocked.
      
      The following is the experiment steps:
      1. Change the virtio_net.c in guest with centos 7 kernel 3.10.0-1160.62.1, then insmod virtio_net.ko
775,776c775,779
<               sg_set_buf(sq->sg, hdr, hdr_len);
<               num_sg = skb_to_sgvec(skb, sq->sg + 1, 0, skb->len) + 1;
---
>               unsigned char * p = (unsigned char *)hdr;
>               sg_set_buf(sq->sg, p, 1);
>               sg_set_buf(sq->sg + 1, p + 1, 1);
>               sg_set_buf(sq->sg + 2, p + 2, hdr_len - 2);
>               num_sg = skb_to_sgvec(skb, sq->sg + 3, 0, skb->len) + 3;
      2. When the guest send packet via the nic, host will report error:
ERR|VHOST_DATA : (/tmp/centos7-dpdk-sock0) failed to allocate memory for mbuf.
ERR|VHOST_DATA : (/tmp/centos7-dpdk-sock0) failed to copy desc to mbuf.
ERR|VHOST_DATA : (/tmp/centos7-dpdk-sock0) failed to allocate memory for mbuf.
ERR|VHOST_DATA : (/tmp/centos7-dpdk-sock0) failed to allocate memory for mbuf.
      
      I think it's a vulnerability. Please clarify.
Comment 1 Cheng Jiang 2022-06-20 07:44:37 CEST
Maxime confirmed it's a security issue.
The reproducer and the fix patch are ready.
Comment 2 Cheng Jiang 2022-06-20 08:12:10 CEST
CEV request submitted.
Comment 3 Cheng Jiang 2022-06-20 15:41:59 CEST
Get the CVE number which is CVE-2022-2132.
Comment 4 Maxime Coquelin 2022-06-22 09:39:25 CEST
(In reply to Cheng Jiang from comment #3)
> Get the CVE number which is CVE-2022-2132.

Thanks Cheng,

Can you confirm an embargo has been requested,
and if so to which lifting date has it been set?
Comment 5 Maxime Coquelin 2022-06-22 09:44:01 CEST
Created attachment 209 [details]
Virtio PMD based reproducer

This is an alternative reproducer to Kernel's Virtio-net one shared by the reporter.

This reproducer is based on Virtio PMD, and can be used with Virtio-user with Vhost-user backend. Instructions to use it can be found in the commit message.

It has been tested on DPDK v22.07-rc1.
Comment 6 Maxime Coquelin 2022-06-22 09:51:36 CEST
Created attachment 210 [details]
CVE-2022-2132 fix v1

This is a first version of the fix proposed for this vulnerability.
Commit message has yet to be improved, but I'd like to have a first review.
Comment 7 Cheng Jiang 2022-06-22 17:16:29 CEST
(In reply to Maxime Coquelin from comment #4)
> (In reply to Cheng Jiang from comment #3)
> > Get the CVE number which is CVE-2022-2132.
> 
> Thanks Cheng,
> 
> Can you confirm an embargo has been requested,
> and if so to which lifting date has it been set?

Hi, thanks for the patches. I have not set the date yet, and I have replied the email to you and Thomas to ask which date we should use. Thanks.
Comment 8 Cheng Jiang 2022-06-28 07:49:53 CEST
I have set August 28th as the embargo lift date for this issue.
Comment 9 Cheng Jiang 2022-07-07 13:36:19 CEST
Adding Red Hat Product Security contact Nick Tait to the cc list.
Comment 10 ntait 2022-07-09 23:05:06 CEST
Thanks Cheng, please let me know any way that I can assist.
Comment 11 Maxime Coquelin 2022-07-18 21:19:59 CEST
Hi Chenbo,

Could you please help to review the patch set attached?

Thanks,
Maxime
Comment 12 chenbo.xia 2022-07-19 04:30:58 CEST
Hey Maxime,

Patches LGTM. Thanks for the fix!

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Comment 13 Cheng Jiang 2022-07-19 04:50:05 CEST
(In reply to ntait from comment #10)
> Thanks Cheng, please let me know any way that I can assist.

Hi, I have send you the email to change the embargo date to the 29th August. I'm not sure you have received it. Could you please help to confirm that the embargo date has been changed?

Thanks,
Cheng
Comment 14 Christian Ehrhardt 2022-07-19 14:12:14 CEST
In preparation to apply this to the stable branches towards the embargo date I checked and the provided tarball does not apply to 19.11.x right now.

Would you mind preparing a tarball that fits onto https://github.com/cpaelzer/dpdk-stable-queue/tree/19.11 ?

This is probably true for 20.11 and 21.11 LTS streams as well.
Comment 15 ntait 2022-07-19 15:53:43 CEST
Yes, got the updated date saved. Thanks!

~Nick
Comment 16 Maxime Coquelin 2022-07-20 11:15:48 CEST
(In reply to Christian Ehrhardt from comment #14)
> In preparation to apply this to the stable branches towards the embargo date
> I checked and the provided tarball does not apply to 19.11.x right now.
> 
> Would you mind preparing a tarball that fits onto
> https://github.com/cpaelzer/dpdk-stable-queue/tree/19.11 ?
> 
> This is probably true for 20.11 and 21.11 LTS streams as well.

Yes, I was waiting for Chenbo's ACK before proceeding with the backports.
I will do them today and attach them here when ready.
Comment 17 Maxime Coquelin 2022-07-21 19:24:06 CEST
Created attachment 213 [details]
CVE-2022-2132 fix v1 with LTS backports

Hi,

Please find attached a tarball containing CVE fixes for main and LTS branches.
Can Intel QE run validation on them to ensure no regressions are introduced?

Thanks,
Maxime
Comment 18 Cheng Jiang 2022-07-26 17:40:38 CEST
(In reply to Maxime Coquelin from comment #17)
> Created attachment 213 [details]
> CVE-2022-2132 fix v1 with LTS backports
> 
> Hi,
> 
> Please find attached a tarball containing CVE fixes for main and LTS
> branches.
> Can Intel QE run validation on them to ensure no regressions are introduced?
> 
> Thanks,
> Maxime

Adding Xingguang to the cc list for regression test.

Thanks.
Cheng
Comment 19 xingguang.he 2022-08-09 04:13:13 CEST
Hi,

We have finished the regression test based on DPDK LTS19.11.13-rc3lts, LTS20.11.5 and LTS21.11.2-rc1 with patches and found no issue. 

Thanks,
Xingguang
Comment 20 Maxime Coquelin 2022-08-23 17:12:35 CEST
(In reply to xingguang.he from comment #19)
> Hi,
> 
> We have finished the regression test based on DPDK LTS19.11.13-rc3lts,
> LTS20.11.5 and LTS21.11.2-rc1 with patches and found no issue. 
> 
> Thanks,
> Xingguang

Thanks Xingguang
Comment 21 Maxime Coquelin 2022-08-23 17:17:08 CEST
Created attachment 217 [details]
CVE-2022-2132 fix v2 with LTS backports

David found a small issue in the error path in patch 1.
This new archive fixes it and also small comments and commit messages fixes.

We think it does not need to re-run validation, since the existing test cases do not exercise this error path.

The v2 also contain v18.11 backport as we need them for our donwstream releases.

Detailed changelog is available in the commits for the main branch.
Comment 22 Cheng Jiang 2022-08-25 10:45:27 CEST
I've sent the pre-release email.

Thanks,
Cheng

Note You need to log in before you can comment on or make changes to this bug.