SecurityReason.com - Our Reason is

Security

Register | Forget Password | Login
SecurityReason
WLB
Services
RSS
Corporate
Note

If you have found a vulnerability, please send to our SecurityAlert Database :
secalert()securityreason()com

Also if you have new ( 0-day ) exploit, please send to our ExploitAlert Archive :
exploit()securityreason()com

Home arrow SecurityAlert Database

Arrow  Topic :

Buffer-overflow in Ultr@VNC 1.0.1 viewer and server


Arrow  SecurityAlert : 674
Arrow  CVE : CVE-2006-1652
Arrow  SecurityRisk : High  Security Risk High  (About)
Arrow  Remote Exploit : Yes
Arrow  Local Exploit : Yes
Arrow  Exploit Available : Yes
Arrow  Credit : Luigi Auriemma (aluigi autistici org)
Arrow  Published : 05.04.2006

Arrow  Affected Software : Ultr@VNC 1.0.1



Arrow  Advisory Content :  

#######################################################################

Luigi Auriemma

Application: Ultr@VNC
http://www.ultravnc.com
http://ultravnc.sourceforge.net
Versions: <= 1.0.1 (and current CVS)
(tabbed_viewer 1.29 is ever the same VNC viewer 1.0.1 and
so it's vulnerable too)
Platforms: Windows
Bugs: A] client Log::ReallyPrint buffer-overflow
B] server VNCLog::ReallyPrint limited buffer-overflow
Exploitation: A] remoto, versus client
B] remoto, versus server
Date: 04 Apr 2006
Author: Luigi Auriemma
e-mail: aluigi (at) autistici (dot) org [email concealed]
web: http://aluigi.altervista.org

#######################################################################

1) Introduction
2) Bugs
3) The Code
4) Fix

#######################################################################

===============
1) Introduction
===============

Ultr@VNC is a well known open source VNC server and viewer for Windows
very easy to use and configure.

#######################################################################

=======
2) Bugs
=======

------------------------------------------
A] client Log::ReallyPrint buffer-overflow
------------------------------------------

During the login process a VNC client can receive three types of
replies from the server: connection failed, no authentication and
authentication required.
The first type of reply (rfbConnFailed) is followed by a text string
containing the reason of the disconnection.
Before visualizing this message Ultr@VNC logs everything in the log
file using the vnclog.Print function which adopts a buffer of 1024
bytes (LINE_BUFFER_SIZE) for storing the text.
The result is that a malicious VNC server could be able to execute
malicious code versus a vulnerable Ultr@VNC client which connects to
it.

From vncviewer/Log.cpp:

void Log::ReallyPrint(LPTSTR format, va_list ap)
{
TCHAR line[LINE_BUFFER_SIZE];
_vstprintf(line, format, ap);
if (m_todebug) OutputDebugString(line);

if (m_toconsole) {
DWORD byteswritten;
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), line,
_tcslen(line)*sizeof(TCHAR), &byteswritten, NULL);
};

if (m_tofile && (hlogfile != NULL)) {
DWORD byteswritten;
WriteFile(hlogfile, line, _tcslen(line)*sizeof(TCHAR),
&byteswritten, NULL);

}
}

-----------------------------------------------------
B] server VNCLog::ReallyPrint limited buffer-overflow
-----------------------------------------------------

The logging function used by the Ultr@VNC server is affected by a
limited buffer-overflow caused by two strcat calls which add a Windows
error message to the output buffer.
Anyway there is an important detail about the exploitation of this bug.
The server is not vulnerable if the admin doesn't touch the "Log debug
infos to the WinVNC.log file" flag in the configuration, but when the
admin enables this option his server will be vulnerable forever
although he will re-disable it.

From winvnc/winvnc/vnclog.cpp:

void VNCLog::ReallyPrint(const char* format, va_list ap)
{
time_t current = time(0);
if (current != m_lastLogTime) {
m_lastLogTime = current;
ReallyPrintLine(ctime(&m_lastLogTime));
}

// - Write the log message, safely, limiting the output buffer size
TCHAR line[LINE_BUFFER_SIZE];
TCHAR szErrorMsg[LINE_BUFFER_SIZE];
DWORD dwErrorCode = GetLastError();
SetLastError(0);
FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(char *)&szErrorMsg,
LINE_BUFFER_SIZE, NULL);
_vsnprintf(line, LINE_BUFFER_SIZE, format, ap);
strcat(line," --");
strcat(line,szErrorMsg);

ReallyPrintLine(line);
}

#######################################################################

===========
3) The Code
===========

http://aluigi.altervista.org/poc/uvncbof.zip

#######################################################################

======
4) Fix
======

A patch will be released in the next weeks.

#######################################################################

---
Luigi Auriemma
http://aluigi.altervista.org





Arrow  Feedback :

If you have additional information or notice any errors regarding this security advisory, please use contact form or email us at info()securityreason()com.
Alert

libc:fts_*() Multiple Denial of Service

Security Risk Medium- 2009-10-02

The fts functions are provided for traversing UNIX file hierarchies...

Apache RSS Apache Alert

» Apache 1.3.41 mod_proxy
   Integer overflow (code
   execution)

» Apache Tomcat 6.0.20 and
   5.5.28 unexpected file
   deletion in work
   directory

» Apache Tomcat 6.0.20 and
   5.5.28 insecure partial
   deploy after failed
   undeploy

» Apache Tomcat 6.0.20 and
   5.5.28 unexpected file
   deletion and/or
   alteration

PHP RSS PHP Alert

» PHP 5.2.12/5.3.1
   session.save_path
   safe_mode and
   open_basedir bypass

» PHP 5.2.12/5.3.1 Multiple
   Vulnerabilities

» PHP 5.2.11 libgd multiple
   vulnerabilities

» PHP 5.2.11 tempnam()
   safe_mode bypass

Copyright © SecurityReason.com. All Rights Reserved.