Skip to content

Commit fa82aa1

Browse files
authored
Merge pull request #3564 from bluca/news
CVE-2019-13132
2 parents ddd0da2 + c2488ed commit fa82aa1

File tree

6 files changed

+144
-18
lines changed

6 files changed

+144
-18
lines changed

NEWS

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,119 @@
11
0MQ version 4.3.2 stable, released on 20xx/xx/xx
22
================================================
33

4+
* CVE-2019-13132: a remote, unauthenticated client connecting to a
5+
libzmq application, running with a socket listening with CURVE
6+
encryption/authentication enabled, may cause a stack overflow and
7+
overwrite the stack with arbitrary data, due to a buffer overflow in
8+
the library. Users running public servers with the above configuration
9+
are highly encouraged to upgrade as soon as possible, as there are no
10+
known mitigations. All versions from 4.0.0 and upwards are affected.
11+
Thank you Fang-Pen Lin for finding the issue and reporting it!
12+
13+
* New DRAFT (see NEWS for 4.2.0) zmq_socket_monitor_versioned API that supports
14+
a versioned monitoring events protocol as a parameter. Passing 1 results in
15+
the same behaviour as zmq_socket_monitor.
16+
Version 2 of the events protocol allows new events, new metadata, different
17+
socket types for the monitors and more. It is described in details in
18+
doc/zmq_socket_monitor_versioned.txt
19+
20+
* New DRAFT (see NEWS for 4.2.0) zmq_socket_monitor_pipes_stats that triggers
21+
a new ZMQ_EVENT_PIPES_STATS to be delivered via zmq_socket_monitor_versioned
22+
v2 API, which contains the current status of all the queues owned by the
23+
monitored socket. See doc/zmq_socket_monitor_versioned.txt for details.
24+
25+
* New DRAFT (see NEWS for 4.2.0) zmq_poller_fd that returns the FD of a thread
26+
safe socket. See doc/zmq_poller.txt for details.
27+
28+
* New DRAFT (see NEWS for 4.2.0) socket options:
29+
- ZMQ_XPUB_MANUAL_LAST_VALUE is similar to ZMQ_XPUB_MANUAL but allows to avoid
30+
duplicates when using last value caching.
31+
- ZMQ_SOCKS_USERNAME and ZMQ_SOCKS_PASSWORD that implement SOCKS5 proxy
32+
authentication.
33+
See doc/zmq_setsockopt.txt and doc/zmq_getsockopt.txt for details.
34+
35+
* Implemented background thread names for Windows, when the Visual Studio
36+
debugger is being used.
37+
38+
* Fixed #3358 - test_security_zap failing due to SIGBUS on SPARC64, hard-coded
39+
IPC socket binds in tests cause race conditions
40+
41+
* Fixed #3361 - enabling GSSAPI support (when using autools) does not work due
42+
to regression introduced in 4.2.3
43+
44+
* Fixed #3362 - remove documentation for ZMQ_THREAD_PRIORITY context option
45+
getter, it's not implemented
46+
47+
* Fixed #3363 - tests fail to build due to stricter compiler printf validation
48+
in new versions of GCC
49+
50+
* Fixed #3367 - try to infer cacheline size at build time, first with
51+
getconf LEVEL1_DCACHE_LINESIZE, and then by reading
52+
/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size
53+
(autoconf only), and only then falling back to the previous
54+
default of 64 bytes. Avoids false sharing on POWER and s390x.
55+
Import ax_func_posix_memalign.m4 as a more reliable check for
56+
posix_memalign presence on some unix platforms.
57+
Prefer c++11 atomic primitives to compiler intrinsics, when
58+
both are available, as the former is more reliable.
59+
Set test_pair_ipc and test_rebind_ipc to XFAIL on GNU/Hurd due
60+
to non-functioning getsockname on AF_UNIX.
61+
62+
* Fixed #3370 - Make queue length and HWM state observable
63+
64+
* Fixed #3373 - performance regression in zmq_poll on CentOS 6/7
65+
66+
* Fixed #3375 - assign names to all pthreads created by the library to ease
67+
debugging
68+
69+
* Fixed #3376 - assigned random TIPC port is not returned by ZMQ_LAST_ENDPOINT
70+
71+
* Fixed #3385 - TCP port in ZMQ_LAST_ENDPOINT depends on global locale
72+
73+
* Fixed #3404 - use std::condition_variable_any when possible
74+
75+
* Fixed #3436 - reconnect interval exponential backoff and may lead to integer
76+
overflows
77+
78+
* Fixed #3440 - improve zmq_proxy performance by batching of up to 1000
79+
consecutive messages (if any) and add perf/proxy_thr tool
80+
81+
* Fixed #3451 - fix support of /dev/poll on Solaris
82+
83+
* Fixed #3452 - strnlen may not be available
84+
85+
* Fixed #1462 - test failure in test_filter_ipc due to invalid system groups
86+
87+
* Fixed #3269 - Boost.ASIO integration stopped working with v4.3.0
88+
89+
* Fixed #3479 - ZeroMQ does not build for QNX 6.6 with CMake
90+
91+
* Fixed #3481 - add <ios> include to fix uClibc++ compilation
92+
93+
* Fixed #3491 - build broken on Fedora 30
94+
95+
* Fixed #3494 - ZeroMQConfig.cmake fails if shared libraries are not built
96+
97+
* Fixed #3498 - syntax error on Windows related to socket descriptor type
98+
99+
* Fixed #3500 - PLAIN HELLO message incorrectly uses WELCOME literal, regression
100+
introduced in 4.3.0
101+
102+
* Fixed #3517 - configure errors because of syntax errors in the use of test
103+
shell command
104+
105+
* Fixed #3521 - document how to achieve high performance with the PGM transport
106+
107+
* Fixed #3526 - failure case behavior unclear in zmq_msg_send documentation
108+
109+
* Fixed #3537 - fix build on z/OS by using pthread_equal instead of comparing
110+
variables directly
111+
112+
* Fixed #3546 - CMake links with librt on MinGW which is not available
113+
114+
* Many coding style, duplication, testing and static analysis improvements.
115+
116+
4117
0MQ version 4.3.1 stable, released on 2019/01/12
5118
================================================
6119

