Skip to content
Memory corruption Write-up Advanced

Nothing new under the Sun – Discovering and exploiting a CDE bug chain

A parser bug in the lpstat command invoked by dtprintinfo allows low-privileged local users to inject arbitrary printer names, which can disclose heap memory and trigger a stack-based buffer overflow in libXm's ParseColors() function. Chaining these bugs enables local privilege escalation to root on fully-patched Solaris 10 systems.

Marco Ivaldi Follow

Published on security.humanativaspa.it

We have identified multiple security vulnerabilities that are exploitable via the the setuid-root dtprintinfo binary from the Common Desktop Environment (CDE) distributed with Oracle Solaris 10:

Marco Ivaldi, on security.humanativaspa.it

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

Context

The target is the Common Desktop Environment (CDE) shipped with Oracle Solaris 10, and specifically the setuid-root dtprintinfo binary. dtprintinfo is the CDE printer information tool: it lists the printers available to the user and displays them in the X11 GUI, with icons. To obtain the list of printer names it invokes the external lpstat command, and it also reads a per-user file, $HOME/.printers, as well as user-supplied icons placed in $HOME/.dt/icons.

Because the binary is setuid-root, anything that lets a low-privileged local user influence its parsing is interesting: a memory-safety bug reachable through that influence becomes a local privilege escalation to root.

The work described here identified several vulnerabilities in this binary and in the Motif library libXm it uses:

  • A bug in the parser of the lpstat external command invoked by dtprintinfo allows low-privileged local users to inject arbitrary printer names.
  • That printer name injection allows a local user to manipulate the control flow of the target program and disclose memory contents.
  • The ability to inject arbitrary printer names opens other attack vectors; as an example, multiple icon parsing bugs were found in libXm that cause memory corruption.

The printer name injection bug and a stack-based buffer overflow in libXm were chained to achieve local privilege escalation to root on a fully patched Solaris 10 system.

Setup

The proof-of-concept exploit was tested on Intel-based Solaris 10 systems with the latest patches installed (CPU January 2021). Oracle had shared a copy of their then current Solaris 10 security patch set (CPU January 2021) after the previous CDE vulnerability disclosures, so that the fixes for previously reported bugs could be verified in the lab.

The attacker model is a low-privileged local user on such a system. The injection works through the user's own $HOME/.printers file, and the icon vector works through icons the user places in $HOME/.dt/icons and selects in the X11 GUI.

Tools used:

  • A shell one-liner as a "poor man's fuzzer" for the .printers parser.
  • A rudimentary mutation fuzzer written in Python for XPM icons.
  • The Rhabdomancer Ghidra script, to locate calls to dangerous API functions in libXm as starting points for a binary audit.

Finding it

After verifying the fixes for the previously reported CDE bugs, the researchers took a closer look at dtprintinfo because of its complexity and its historical record of high-impact vulnerabilities. A few days of reversing and auditing the patched version produced nothing, so they switched to a quick check of the parsing of the $HOME/.printers file with a very small fuzzer:

Bash
$ cat /dev/urandom > ~/.printers
^C

This led to immediate results. It turned out to be possible to inject fake printers to be displayed by dtprintinfo. In addition, by manipulating the injected printer names, an out-of-bound read could be triggered that disclosed partial heap memory contents of the setuid-root binary.

Being able to inject arbitrary printer names is significant also because it opens attack vectors that would otherwise not be available on systems without configured printers. One such vector is the parsing of printer icons in the XPM format. A low-privileged local user can supply their own icons for dtprintinfo to show by placing them in $HOME/.dt/icons and selecting them in the X11 GUI, so a bug in the XPM parser could easily lead to memory corruption and privilege escalation.

To prove the point, a rudimentary mutation fuzzer written in Python was built, and it unearthed a few icon parsing bugs in the libXm library used by CDE, originally part of the Motif toolkit.

After that brief but intense artisanal fuzzing experience, the researchers went back to static analysis, specifically targeting the apparently weak libXm parser. The Rhabdomancer Ghidra script was used to quickly find locations in the library where dangerous API functions are called, as starting points for the binary audit. Among some interesting candidate points, the following one stood out, in the ParseColors() function that had already been encountered while analysing the crashes produced by the XPM fuzzer:

