VNC mode can crash QEMU

2009.10.26
Risk: High
Local: No
Remote: Yes
CWE: CWE-399


CVSS Base Score: 8.5/10
Impact Subscore: 10/10
Exploitability Subscore: 6.8/10
Exploit range: Remote
Attack complexity: Medium
Authentication: Single time
Confidentiality impact: Complete
Integrity impact: Complete
Availability impact: Complete

On Sun, 2009-05-24 at 22:08 +0200, Stefan Weil wrote: > Hello, > > this scenario crashs the latest QEMU HEAD on Windows > (Linux users, please note that the bug is not Windows related, > so don't stop reading!): > > * run qemu.exe -vnc :0 > * connect using UltraVnc > * select fuzzy screen mode in UltraVnc > > => segfault of qemu.exe > > The crash is caused by VNC protocols which are unsupported > by QEMU - in my case it was the fuzzy screen mode protocol. > These protocols trigger a call stack which releases the > VncState vs: > > qemu_free(vs) > vnc_client_io_error(vs, ...) > vnc_client_error(vs, ...) > protocol_client_msg(vs, ...) > vnc_client_read > main_loop_wait > main_loop > > The default handlers for unimplemented protocols in > protocol_client_msg call vnc_client_error which finally > calls qemu_free for the current VncState vs. > > vs is then used in protocol_client_msg and vnc_client_read > although it is no longer valid. On Windows, this results > in a crash, for other host platforms, the result depends > on implementation details of the C library. > > In any case, access to a data structure after a free() > is a bug. Yep, I looked into a similar report recently: https://bugzilla.redhat.com/show_bug.cgi?id=501131 Basically, vnc_flush() or vnc_update_client() will handle an error by freeing VncState, yet we will not detect this error and happily continue on using the freed VncState. The approach I tried in the patch attached to the bug isn't going to work, I think. Instead, we should just mark the VncState with a "deleted" flag on I/O error and only free it later on when the in-progress protocol step has completed. Cheers, Mark.

References:

https://bugzilla.redhat.com/show_bug.cgi?id=508567
https://bugzilla.redhat.com/show_bug.cgi?id=505641
https://bugzilla.redhat.com/show_bug.cgi?id=501131
http://www.openwall.com/lists/oss-security/2009/10/16/8
http://www.openwall.com/lists/oss-security/2009/10/16/5
http://rhn.redhat.com/errata/RHEA-2009-1272.html
http://marc.info/?l=qemu-devel&m=124324043812915
http://git.savannah.gnu.org/cgit/qemu.git/commit/?id=753b405331
http://git.savannah.gnu.org/cgit/qemu.git/commit/?id=198a0039c5


Vote for this issue:
50%
50%


 

Thanks for you vote!


 

Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.


(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2021, cxsecurity.com

 

Back to Top