doc/zmq_getsockopt.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Applicable socket types:: all, when using TCP or IPC transports
224224

225225

226226
ZMQ_GSSAPI_SERVER: Retrieve current GSSAPI server role
227-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
228228
Returns the 'ZMQ_GSSAPI_SERVER' option, if any, previously set on the socket.
229229

230230
[horizontal]
@@ -744,7 +744,7 @@ Applicable socket types:: all, when using TCP transports.
744744

745745

746746
ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPIDLE (or TCP_KEEPALIVE on some OS)
747-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
747+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
748748
Override 'TCP_KEEPIDLE'(or 'TCP_KEEPALIVE' on some OS) socket option (where
749749
supported by OS). The default value of `-1` means to skip any overrides and
750750
leave it to OS default.
@@ -923,7 +923,7 @@ Applicable socket types:: ZMQ_ROUTER
923923

924924

925925
ZMQ_IN_BATCH_SIZE: Maximal receive batch size
926-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
926+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
927927
Gets the maximal amount of messages that can be received in a single
928928
'recv' system call.
929929

@@ -939,7 +939,7 @@ Applicable socket types:: All, when using TCP, IPC, PGM or NORM transport.
939939

940940

941941
ZMQ_OUT_BATCH_SIZE: Maximal send batch size
942-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
942+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
943943
Gets the maximal amount of messages that can be sent in a single
944944
'send' system call.
945945

packaging/debian/changelog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
zeromq (4.3.0) UNRELEASED; urgency=low
1+
zeromq (4.3.2) UNRELEASED; urgency=low
22

33
* Initial packaging.
44

packaging/debian/zeromq.dsc.obs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Format: 3.0 (quilt)
22
Source: zeromq
33
Binary: libzmq5, libzmq3-dev, libzmq5-dbg
44
Architecture: any
5-
Version: 4.3.0
5+
Version: 4.3.2
66
Maintainer: libzmq Developers <zeromq-dev@lists.zeromq.org>
77
Homepage: http://www.zeromq.org/
88
Standards-Version: 3.9.8

packaging/redhat/zeromq.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
%endif
1111
%define lib_name libzmq5
1212
Name: zeromq
13-
Version: 4.3.0
13+
Version: 4.3.2
1414
Release: 1%{?dist}
1515
Summary: The ZeroMQ messaging library
1616
Group: Applications/Internet