C
int ParseColors(int *data, uint ncolors, uint cpp, undefined4
        *colorTablePtr, undefined4 hashtable)
{
    ...
    char local_83c[1024];
    char local_43c[1024];
    ...
    local_c = _XmxpmNextWord(local_34, local_83c, 0x400);
    ...
    local_83c[local_c] = '\0';
    strcat(local_43c, local_83c); /* VULN */
}

This is a stack-based buffer overflow caused by the use of strcat(). It can be triggered via a specially crafted XPM icon with long colour strings.

Exploitation

A proof-of-concept exploit was created that chains the printer name injection bug and the stack-based buffer overflow in libXm. It allows a low-privileged local user to escalate privileges to those of the root user on Intel-based Solaris 10 systems with the latest patches installed (tested on CPU January 2021). The exploit code is extensively commented and should be self-explanatory.

Step 1: inject printer names through $HOME/.printers

The first primitive is the parser bug in the lpstat external command invoked by dtprintinfo to list the names of available printers. Writing arbitrary content into $HOME/.printers is enough to inject fake printers, as the quick check with random data showed:

Bash
$ cat /dev/urandom > ~/.printers
^C

By manipulating the injected printer names, an out-of-bound read can be triggered, disclosing partial heap memory contents of the setuid-root binary. This gives both a way to influence the program's control flow and a memory disclosure primitive.

Step 2: trigger the libXm overflow with a crafted XPM icon

The second primitive is the stack-based buffer overflow in ParseColors() in libXm. It is reached through a specially crafted XPM icon with long colour strings. The user supplies the icon in $HOME/.dt/icons and selects it in the X11 GUI, so the malicious data reaches the setuid-root process through a path the user fully controls.

Step 3: chain both primitives to root

The exploit combines the two: the printer name injection and the libXm stack overflow. Running it on a fully patched Intel Solaris 10 system (CPU January 2021) escalates the low-privileged local user to root. Here it is in action:

From the original on security.humanativaspa.it

Root cause

There are two distinct mistakes.

First, the parser of the lpstat external command invoked by dtprintinfo does not correctly handle the printer names it processes, so a user-controlled $HOME/.printers file can inject arbitrary printer names. Manipulated names then drive an out-of-bound read that discloses heap memory. The advisory linked in the report contains the detailed analysis of these two bugs.

Second, ParseColors() in libXm concatenates a word read from the XPM data into a 1024-byte stack buffer with strcat(), without bounding the result. A crafted XPM icon with long colour strings overflows local_43c on the stack.

As for why existing defences did not stop it: the buffer overflows found in ParsePixels() and ParseColors() had already been reported by Chris Evans in 2004 and tracked as CVE-2004-0687. Due to an incomplete fix, they were not patched in Solaris 10 and survived in the code for 19 years. The setuid-root nature of dtprintinfo turns these library bugs into a privilege escalation path.

Impact

A low-privileged local user can escalate to root on Intel-based Solaris 10 systems with the latest patches installed (tested on CPU January 2021), by chaining the printer name injection bug and the libXm stack-based buffer overflow. The printer name injection alone allows manipulation of the target program's control flow and disclosure of partial heap memory contents. The icon parsing bugs in libXm cause memory corruption and are reachable because a user can supply their own icons in $HOME/.dt/icons and select them in the X11 GUI. The injection vector is also notable because it is available on systems without configured printers.

Fix

The disclosure timeline spans exactly one year:

  1. 2022-01-18: Oracle was notified via <[redacted]>.
  2. 2022-01-19: Oracle acknowledged the vulnerability reports.
  3. 2022-04-20: Oracle was asked to provide an update on the patch release date.
  4. 2022-04-21: Oracle replied that they could not comment on the patch release date.
  5. 2022-09-03: Oracle was asked for an update and informed of the plan to publish a detailed advisory and a blog post before the end of 2022.
  6. 2022-09-12: Oracle replied that they were working on the bugs and would be able to give an update closer to the next CPU, scheduled for October.
  7. 2022-10-18: Oracle informed the researchers that the vulnerabilities would be fixed in their CPU of January 2023.
  8. 2022-12-20: Oracle informed them that Solaris 10 desktop components had reached EOL and were no longer supported, so Oracle would not be releasing patches for bugs affecting Solaris 10. Oracle said they would work with X.Org to get a fix and an advisory released upstream for the first crash identified in libXm, which also affects X.Org libXpm; that denial of service bug would be fixed in Solaris 11.4. It also emerged that the buffer overflows in ParsePixels() and ParseColors() had already been reported by Chris Evans in 2004 and tracked as CVE-2004-0687, and that due to an incomplete fix they were not patched in Solaris 10 and had survived in the code for 19 years. Since no patches for Solaris 10 would be released, these issues officially became #ForeverDay bugs.
  9. 2023-01-17: X.Org released libXpm 3.5.15, which fixes CVE-2022-46285 (infinite loop on unclosed comments in X.Org libXpm). Oracle published their CPU January 2023, which does not include fixes for the bugs affecting Solaris 10.
  10. 2023-01-18: Oracle informed the researchers that Solaris 10 desktop components had reached EOL at the end of 2019. EOL is documented in support note 1400676.1, behind the paywall for Oracle customers with current support contracts. HN Security published the advisory and a local privilege escalation exploit.
  11. 2023-01-20: Mitre assigned CVE-2023-24039 to the buffer overflow in libXm and CVE-2023-24040 to the printer name injection and heap memory disclosure bugs.

