[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/23] virtio-net: fix buffer overflow on invali
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 01/23] virtio-net: fix buffer overflow on invalid state load |
Date: |
Tue, 3 Dec 2013 18:47:20 +0000 |
On 3 December 2013 16:28, Michael S. Tsirkin <address@hidden> wrote:
> CVE-2013-4148 QEMU 1.0 integer conversion in
> virtio_net_load()@hw/net/virtio-net.c
>
> Deals with loading a corrupted savevm image.
>
>> n->mac_table.in_use = qemu_get_be32(f);
>
> in_use is int so it can get negative when assigned 32bit unsigned value.
>
>> /* MAC_TABLE_ENTRIES may be different from the saved image */
>> if (n->mac_table.in_use <= MAC_TABLE_ENTRIES) {
>
> passing this check ^^^
>
>> qemu_get_buffer(f, n->mac_table.macs,
>> n->mac_table.in_use * ETH_ALEN);
>
> with good in_use value, "n->mac_table.in_use * ETH_ALEN" can get
> positive and bigger than mac_table.macs. For example 0x81000000
> satisfies this condition when ETH_ALEN is 6.
>
> A similar problem exists with is_multi.
You mean "first_multi" (though given how the load function
sets first_multi I'm not sure how it can ever get a negative
value.)
> Fix both by making the value unsigned.
Did you audit all the uses of these fields to confirm that
making them unsigned didn't cause any issues due to
arithmetic, comparisons, etc becoming unsigned rather than
signed operations?
A safer fix would seem to be to just fix the check in the
load function to refuse negative values as well as overlarge ones.
thanks
-- PMM
- [Qemu-devel] [PATCH 00/23] qemu state loading issues, Michael S. Tsirkin, 2013/12/03
- [Qemu-devel] [PATCH 01/23] virtio-net: fix buffer overflow on invalid state load, Michael S. Tsirkin, 2013/12/03
- Re: [Qemu-devel] [PATCH 01/23] virtio-net: fix buffer overflow on invalid state load,
Peter Maydell <=
- [Qemu-devel] [PATCH 02/23] virtio-net: out-of-bounds buffer write on load, Michael S. Tsirkin, 2013/12/03
- [Qemu-devel] [PATCH 03/23] virtio-net: out-of-bounds buffer write on invalid state load, Michael S. Tsirkin, 2013/12/03
- [Qemu-devel] [PATCH 05/23] ahci: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2013/12/03
- [Qemu-devel] [PATCH 06/23] hpet: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2013/12/03
- [Qemu-devel] [PATCH 07/23] hw/pci/pcie_aer.c: fix buffer overruns on invalid state load, Michael S. Tsirkin, 2013/12/03