src/curve_server.cpp

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,12 @@ int zmq::curve_server_t::process_initiate (msg_t *msg_)
327327
const size_t clen = (size - 113) + crypto_box_BOXZEROBYTES;
328328

329329
uint8_t initiate_nonce[crypto_box_NONCEBYTES];
330-
uint8_t initiate_plaintext[crypto_box_ZEROBYTES + 128 + 256];
331-
uint8_t initiate_box[crypto_box_BOXZEROBYTES + 144 + 256];
330+
uint8_t *initiate_plaintext =
331+
static_cast<uint8_t *> (malloc (crypto_box_ZEROBYTES + clen));
332+
alloc_assert (initiate_plaintext);
333+
uint8_t *initiate_box =
334+
static_cast<uint8_t *> (malloc (crypto_box_BOXZEROBYTES + clen));
335+
alloc_assert (initiate_box);
332336

333337
// Open Box [C + vouch + metadata](C'->S')
334338
memset (initiate_box, 0, crypto_box_BOXZEROBYTES);
@@ -339,18 +343,19 @@ int zmq::curve_server_t::process_initiate (msg_t *msg_)
339343
memcpy (initiate_nonce + 16, initiate + 105, 8);
340344
cn_peer_nonce = get_uint64 (initiate + 105);
341345

346+
const uint8_t *client_key = initiate_plaintext + crypto_box_ZEROBYTES;
347+
342348
rc = crypto_box_open (initiate_plaintext, initiate_box, clen,
343349
initiate_nonce, _cn_client, _cn_secret);
344350
if (rc != 0) {
345351
// CURVE I: cannot open client INITIATE
346352
session->get_socket ()->event_handshake_failed_protocol (
347353
session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC);
348354
errno = EPROTO;
349-
return -1;
355+
rc = -1;
356+
goto exit;
350357
}
351358

352-
const uint8_t *client_key = initiate_plaintext + crypto_box_ZEROBYTES;
353-
354359
uint8_t vouch_nonce[crypto_box_NONCEBYTES];
355360
uint8_t vouch_plaintext[crypto_box_ZEROBYTES + 64];
356361
uint8_t vouch_box[crypto_box_BOXZEROBYTES + 80];
@@ -371,7 +376,8 @@ int zmq::curve_server_t::process_initiate (msg_t *msg_)
371376
session->get_socket ()->event_handshake_failed_protocol (
372377
session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC);
373378
errno = EPROTO;
374-
return -1;
379+
rc = -1;
380+
goto exit;
375381
}
376382

377383
// What we decrypted must be the client's short-term public key
@@ -383,7 +389,8 @@ int zmq::curve_server_t::process_initiate (msg_t *msg_)
383389
session->get_socket ()->event_handshake_failed_protocol (
384390
session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE);
385391
errno = EPROTO;
386-
return -1;
392+
rc = -1;
393+
goto exit;
387394
}
388395

389396
// Precompute connection secret from client key
@@ -405,23 +412,29 @@ int zmq::curve_server_t::process_initiate (msg_t *msg_)
405412
// is attempted)
406413
rc = receive_and_process_zap_reply ();
407414
if (rc == -1)
408-
return -1;
415+
goto exit;
409416
} else if (!options.zap_enforce_domain) {
410417
// This supports the Stonehouse pattern (encryption without
411418
// authentication) in legacy mode (domain set but no handler).
412419
state = sending_ready;
413420
} else {
414421
session->get_socket ()->event_handshake_failed_no_detail (
415422
session->get_endpoint (), EFAULT);
416-
return -1;
423+
rc = -1;
424+
goto exit;
417425
}
418426
} else {
419427
// This supports the Stonehouse pattern (encryption without authentication).
420428
state = sending_ready;
421429
}
422430

423-
return parse_metadata (initiate_plaintext + crypto_box_ZEROBYTES + 128,
424-
clen - crypto_box_ZEROBYTES - 128);
431+
rc = parse_metadata (initiate_plaintext + crypto_box_ZEROBYTES + 128,
432+
clen - crypto_box_ZEROBYTES - 128);
433+
434+
exit:
435+
free (initiate_plaintext);
436+
free (initiate_box);
437+
return rc;
425438
}
426439

427440
int zmq::curve_server_t::produce_ready (msg_t *msg_)

0 commit comments

Comments
 (0)