The advisory contains remediation advice, including a partial workaround. No patches for Solaris 10 will be released for these bugs.

Variants to test

  • Other setuid-root programs that shell out to external commands. Look for binaries that invoke helpers such as lpstat and parse their output or user-controlled configuration files. A positive result is that data you control in a per-user file changes the program's behaviour, for example by injecting entries that were never configured on the system.
  • Per-user configuration files parsed by privileged GUI tools. Try $HOME/.printers-style files with random and then structured content. A positive result is a crash, an out-of-bound read that leaks heap bytes, or attacker-influenced control flow.
  • Icon and image parsers in privileged toolkits. Supply crafted XPM icons through the documented user icon directory and select them in the GUI. A positive result is a crash in the parser, which points at memory corruption worth auditing.
  • Dangerous string APIs in image parsers. Use a script such as Rhabdomancer to list call sites of functions like strcat() in the relevant library, then audit the ones that concatenate parsed input into fixed-size stack buffers. A positive result is an unbounded copy reachable from a crafted image, as in ParseColors().
  • Old, incompletely fixed CVEs. Check whether fixes for historical image-parser CVEs, such as CVE-2004-0687, are actually present in the shipped library, since an incomplete fix can leave the overflow reachable for years.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

A security researcher found a way for an ordinary user on a Solaris 10 computer to become the all-powerful root user, the account that can do anything on the machine. The trick did not need a password, a network connection or a misconfigured server. It used two small mistakes in software that was already installed, and it worked on a system with every official patch applied.

The software involved is the Common Desktop Environment (CDE), the old graphical desktop that shipped with Oracle Solaris 10, and in particular a program called dtprintinfo. That program shows you the printers your computer can use, with little icons, in a window. It runs with special powers (it is setuid-root, explained below), so a flaw inside it is serious: if you can make it misbehave, you may be able to make it do things as root on your behalf.

The researchers found several flaws. The first lets a normal user slip fake printer names into the program, and then use those names to make the program reveal pieces of its own memory. The second is a classic memory bug in a graphics library the program uses to draw printer icons. Put the two together and you get a working path from ordinary user to root. The report also tells the story of what happened after the bugs were reported to Oracle, which is almost as interesting as the bugs themselves: one of them had already been found in 2004 and never properly fixed.

Background: the pieces involved

