Commit Graph

986 Commits

Author SHA1 Message Date
Jose Rubio 51db5ff378 Fix for deprecated warnings related to gnu libc sys macros.
The patch only includes sysmacros for linux, the only target with gnu libc to avoid regression issues.
2019-09-12 13:10:02 +02:00
Jon Trulson 05d231606e dtprintinfo: correct another possible buffer overflow 2019-05-07 11:21:49 -06:00
Jon Trulson 30cd56ac38 dtprintinfo: Fix a potential exploitable buffer overrun
This fixes a potentially exploitable buffer overrun in dtprintinfo.
This was brought to my attention based on a 0day exploit released for
Solaris CDE.

The exploit code does not work (or build) on linux, and the overrun is
in the heap rather than the stack as on Solaris, but it's easy to see
how this could be exploited.

The following is the content of the advisory:

8<-----------------------------------------------------------

@Mediaservice.net (Cybaze Group) Security Advisory #2019-01 (2019-05-07)

         Title:	Local privilege escalation via CDE dtprintinfo
   Application:	Common Desktop Environment 2.3.0 and earlier
     Platforms:	Oracle Solaris 10 1/13 (Update 11) and earlier
   Description:	A local attacker can gain root privileges by exploiting
		a buffer overflow in CDE dtprintinfo
        Author:	Marco Ivaldi <marco.ivaldi@mediaservice.net>
   Contributor:	Dave Aitel <dave.aitel@cyxtera.com> (original discovery)
 Vendor Status:	<secalert_us@oracle.com> notified on 2019-05-05
		<cdesktopenv-devel@lists.sourceforge.net> notified on 2019-05-05
           CVE:	The Common Vulnerabilities and Exposures project has not assigned
		a name to this issue yet
    References: https://lab.mediaservice.net/advisory/2019-01-cde-dtprintinfo.txt
		https://github.com/0xdea/raptor_infiltrate19
		https://sourceforge.net/p/cdesktopenv/wiki/Home/
		https://www.oracle.com/technetwork/server-storage/solaris10/
		https://www.mediaservice.net/
		https://infiltratecon.com/

1. Abstract.

A buffer overflow in the DtPrinterAction::PrintActionExists() function in the
Common Desktop Environment 2.3.0 and earlier, as used in Oracle Solaris 10 1/13
(Update 11) and earlier, allows local users to gain root privileges via a long
printer name passed to dtprintinfo by a malicious lpstat program.

This is a 0day vulnerability demonstrated at #INFILTRATE19 on May 2nd, 2019 in
the talk "A bug's life: story of a Solaris 0day".

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_dtprintname_intel.c -o raptor_dtprintname_intel -Wall
bash-3.2$ ./raptor_dtprintname_intel 192.168.1.1:0
raptor_dtprintname_intel.c - dtprintinfo 0day, Solaris/Intel
Copyright (c) 2004-2019 Marco Ivaldi <raptor@0xdeadbeef.info>

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

lpstat called with -v
lpstat called with -v
lpstat called with -d
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 upstream CDE maintainers have issued a patch for this vulnerability. Oracle
is investigating the issue via tracking# S1153109 and is expected to release a
fix for all affected-supported versions of Solaris via their quarterly Critical
Patch Update (CPU) program.

As a temporary workaround, it is possible to remove the setuid bit from the
dtprintinfo executable as follows:

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

5. Proof of Concept.

A working exploit for Oracle Solaris 10 1/13 (Update 11) Intel has been
developed as a proof of concept. Exploits for other Solaris versions and for
the SPARC architecture are also available. All exploits can be downloaded at:

https://github.com/0xdea/raptor_infiltrate19/
https://github.com/0xdea/exploits/

