[prev in list] [next in list] [prev in thread] [next in thread] 

List:       oss-security
Subject:    [oss-security] CVE-2020-2656, CVE-2020-2696 - Multiple vulnerabilities in Oracle Solaris
From:       Marco Ivaldi <marco.ivaldi () mediaservice ! net>
Date:       2020-01-20 10:35:26
Message-ID: 9DA63DD0-2736-42F2-9576-65102276E985 () contoso ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

Dear oss-security,

As suggested by Solar Designer, I'm cross-posting two recent advisories for the following \
vulnerabilities, fixed in Oracle's Critical Patch Update (CPU) of January 2020:

CVE-2020-2656 - Low impact information disclosure via Solaris xlock
"A low impact information disclosure vulnerability in the setuid root xlock binary distributed \
with Solaris may allow local users to read partial contents of sensitive files. Due to the fact \
that target files must be in a very specific format, exploitation of this flaw to escalate \
privileges in a realistic scenario is unlikely."

CVE-2020-2696 - Local privilege escalation via CDE dtsession
"A buffer overflow in the CheckMonitor() function in the Common Desktop Environment 2.3.1 and \
earlier and 1.6 and earlier, as distributed with Oracle Solaris 10 1/13 (Update 11) and \
earlier, allows local users to gain root privileges via a long palette name passed to dtsession \
in a malicious .Xdefaults file."

Please find the advisories attached to this email.

For further details and some background information on my recent vulnerability research project \
focused on Oracle Solaris, please refer to: \
https://techblog.mediaservice.net/2020/01/local-privilege-escalation-via-cde-dtsession/ \
https://techblog.mediaservice.net/2019/10/local-privilege-escalation-on-solaris-11-x-via-xscreensaver/
 https://techblog.mediaservice.net/2019/05/raptor-at-infiltrate-2019/

Regards,

-- 
Marco Ivaldi, Offensive Security Manager
CISSP, OSCP, QSA, ASV, OPSA, OPST, OWSE, LA27001, PRINCE2F
@Mediaservice.net S.r.l. con Socio Unico
https://www.mediaservice.net/
Tel: +39 011 19016595 | Fax: +39 011 3246497


["2020-01-solaris-xlock.txt" (text/plain)]

@Mediaservice.net Security Advisory #2020-01 (last updated on 2020-01-15)

         Title:	Low impact information disclosure via Solaris xlock
   Application:	Setuid root xlock binary distributed with Solaris
     Platforms:	Oracle Solaris 11.x (confirmed on 11.4 X86)
		Oracle Solaris 10 (confirmed on 10 1/13 X86)
		OpenIndiana Hipster 2019.10 and earlier
		Other platforms are potentially affected
   Description:	A low impact information disclosure vulnerability in the setuid
		root xlock binary distributed with Solaris may allow local
		users to read partial contents of potentially sensitive files
        Author:	Marco Ivaldi <marco.ivaldi@mediaservice.net>
 Vendor Status:	<secalert_us@oracle.com> notified on 2019-09-24
      CVE Name:	CVE-2020-2656
   CVSS Vector: CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N (Base Score: 4.4)
    References: https://github.com/0xdea/advisories/blob/master/2020-01-solaris-xlock.txt
		https://www.oracle.com/security-alerts/cpujan2020.html
		https://www.oracle.com/technetwork/server-storage/solaris11/
		https://www.oracle.com/technetwork/server-storage/solaris10/
		https://www.openindiana.org/
		https://github.com/oracle/solaris-userland/tree/master/components/x11/app/xlock/sun-src
		https://www.mediaservice.net/
		https://0xdeadbeef.info/

1. Abstract.

A low impact information disclosure vulnerability in the setuid root xlock
binary distributed with Solaris may allow local users to read partial contents
of sensitive files. Due to the fact that target files must be in a very
specific format, exploitation of this flaw to escalate privileges in a
realistic scenario is unlikely.

2. Example Attack Session.

In order to reproduce this bug, the following commands can be used:

raptor@stalker:~$ cat /etc/release
                             Oracle Solaris 11.4 X86
  Copyright (c) 1983, 2018, Oracle and/or its affiliates.  All rights reserved.
                            Assembled 16 August 2018