Before the details, here is what each piece is, in everyday terms.

  • Solaris 10 is an operating system made by Sun Microsystems, later bought by Oracle. It was widely used on servers and workstations. The report tests on Intel-based machines running it with the latest patches, specifically the January 2021 CPU.
  • CPU here does not mean the processor. In Oracle's world it means Critical Patch Update: the bundle of security fixes Oracle releases on a schedule. The January 2021 CPU is the set of patches the researchers installed.
  • CDE (Common Desktop Environment) is the graphical desktop that came with Solaris. Think of it as the old equivalent of the desktop you see when you log in to a modern computer: windows, icons, a file manager, and small tools such as the printer viewer.
  • dtprintinfo is one of those small tools. It lists the printers available to you and shows them in a window with icons. It is the program at the centre of this story.
  • setuid-root is a special permission bit on a program file. Normally a program runs with the rights of the person who started it. A setuid-root program runs with the rights of root instead, no matter who started it. This is how ordinary users can do privileged things like look at the printer queue. The catch is that any bug in such a program can potentially be turned into full root access, because the program is already running as root.
  • lpstat is a standard command-line tool that prints information about printers, including their names. dtprintinfo does not gather printer names itself; it runs lpstat and reads what comes back.
  • $HOME/.printers is a small per-user configuration file in your home directory. $HOME means your home directory, so for a user called alice this is /home/alice/.printers. Because it belongs to the user, the user can write anything into it.
  • $HOME/.dt/icons is a per-user folder where CDE looks for icons you have supplied yourself. Again, the user controls its contents completely.
  • X11 is the old windowing system that draws windows and handles the mouse and keyboard on Unix-like systems. When the report says a user selects an icon in the X11 GUI, it means clicking it in the graphical desktop.
  • XPM is an image file format used for small icons. It is text-based: an XPM file is basically a list of colours and a grid of characters, each character standing for a pixel. Because it is text, it is parsed by a program, and parsers are where bugs live.
  • Motif is an old toolkit for building graphical programs, and libXm is its main library. CDE is built on Motif, so dtprintinfo uses libXm to draw its icons.
  • Memory corruption is a broad name for bugs where a program writes data outside the space it reserved for it, or reads data it should not. In the best case the program crashes. In the worst case an attacker can steer the program into running their own instructions.
  • A buffer is a fixed-size area of memory reserved to hold something, like a row of 1024 numbered boxes. Writing more than fits means spilling into the boxes next to it, which belong to something else.
  • A stack-based buffer overflow is that spill happening on the stack, the region of memory where a program keeps short-lived data such as local variables and the address it should return to when a function finishes. Overwriting the return address is the classic route to taking control of a program.
  • An out-of-bound read is the opposite: reading past the end of a buffer, so the program shows you memory it was not supposed to show. It is a way to leak information, which attackers use to learn where things are in memory.
  • Fuzzing means feeding a program lots of random or semi-random input to see if it crashes. It is a cheap way to find bugs without reading the code.
  • Static analysis means reading the program's code (or its compiled form) to find bugs by inspection, without running it.
  • A proof-of-concept exploit is a small program that demonstrates a bug can actually be abused, not just theorised.
  • Local privilege escalation means going from a low-privileged account on a machine to a higher-privileged one, here from an ordinary user to root.
  • CVE is a public identifier for a known vulnerability, like a catalogue number. CVE-2004-0687 is one such entry, from 2004.
  • EOL means end of life: the vendor has stopped supporting the product and will not release fixes for it.

The setup

The researchers were not starting from nothing. After earlier CDE vulnerability disclosures, Oracle had kindly given them a copy of the then-current Solaris 10 security patch set, the January 2021 CPU, so they could install it in their lab and check that the earlier bugs were really fixed.

While they were there, they decided to look more closely at dtprintinfo. Two reasons: it is a complicated program, and it has an impressive historical record of high-impact vulnerabilities. In other words, it had been broken before, repeatedly, which makes it a promising place to look again.

The attacker in this story is a normal user sitting at the machine, with a home directory they can write to. No printers need to be configured on the system for the attack to work, which matters: on a machine with no printers, you might think the printer tool has nothing to do, but it still reads the user's own files.

The tools used were deliberately simple:

  1. A one-line shell command as a "poor man's fuzzer" for the .printers file parser.
  2. A small mutation fuzzer written in Python for XPM icons. A mutation fuzzer takes a valid sample file and randomly changes bytes in it, over and over, looking for crashes.
  3. A script called Rhabdomancer, run inside Ghidra (a tool for inspecting compiled programs), to find places in libXm where dangerous library functions are called. Those places become starting points for a manual audit.

Finding the first bug

After confirming the earlier fixes, the researchers spent a few days reversing and auditing the patched dtprintinfo. Reversing means turning a compiled program back into something readable, to understand what it does. That produced nothing useful.

So they changed approach and tried a very small fuzzer against the parsing of the $HOME/.printers file:

Bash
$ cat /dev/urandom > ~/.printers
^C

Line by line:

  • cat /dev/urandom reads from a special device that produces an endless stream of random bytes. It never ends on its own.
  • > redirects that stream into a file, overwriting it.
  • ~/.printers is the per-user printers file in the home directory. So the command fills it with random bytes.
  • ^C is what the user types to stop the command, since the random stream never finishes by itself.

The point of this is not elegance. It is to put completely unexpected content into a file the program trusts, and see whether the program copes. It did not cope.