8<-----------------------------------------------------------
2019-05-07 11:21:49 -06:00
Jon Trulson 5cdeaf5b1f NLS: fix quote issue with various OS's in C/types/_common.dt.tmsg 2019-02-24 12:58:31 -07:00
Jon Trulson d6ece8fd00 Merge branch 'master' of ssh://git.code.sf.net/p/cdesktopenv/code 2019-02-24 12:56:10 -07:00
Jon Trulson c575ca9315 dtdockbook/instant: Add the proper paths for TCL on NetBSD
Patch submitted by Danilo Pecher <danilo.pecher@data-experts.biz>
2019-02-24 12:54:42 -07:00
Adam Sampson ae499c794e Explicitly initialise two more static pointers
"dtcm: Coverity 88006" fixed this for buf, but not for string in the
same function (and we may as well initialise string_head for consistency
too).
2019-01-26 00:07:36 +00:00
Adam Sampson 162c88b6ea Don't dereference an uninitialised pointer
This was an incorrect fix in "dtcm: Coverity 88382".
2019-01-26 00:05:54 +00:00
Adam Sampson a97ab71059 Avoid a NULL pointer dereference
"dtcm: Coverity 89051" fixed an instance of this on the previous line,
but not this one.
2019-01-26 00:03:34 +00:00
Chase 4d7f9df692 Use iconv on linux 2019-01-14 10:48:28 -07:00
Alex Ivanov b9f352df59 define M4Cmd 2019-01-08 19:48:47 -07:00
tu83 d5faa0360c Fixed segfault for mode switching when compiled with clang
dtcalc compiled with clang segfaulted when switched
to a different mode like Deg to Rad or Financial to
Scientific. Was reproducable at least under FreeBSD/AMD64.
Fixed now.
2019-01-06 18:55:19 +01:00
Jon Trulson 76721c2348 dtcalc/calctool.h: Use include stdlib rather than extern declarations 2018-11-08 14:19:25 -07:00
Jon Trulson 2c1f56d37c Merge branch 'master' into cde-next 2018-11-04 10:56:04 -07:00
Matthew R. Trower 041788debc Restore original `tail` functionality in ttsnoop, with POSIX args 2018-11-04 10:28:42 -07:00
Matthew R. Trower 012862e8ee Add default TCLLIB, and allow override in host.def
Restores build on Sun, and maybe others.
2018-10-25 11:43:43 -06:00
Jon Trulson 2fb1f12654 dtdocbook/instant: add Tcl_GetErrorLine check for older versions of Tcl 2018-10-07 13:28:04 -06:00
chase dd68514e4f Remove hpversion.h from repository
This patch removes hpversion.h from the repository, this also untangles a
lot of ifdef mess. This closes bug CDExc19524.
2018-10-06 17:00:38 -06:00
chase 90a2b2848a remove ultrix support 2018-09-30 17:27:04 -06:00
chase d8c017caa2 gpftobdf.c: fix long int comiler warnings 2018-09-30 17:26:27 -06:00
Jon Trulson 2dadc23e0e Merge branch 'master' into cde-next 2018-09-22 15:50:13 -06:00
Jon Trulson 77a027039c docbook.tcl, instant: finish remaining help generation issues with tcl
In this commit, we convert FreeBSD and OpenBSD to use a system version
of TCL (8.6).

We also get rid of the hairy and buggy "CompareI18NStrings" custom Tcl
function and use the newer Tcl's builtin dictionary sort mechanism for
generating the Indexes and Glossaries, which were silently broken in
previous commits.

It was just not possible to use the same Tcl code in modern versions
of Tcl in addition to the ancient version included with CDE - so, now
we will always depend on the system version.  It's been tested with
8.6 and 8.7 versions of Tcl with great results.
2018-09-22 12:27:27 -06:00
Jon Trulson 1fb82e3327 Remove ancient included tcl code 2018-09-22 12:27:09 -06:00
Jon Trulson 1c40db8eb0 dtdocbook/tcl/tcl.h: Add compatibility defines for old Tcl
dtdocbook/instant has been modified to use a more modern Tcl (8.6),
which means certain functions are not present when we are using the
dtdocbook/tcl (7.5) version of tcl instead of a modern system version.

So, create some defines that should work around this problem.
2018-09-20 16:50:28 -06:00
Jon Trulson e82991579f use system tcl: clean up Imake files for dtdocbook/instant 2018-09-19 17:49:15 -06:00
Jon Trulson 23c4c0667d instant: encode 8bit chars to keep Tcl happy 2018-09-19 17:40:25 -06:00
Jon Trulson 7712950fb7 docbook/instant: fix a few more issues 2018-09-19 17:40:25 -06:00
Jon Trulson 776e031b60 docbook.tcl: fix up some problems using a modern Tcl
One issue that came up was attempting to read array values indexed by
a key that didn't exist when generating indexes and glossaries.

I am not sure why this hasn't been a problem before, but for now, we
simply won't try to emit array values for non-existant array indexes.
2018-09-19 17:40:25 -06:00
Jon Trulson 68559d4f76 tcl: use the system version, initial work only on linux for now 2018-09-19 17:40:25 -06:00
chase d002967908 dtprintegrate: fix shellcheck warnings 2018-08-26 15:45:23 -06:00
chase 6f2d38aaa0 dtappintegrate.src and dtopen.src: fix shellcheck warnings 2018-08-26 15:45:08 -06:00
Jon Trulson fa4d519aef sgmls: remove from repository - we always use nsgmls
This was part of Chase's sgml removal patch, but was not properly
merged by me, leaving the files intact.
2018-08-26 13:17:46 -06:00
Jon Trulson a29bd8937a dtfile: Fix up CopyCheckDeletePermission() and CheckDeletePermission
Remove calls to bogus utility functions in cases where the user is
root and the filesystem in question is an NFS filesystem.

