Bug 1594054 (CVE-2018-12617)

Summary: CVE-2018-12617 Qemu: qemu-guest-agent: Integer overflow causes segmentation fault in qmp_guest_file_read()
Product: [Other] Security Response Reporter: Sam Fowler <sfowler>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: ailan, amit, apevec, areis, berrange, cfergeau, chrisw, dwmw2, itamar, jen, jjoyce, jschluet, knoel, lhh, lpeer, markmc, mburns, mkenneth, mrezanin, mst, pbonzini, philmd, ppandit, rbalakri, rbryant, rjones, sclewis, sfowler, slinaber, srevivo, tdecacqu, virt-maint, virt-maint, vrozenfe
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-25 09:45:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1594055, 1594056, 1639975, 1644530, 1645015, 1645016, 1645018    
Bug Blocks: 1585523    

Description Sam Fowler 2018-06-22 00:47:19 UTC
The QEMU Guest Agent in QEMU is vulnerable to an integer overflow in the 
qmp_guest_file_read(). An attacker could exploit this by sending a crafted QMP 
command (including guest-file-read with a large count value) to the agent via 
the listening socket to trigger a g_malloc() call with a large memory chunk 
resulting in a segmentation fault.

A user could use this flaw to crash the QEMU guest agent process resulting in DoS.

Upstream Patch:
---------------
  -> https://git.qemu.org/?p=qemu.git;a=commit;h=141b197408ab398c4f474ac1a728ab316e921f2b

References:
-----------
  -> https://www.openwall.com/lists/oss-security/2018/10/17/4
  -> https://gist.github.com/fakhrizulkifli/c7740d28efa07dafee66d4da5d857ef6

Comment 1 Sam Fowler 2018-06-22 00:48:20 UTC
Created qemu tracking bugs for this issue:

Affects: fedora-all [bug 1594055]

Comment 3 Joshua Padman 2018-07-25 11:45:45 UTC
The builds of qemu-kvm-rhev used by OpenStack do not have building of the guest agent enabled. Therefore the vulnerable code is not built and shipper to customers.

Comment 5 Prasad Pandit 2018-10-17 04:15:39 UTC
Acknowledgments:

Name: Fakhri Zulkifli

Comment 15 Philippe Mathieu-Daudé 2020-04-16 06:34:31 UTC
This issue is fixed by upstream commits 5d3586b834..1329651fb4:

- 1329651fb4 qga: Restrict guest-file-read count to 48 MB to avoid crashes
- ead83a136d qga: Extract qmp_guest_file_read() to common commands.c
- 5d3586b834 qga: Extract guest_file_handle_find() to commands-common.h

Comment 16 Philippe Mathieu-Daudé 2020-04-16 06:35:30 UTC
This issue is fixed by upstream commits 5d3586b834..1329651fb4:

- 5d3586b834 qga: Extract guest_file_handle_find() to commands-common.h
- ead83a136d qga: Extract qmp_guest_file_read() to common commands.c
- 1329651fb4 qga: Restrict guest-file-read count to 48 MB to avoid crashes