The result was immediate. It turned out to be possible to inject fake printers that dtprintinfo would then display. Even better, by carefully manipulating the injected printer names, the researchers could trigger an out-of-bound read that disclosed partial heap memory contents of the setuid-root binary. The heap is the region of memory a program uses for data it creates while running; leaking parts of it can reveal addresses and other useful information to an attacker.

This matters beyond the printer list itself. Being able to inject arbitrary printer names opens attack vectors that would otherwise not exist on a system with no printers configured. One such vector is the parsing of printer icons in XPM format.

Finding the second bug

A user can supply their own icons for dtprintinfo to show, by putting them in $HOME/.dt/icons and selecting them in the X11 graphical interface. If the XPM parser has a bug, that is a direct route from user-controlled file to memory corruption inside a root-running program, and from there potentially to privilege escalation.

To test that idea, the researchers built a rudimentary mutation fuzzer in Python. It took valid XPM icons, changed them randomly, and fed them to the parser. This unearthed a few icon parsing bugs in libXm, the Motif library CDE uses.

After that brief but intense artisanal fuzzing, they went back to static analysis, targeting the libXm parser, which looked weak. They ran the Rhabdomancer Ghidra script to quickly find places in the library where dangerous API functions are called. An API function here just means a function provided by a library for programs to call; some of them are dangerous because they do not check sizes. Those call sites became starting points for a manual audit of the compiled code.

Among the candidates, one stood out, in a function called ParseColors(), which they had already seen while looking at the crashes from the XPM fuzzer:

C
int ParseColors(int *data, uint ncolors, uint cpp, undefined4
        *colorTablePtr, undefined4 hashtable)
{
    ...
    char local_83c[1024];
    char local_43c[1024];
    ...
    local_c = _XmxpmNextWord(local_34, local_83c, 0x400);
    ...
    local_83c[local_c] = '\0';
    strcat(local_43c, local_83c); /* VULN */
}

Line by line, in plain words:

  • int ParseColors(...) declares a function that parses the colour section of an XPM image. The parameters are the image data, the number of colours, characters per pixel, a pointer to a colour table and a hash table. The ... lines are parts of the function the report does not show.
  • char local_83c[1024]; reserves a buffer of 1024 characters on the stack, named after its position in the stack frame.
  • char local_43c[1024]; reserves a second 1024-character buffer right next to it.
  • local_c = _XmxpmNextWord(local_34, local_83c, 0x400); reads the next word from the XPM data into the first buffer, with a maximum of 0x400 bytes, which is 1024 in decimal. The number of characters read is stored in local_c.
  • local_83c[local_c] = '\0'; puts a string terminator (a zero byte) after the word just read, so the buffer can be treated as a C string.
  • strcat(local_43c, local_83c); /* VULN */ appends the contents of the first buffer to the second one. strcat does not know how big the destination is; it just keeps copying until it hits a terminator. If the destination already holds a long string, the copy runs past the end of local_43c and overwrites whatever is next on the stack. The comment /* VULN */ marks the vulnerable line.

This is a textbook stack-based buffer overflow, caused by using the unsafe strcat() function. It can be triggered with a specially crafted XPM icon containing long colour strings.

Exploitation

The researchers wrote a proof-of-concept exploit that chains the two bugs: the printer name injection and the stack-based buffer overflow in libXm. Chaining means using the first bug to set things up and the second to finish the job. The result lets a low-privileged local user escalate to root on Intel-based Solaris 10 systems with the latest patches installed, tested on the January 2021 CPU.

The exploit code is extensively commented and should be self-explanatory, according to the report. Here it is in action:

From the original on security.humanativaspa.it

The animation shows the exploit in action.

Step 1: inject printer names through $HOME/.printers

The first building block is the parser bug in the lpstat external command that dtprintinfo runs to list printer names. Writing arbitrary content into $HOME/.printers is enough to inject fake printers, as the quick random-data test showed:

Bash
$ cat /dev/urandom > ~/.printers
^C

As before: cat /dev/urandom produces endless random bytes, > writes them into the file ~/.printers in the home directory, and ^C stops it. The file now contains garbage, and the program accepts it as printer names.

By manipulating the injected names, an out-of-bound read can be triggered, disclosing partial heap memory contents of the setuid-root binary. That gives the attacker two things: a way to influence the program's control flow, and a way to leak memory. Leaked memory is useful because it tells the attacker where things are, which is often needed to make a memory corruption bug do something useful rather than just crash.

Step 2: trigger the libXm overflow with a crafted XPM icon