raptor@stalker:~$ uname -a
SunOS stalker 5.11 11.4.0.15.0 i86pc i386 i86pc
raptor@stalker:~$ id
uid=100(raptor) gid=10(staff)
raptor@stalker:~$ tail -1 /etc/passwd
user.mode:x:101:10::/export/home/user:/usr/bin/bash
raptor@stalker:~$ ln -s /etc/shadow .Xdefaults
raptor@stalker:~$ Xorg :1 &
raptor@stalker:~$ xlock -name user -display :1
Unknown mode: xlock:  bad command line option \
"$5$rounds=10000$wHWiSUhf$NKjMUwIRiVVB/GYx.HZvnMhou9RUT.qaiJhKg265um7:18160::::::"

3. Discussion.

The detected information disclosure happens because xlock does not drop root
privileges and follows a malicious symlink to an arbitrary file when opening
the ~/.Xdefaults configuration file with the XrmGetFileDatabase() function of
libX11. Subsequently, xlock's CheckResources() function prints partial contents
of the last line of the file that matches the following pattern (the
resource-name string can be specified with the -name command line switch of
xlock):

[resource-name].mode:[sensitive data]

For instance, if a username in the shadow file ends with the string ".mode"
(e.g. "user.mode" as shown in the above example) it is possible for a low
privileged user to exploit this flaw in order to reveal the corresponding
password hash. Similar results can be achieved in case of usernames that end
with the following strings:

* ".font": the password hash is included in an error message printed by xlock
* ".info": the password hash is displayed as part of xlock's unlock dialog 
* ".validate": the password hash is displayed as part of xlock's unlock dialog 

Instead of creating a symlink, an attacker could exploit this flaw by directly
setting the XFILESEARCHPATH or XUSERFILESEARCHPATH environment variables to
point to /etc/shadow. In this case, the password hash associated with usernames
that end with the ".display" string can also be recovered. The XAPPLRESDIR
environment variable can also be manipulated to achieve similar results.
Finally, the directive #include "/etc/shadow" in a configuration file can also
be used to trick xlock into opening the /etc/shadow file.

Other exploitation vectors may be available.

4. Affected Platforms.

This bug was confirmed on the following platforms:

* Oracle Solaris 11.x (confirmed on 11.4 X86)
* Oracle Solaris 10 (confirmed on 10 1/13 X86)
* OpenIndiana Hipster 2019.10 and earlier

Other Oracle Solaris versions (including those that run on the SPARC
architecture) are also likely affected.

5. Fix.

Oracle has assigned the tracking# S1212411 and has released a fix for all
affected and supported versions of Solaris in their Critical Patch Update (CPU)
of January 2020.

Oracle's patch is available in the solaris-userland open source repository on
GitHub (see commit "30352568 problem in X11/XCLIENTS"):
https://github.com/oracle/solaris-userland/commit/0b48514166d1fedf21c75a2c1af2afe55e087f23

OpenIndiana's patch is available in the oi-userland repository on GitHub (see
commit "xlock: Sync with solaris-userland (security) #5421"):
https://github.com/OpenIndiana/oi-userland/pull/5421/commits/dd92fe1f71bd25432a3b7559717d23047099437f


As a temporary workaround, it is also possible to remove the setuid bit from
the xlock executable as follows (note that this might prevent it from working
properly):

bash-3.2# chmod -s /usr/bin/xlock

Copyright (c) 2020 Marco Ivaldi and @Mediaservice.net. All rights reserved.


["2020-02-cde-dtsession.txt" (text/plain)]