For now, __linux___ and CSRG_BASED machines will use statfs to
determine whether to test delete-ability.  For other systems, just do
the create/delete test always if the user is root.
2018-08-25 17:38:48 -06:00
David Cantrell 9cb1f309f2 Patch out use of deprecated and now removed ustat(2) function on Linux.
dtfile makes use of ustat(2) on certain systems.  This call has been
deprecated in glibc for a while and now, as of glibc-2.28, it has been
removed.  The recommended replacement is to use statfs(2).
2018-08-25 17:10:02 -06:00
chase fcdeb932d3 Dtdocbook: Remove old sgmls program 2018-08-25 16:54:16 -06:00
chase d12ad886c1 Remove old windows support 2018-08-25 15:47:54 -06:00
chase b491f9134f Refactor and reimplement dtudcfonted 2018-08-18 16:37:36 -06:00
chase 0f1aaa3e46 Revert "Disable building of dtudcfonted and dtudcexch"
This reverts commit 7f70748d65.
2018-08-18 16:37:36 -06:00
chase 6b713f12b5 Revert "dtudcfonted, dtudcexch: delete from repository"
This reverts commit e0036e6167.
2018-08-18 16:37:36 -06:00
Jon Trulson f6d83dd5e3 Merge branch 'master' into cde-next 2018-08-01 19:18:17 -06:00
chase 66db2259f7 Remove redundant motif widgets 2018-07-29 16:52:44 -06:00
Jon Trulson ba611cbde6 templates/types.tmpl: make sure to clean up new .dt's on a make clean 2018-07-20 14:15:28 -06:00
Jon Trulson d557db4eb2 Rename "dtapp" to "dtopen"
A great suggestion by Matthew Trower.
2018-07-19 20:42:54 -06:00
Jon Trulson 2f6f1d2afb Finish integrating Antonis's desktop_approots work
In addition:

- moved video type detection into a separate file: videoTypes.dt out
  of datatypes.dt.  Also, removed all actions from Antonis' dt files,
  as these are handled by the new actions (listed below).

  Image, postscript, and PDF types definitions are still located in
  datatypes.dt.src

- supports most image files, PDFs, postscript files, and video files
  via dtapp now.

- Added new actions:

  - DisplayImage
  - DisplayVideo
  - DisplayPDF
  - DisplayPS

  All of these call the dtapp_* helpers to locate an appropriate
  program to handle the task.

- Added a camera icon

- standardized the icons used to display the various types - all
  images use the Dtimage icon now, as an example.

- moved the new *.dt files to their proper place in programs/types,
  rather than programs/localized/C/types (my bad).

Please add any further video types into videoTypes.dt, and everything
else (for now) into datatypes.dt.

In the future, we should probably separate these out into
type-specific .dt files.  Also, something should be done about playing
audio files too (maybe DisplayVideo.dt can handle all those too?)
2018-07-19 19:52:40 -06:00
Jon Trulson 2b41b84c33 Add actions and types from Antonis Tsolomitis' desktop_approots contribution 2018-07-19 18:58:17 -06:00
Jon Trulson cd38de99e4 Add icons from Antonis Tsolomitis desktop_approots contribution 2018-07-19 18:57:37 -06:00
Jon Trulson 5259022498 Add a new script, dtapp, used to locate and run various helper programs
This script is located in /usr/dt/bin/dtapp, and is then symlinked to
various helpers that can be used in DT actions to run programs.

The various helpers currently installed are:

dtapp_vimage - view an image file, override with DTAPP_VIMAGE.
Defaults to xv, display, and gimp, in that order.

dtapp_vpdf - view a PDF file, override with DTAPP_VPDF.  Defaults to
okular, xpdf

dtapp_vps - view a postscript file, override with DTAPP_VPS.  Defaults
to mgv, gv

dtapp_vvideo - view a video file, override with DTAPP_VVIDEO.
Defaults to vlc, ffplay.

When a request is made to view one of these files, the list of viewers
will be tried, in order, until one is found.  If none are found, an
error message will be displayed.  Add overrides to your ~/.dtprofile
file.

We can add more dtapp commands and defaults for them as needed.

This is in preparation for integrating Antonis Tsolomitis' extended
actions and icon files, coming up in future commits.
2018-07-19 18:57:20 -06:00
Peter Howkins e2f1df0c8b dtcm: Coverity 89185 2018-07-13 19:26:38 +01:00
Peter Howkins 10a0f55b4a dtcm: Coverity 89051 2018-07-13 19:25:15 +01:00
Peter Howkins 6d7525e174 dtcm: Coverity 88955 2018-07-13 19:24:11 +01:00