The second building block is the stack-based buffer overflow in ParseColors() in libXm. It is reached through a specially crafted XPM icon with long colour strings. The user puts the icon in $HOME/.dt/icons and selects it in the X11 graphical interface, so the malicious data reaches the setuid-root process through a path the user fully controls. No special access is needed: it is the user's own icon folder and the user's own click.

Step 3: chain both primitives to root

The exploit combines the two: the printer name injection and the libXm stack overflow. Running it on a fully patched Intel Solaris 10 system, with the January 2021 CPU, escalates the low-privileged local user to root. The animation above shows it happening.

Root cause

There are two distinct mistakes.

First, the parser of the lpstat external command that dtprintinfo runs does not correctly handle the printer names it processes. A user-controlled $HOME/.printers file can therefore inject arbitrary printer names. Manipulated names then drive an out-of-bound read that discloses heap memory. The advisory linked in the report has the detailed analysis of these two bugs.

Second, ParseColors() in libXm concatenates a word read from the XPM data into a 1024-byte stack buffer with strcat(), without limiting the result. A crafted XPM icon with long colour strings overflows local_43c on the stack.

Why did existing defences not stop it? The buffer overflows in ParsePixels() and ParseColors() had already been reported by Chris Evans in 2004 and tracked as CVE-2004-0687. Because the fix was incomplete, they were never patched in Solaris 10 and survived in the code for 19 years. The setuid-root nature of dtprintinfo turns these library bugs into a privilege escalation path: the same bug in an ordinary program would just crash it, but here the program is already running as root.

Impact

A low-privileged local user can escalate to root on Intel-based Solaris 10 systems with the latest patches installed, tested on the January 2021 CPU, by chaining the printer name injection bug and the libXm stack-based buffer overflow. The printer name injection alone allows manipulation of the target program's control flow and disclosure of partial heap memory contents. The icon parsing bugs in libXm cause memory corruption and are reachable because a user can supply their own icons in $HOME/.dt/icons and select them in the X11 graphical interface. The injection vector is also notable because it works on systems with no printers configured at all.

Fix

The disclosure timeline spans exactly one year:

  1. 2022-01-18: Oracle was notified via <[redacted]>.
  2. 2022-01-19: Oracle acknowledged the vulnerability reports.
  3. 2022-04-20: Oracle was asked to provide an update on the patch release date.
  4. 2022-04-21: Oracle replied that they could not comment on the patch release date.
  5. 2022-09-03: Oracle was asked for an update and informed of the plan to publish a detailed advisory and a blog post before the end of 2022.
  6. 2022-09-12: Oracle replied that they were working on the bugs and would be able to give an update closer to the next CPU, scheduled for October.
  7. 2022-10-18: Oracle informed the researchers that the vulnerabilities would be fixed in their CPU of January 2023.
  8. 2022-12-20: Oracle informed them that Solaris 10 desktop components had reached EOL and were no longer supported, so Oracle would not be releasing patches for bugs affecting Solaris 10. Oracle said they would work with X.Org to get a fix and an advisory released upstream for the first crash identified in libXm, which also affects X.Org libXpm; that denial of service bug would be fixed in Solaris 11.4. It also emerged that the buffer overflows in ParsePixels() and ParseColors() had already been reported by Chris Evans in 2004 and tracked as CVE-2004-0687, and that due to an incomplete fix they were not patched in Solaris 10 and had survived in the code for 19 years. Since no patches for Solaris 10 would be released, these issues officially became #ForeverDay bugs.
  9. 2023-01-17: X.Org released libXpm 3.5.15, which fixes CVE-2022-46285 (infinite loop on unclosed comments in X.Org libXpm). Oracle published their CPU January 2023, which does not include fixes for the bugs affecting Solaris 10.
  10. 2023-01-18: Oracle informed the researchers that Solaris 10 desktop components had reached EOL at the end of 2019. EOL is documented in support note 1400676.1, behind the paywall for Oracle customers with current support contracts. HN Security published the advisory and a local privilege escalation exploit.
  11. 2023-01-20: Mitre assigned CVE-2023-24039 to the buffer overflow in libXm and CVE-2023-24040 to the printer name injection and heap memory disclosure bugs.

The advisory contains remediation advice, including a partial workaround. No patches for Solaris 10 will be released for these bugs.