@Mediaservice.net Security Advisory #2020-02 (last updated on 2020-01-15)

         Title:	Local privilege escalation via CDE dtsession
   Application: Common Desktop Environment 2.3.1 and earlier
		Common Desktop Environment 1.6 and earlier
     Platforms:	Oracle Solaris 10 1/13 (Update 11) and earlier
		Other platforms are potentially affected (see below)
   Description:	A local attacker can gain root privileges by exploiting a
		buffer overflow in CDE dtsession
        Author:	Marco Ivaldi <marco.ivaldi@mediaservice.net>
 Vendor Status:	Oracle <secalert_us@oracle.com> notified on 2019-11-13
		CERT/CC notified on 2019-12-09 (tracking VU#308289)
      CVE Name:	CVE-2020-2696
   CVSS Vector:	CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H (Base Score: 8.8)
    References: https://github.com/0xdea/advisories/blob/master/2020-02-cde-dtsession.txt
		https://www.oracle.com/security-alerts/cpujan2020.html
		https://sourceforge.net/p/cdesktopenv/wiki/Home/
		https://www.oracle.com/technetwork/server-storage/solaris10/
		https://www.mediaservice.net/
		https://0xdeadbeef.info/

1. Abstract

A buffer overflow in the CheckMonitor() function in the Common Desktop
Environment 2.3.1 and earlier and 1.6 and earlier, as distributed with Oracle
Solaris 10 1/13 (Update 11) and earlier, allows local users to gain root
privileges via a long palette name passed to dtsession in a malicious
.Xdefaults file.

Note that Oracle Solaris CDE is based on the original CDE 1.x train, which is
different from the CDE 2.x codebase that was later open sourced. Most notably,
the vulnerable buffer in the Oracle Solaris CDE is stack-based, while in the
open source version it is heap-based.

2. Example Attack Session.

bash-3.2$ cat /etc/release
                    Oracle Solaris 10 1/13 s10x_u11wos_24a X86
  Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.
                            Assembled 17 January 2013
bash-3.2$ uname -a
SunOS nostalgia 5.10 Generic_147148-26 i86pc i386 i86pc
bash-3.2$ id
uid=54322(raptor) gid=1(other)
bash-3.2$ gcc raptor_dtsession_ipa.c -o raptor_dtsession_ipa -Wall
bash-3.2$ ./raptor_dtsession_ipa 192.168.1.1:0
raptor_dtsession_ipa.c - CDE dtsession LPE for Solaris/Intel
Copyright (c) 2019-2020 Marco Ivaldi <raptor@0xdeadbeef.info>

Using SI_PLATFORM       : i86pc (5.10)
Using stack base        : 0x8047fff
Using rwx_mem address   : 0xfeffa004
Using payload address   : 0x8047dff
Using strcpy() address  : 0xfefe26a0

# id
uid=0(root) gid=1(other)

3. Affected Platforms.

All platforms shipping the Common Desktop Environment are potentially affected.
This includes:

* Oracle Solaris 10 1/13 (Update 11) and earlier [default installation]

According to the CDE Wiki, the following platforms are officially supported:

* All Official Ubuntu variants 12.04 - 18.04
* Debian 6, 7, 8, 9
* Fedora 17 at least
* Archlinux
* Red Hat
* Slackware 14.0
* OpenBSD
* NetBSD
* FreeBSD 9.2, 10.x, 11.x
* openSUSE Tumbleweed (gcc7)
* openSUSE Leap 4.2 (gcc4)
* SUSE 12 SP3 (gcc4)
* Solaris, OpenIndiana

4. Fix.

The maintainers of the open source CDE 2.x version have issued the following
patches for this vulnerability:
https://sourceforge.net/p/cdesktopenv/mailman/message/36900154/
https://sourceforge.net/p/cdesktopenv/code/ci/6b32246d06ab16fd7897dc344db69d0957f3ae08/

Oracle, which maintains a different CDE codebase based on the 1.x train, has
assigned the tracking# S1231688 and has released a fix for all affected and
supported versions of Solaris in their Critical Patch Update (CPU) of January
2020.

As a workaround, it is also possible to remove the setuid bit from the
vulnerable executable as follows (note that this might prevent it from working
properly):

bash-3.2# chmod -s /usr/dt/bin/dtsession

Please note that during the audit many other potentially exploitable bugs have
surfaced in dtsession and in the Common Desktop Environment in general.
Therefore, removing the setuid bit from all CDE binaries is recommended,
regardless of patches released by vendors.

5. Proof of Concept.

An exploit for Oracle Solaris 10 1/13 (Update 11) Intel has been developed as a
proof of concept. It can be downloaded from:

https://github.com/0xdea/exploits/blob/master/solaris/raptor_dtsession_ipa.c

Copyright (c) 2020 Marco Ivaldi and @Mediaservice.net. All rights reserved.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic