summaryrefslogtreecommitdiffstats
path: root/recipes-support
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2014-03-25 15:38:22 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-03-25 15:38:22 -0400
commitadf590f2283097b64976936e530084986c203b2b (patch)
tree6cb99bb0647ec5c19f4bf32aec256ae3aa0fc146 /recipes-support
parentdfc85232382af8fee180a83bd33f9d436557b774 (diff)
downloadmeta-cloud-services-adf590f2283097b64976936e530084986c203b2b.tar.gz
meta-cloud-services: introduce spice
A common requirement for many cloud systems is remote console access. Adding spice to the common layer allows a rich console environment to be provided. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-support')
-rw-r--r--recipes-support/spice/files/spice-fix-CVE-2013-4282.patch100
-rw-r--r--recipes-support/spice/spice_git.bb63
2 files changed, 163 insertions, 0 deletions
diff --git a/recipes-support/spice/files/spice-fix-CVE-2013-4282.patch b/recipes-support/spice/files/spice-fix-CVE-2013-4282.patch
new file mode 100644
index 0000000..1a00a85
--- /dev/null
+++ b/recipes-support/spice/files/spice-fix-CVE-2013-4282.patch
@@ -0,0 +1,100 @@
1Fix buffer overflow when decrypting client SPICE ticket
2
3commit 8af619009660b24e0b41ad26b30289eea288fcc2 upstream
4
5reds_handle_ticket uses a fixed size 'password' buffer for the decrypted
6password whose size is SPICE_MAX_PASSWORD_LENGTH. However,
7RSA_private_decrypt which we call for the decryption expects the
8destination buffer to be at least RSA_size(link->tiTicketing.rsa)
9bytes long. On my spice-server build, SPICE_MAX_PASSWORD_LENGTH
10is 60 while RSA_size() is 128, so we end up overflowing 'password'
11when using long passwords (this was reproduced using the string:
12'fullscreen=1proxy=#enter proxy here; e.g spice_proxy = http://[proxy]:[port]'
13as a password).
14
15When the overflow occurs, QEMU dies with:
16*** stack smashing detected ***: qemu-system-x86_64 terminated
17
18This commit ensures we use a corectly sized 'password' buffer,
19and that it's correctly nul-terminated so that we can use strcmp
20instead of strncmp. To keep using strncmp, we'd need to figure out
21which one of 'password' and 'taTicket.password' is the smaller buffer,
22and use that size.
23
24This fixes rhbz#999839
25diff --git a/server/reds.c b/server/reds.c
26index 30d0652..6f262b0 100644
27--- a/server/reds.c
28+++ b/server/reds.c
29@@ -1931,39 +1931,59 @@ static void reds_handle_link(RedLinkInfo *link)
30 static void reds_handle_ticket(void *opaque)
31 {
32 RedLinkInfo *link = (RedLinkInfo *)opaque;
33- char password[SPICE_MAX_PASSWORD_LENGTH];
34+ char *password;
35 time_t ltime;
36+ int password_size;
37
38 //todo: use monotonic time
39 time(&ltime);
40- RSA_private_decrypt(link->tiTicketing.rsa_size,
41- link->tiTicketing.encrypted_ticket.encrypted_data,
42- (unsigned char *)password, link->tiTicketing.rsa, RSA_PKCS1_OAEP_PADDING);
43+ if (RSA_size(link->tiTicketing.rsa) < SPICE_MAX_PASSWORD_LENGTH) {
44+ spice_warning("RSA modulus size is smaller than SPICE_MAX_PASSWORD_LENGTH (%d < %d), "
45+ "SPICE ticket sent from client may be truncated",
46+ RSA_size(link->tiTicketing.rsa), SPICE_MAX_PASSWORD_LENGTH);
47+ }
48+
49+ password = g_malloc0(RSA_size(link->tiTicketing.rsa) + 1);
50+ password_size = RSA_private_decrypt(link->tiTicketing.rsa_size,
51+ link->tiTicketing.encrypted_ticket.encrypted_data,
52+ (unsigned char *)password,
53+ link->tiTicketing.rsa,
54+ RSA_PKCS1_OAEP_PADDING);
55+ if (password_size == -1) {
56+ spice_warning("failed to decrypt RSA encrypted password: %s",
57+ ERR_error_string(ERR_get_error(), NULL));
58+ goto error;
59+ }
60+ password[password_size] = '\0';
61
62 if (ticketing_enabled && !link->skip_auth) {
63 int expired = taTicket.expiration_time < ltime;
64
65 if (strlen(taTicket.password) == 0) {
66- reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
67 spice_warning("Ticketing is enabled, but no password is set. "
68- "please set a ticket first");
69- reds_link_free(link);
70- return;
71+ "please set a ticket first");
72+ goto error;
73 }
74
75- if (expired || strncmp(password, taTicket.password, SPICE_MAX_PASSWORD_LENGTH) != 0) {
76+ if (expired || strcmp(password, taTicket.password) != 0) {
77 if (expired) {
78 spice_warning("Ticket has expired");
79 } else {
80 spice_warning("Invalid password");
81 }
82- reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
83- reds_link_free(link);
84- return;
85+ goto error;
86 }
87 }
88
89 reds_handle_link(link);
90+ goto end;
91+
92+error:
93+ reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
94+ reds_link_free(link);
95+
96+end:
97+ g_free(password);
98 }
99
100 static inline void async_read_clear_handlers(AsyncRead *obj)
diff --git a/recipes-support/spice/spice_git.bb b/recipes-support/spice/spice_git.bb
new file mode 100644
index 0000000..900259a
--- /dev/null
+++ b/recipes-support/spice/spice_git.bb
@@ -0,0 +1,63 @@
1#
2# Copyright (C) 2013 Wind River Systems, Inc.
3#
4
5SUMMARY = "Simple Protocol for Independent Computing Environments"
6DESCRIPTION = "SPICE (the Simple Protocol for Independent Computing \
7Environments) is a remote-display system built for virtual \
8environments which allows users to view a computing 'desktop' \
9environment - not only on its computer-server machine, but also from \
10anywhere on the Internet and using a wide variety of machine \
11architectures."
12
13LICENSE = "LGPLv2.1+"
14LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
15
16PR = "r0"
17PV = "0.12.4"
18
19# Actual versions based on the checkouts below
20# spice = "0.12.4"
21# common = "0.12.6"
22# protocol = "0.12.6"
23SRCREV_spice = "b270fb010a3ddb432dfe6b15e4bdffa6ac086cd0"
24SRCREV_spice-common = "fe93908238196bd632287fc9875e6f2e11105d04"
25SRCREV_spice-protocol = "784407f248e7f99d2bfcc9368f9acd1efb2b9617"
26
27SRC_URI = "git://anongit.freedesktop.org/spice/spice;name=spice \
28 git://anongit.freedesktop.org/spice/spice-common;destsuffix=git/spice-common;name=spice-common \
29 git://anongit.freedesktop.org/spice/spice-protocol;destsuffix=git/spice-common/spice-protocol;name=spice-protocol \
30 "
31
32SRC_URI += "file://spice-fix-CVE-2013-4282.patch"
33
34S = "${WORKDIR}/git"
35
36inherit autotools gettext pythonnative python-dir pkgconfig
37
38DEPENDS += "python-native celt051 python-pyparsing jpeg pixman alsa-lib glib-2.0"
39
40EXTRA_OECONF_append = " -Wnone"
41EXTRA_AUTORECONF_append = " -Wnone"
42
43export PYTHON="${STAGING_BINDIR_NATIVE}/python-native/python"
44export PYTHONPATH="${PKG_CONFIG_SYSROOT_DIR}${libdir}/python2.7/site-packages"
45
46PACKAGECONFIG ?= "sasl"
47
48PACKAGECONFIG[smartcard] = "--enable-smartcard,--disable-smartcard,libcacard,"
49PACKAGECONFIG[sasl] = "--with-sasl,--without-sasl,cyrus-sasl,"
50PACKAGECONFIG[client] = "--enable-client,--disable-client,,"
51PACKAGECONFIG[gui] = "--enable-gui,--disable-gui,,"
52PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,,"
53
54PACKAGES =+ "${PN}-protocol"
55LICENSE_${PN}-protocol = "BSD"
56FILES_${PN}-protocol += "${includedir}/spice-1"
57FILES_${PN}-protocol += "${datadir}/pkgconfig"
58
59do_install_append() {
60 cd ${S}/spice-common/spice-protocol
61 oe_runmake DESTDIR="${D}" install
62 cd -
63}