Variants to test

  • Other setuid-root programs that shell out to external commands. Look for binaries that invoke helpers such as lpstat and parse their output or user-controlled configuration files. A positive result is that data you control in a per-user file changes the program's behaviour, for example by injecting entries that were never configured on the system.
  • Per-user configuration files parsed by privileged graphical tools. Try $HOME/.printers-style files with random and then structured content. A positive result is a crash, an out-of-bound read that leaks heap bytes, or attacker-influenced control flow.
  • Icon and image parsers in privileged toolkits. Supply crafted XPM icons through the documented user icon directory and select them in the graphical interface. A positive result is a crash in the parser, which points at memory corruption worth auditing.
  • Dangerous string APIs in image parsers. Use a script such as Rhabdomancer to list call sites of functions like strcat() in the relevant library, then audit the ones that concatenate parsed input into fixed-size stack buffers. A positive result is an unbounded copy reachable from a crafted image, as in ParseColors().
  • Old, incompletely fixed CVEs. Check whether fixes for historical image-parser CVEs, such as CVE-2004-0687, are actually present in the shipped library, since an incomplete fix can leave the overflow reachable for years.

Glossary

  • API: a set of functions a library offers to programs, so they can use its features without rewriting them. Some of these functions are dangerous because they do not check sizes.
  • Buffer: a fixed-size area of memory reserved to hold data, like a row of numbered boxes.
  • Buffer overflow: writing more data into a buffer than it can hold, so the extra data spills into neighbouring memory.
  • CDE (Common Desktop Environment): the graphical desktop that shipped with Solaris, with windows, icons and small tools such as the printer viewer.
  • CPU (Critical Patch Update): Oracle's scheduled bundle of security fixes. Not to be confused with the processor.
  • CVE: a public catalogue number for a known vulnerability, such as CVE-2004-0687.
  • dtprintinfo: the CDE printer information tool that lists printers and shows them with icons. It is setuid-root.
  • EOL (end of life): the vendor has stopped supporting a product and will not release fixes for it.
  • Fuzzing: feeding a program lots of random or semi-random input to find crashes.
  • Ghidra: a tool for inspecting compiled programs, used here with a script to find dangerous function calls.
  • Heap: the region of memory a program uses for data it creates while running. Leaking parts of it can reveal useful addresses to an attacker.
  • libXm: the main library of the Motif toolkit, used by CDE to draw its interface and icons.
  • Local privilege escalation: going from a low-privileged account on a machine to a higher-privileged one, here from an ordinary user to root.
  • lpstat: a standard command-line tool that prints information about printers, including their names. dtprintinfo runs it and reads the output.
  • Memory corruption: a bug where a program writes outside the space it reserved, or reads data it should not. It can crash the program or let an attacker steer it.
  • Motif: an old toolkit for building graphical programs; CDE is built on it.
  • Mutation fuzzer: a fuzzer that takes a valid sample file and randomly changes bytes in it, over and over, looking for crashes.
  • Out-of-bound read: reading past the end of a buffer, so the program shows memory it was not supposed to show.
  • Proof-of-concept exploit: a small program that demonstrates a bug can actually be abused.
  • Reversing: turning a compiled program back into something readable, to understand what it does.
  • root: the all-powerful account on a Unix-like system, which can do anything.
  • setuid-root: a permission bit that makes a program run with root's rights no matter who starts it. A bug in such a program can become full root access.
  • Stack: the region of memory where a program keeps short-lived data such as local variables and return addresses.
  • Stack-based buffer overflow: a buffer overflow on the stack, which can overwrite the return address and let an attacker take control of the program.
  • Static analysis: reading a program's code or compiled form to find bugs by inspection, without running it.
  • strcat(): a C library function that appends one string to another without checking the destination's size. It is the direct cause of the libXm overflow.
  • X11: the old windowing system that draws windows and handles the mouse and keyboard on Unix-like systems.
  • X.Org: the organisation that maintains the X11 windowing system and related libraries such as libXpm.
  • XPM: a text-based image format used for small icons, made of a colour list and a grid of characters.
  • $HOME: your home directory, the folder that belongs to your user account.
  • $HOME/.printers: a per-user configuration file in the home directory that dtprintinfo reads. The user can write anything into it.
  • $HOME/.dt/icons: a per-user folder where CDE looks for icons the user has supplied.
  • #ForeverDay: a nickname for vulnerabilities that will never be patched, because the affected product is no longer supported.

More by Marco Ivaldi

View all

2 more disclosed reports, best first.

More from Oracle

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.