Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Vulnerabilities

Data Leak in Ghostscript Could Allow Command Execution

Data leak vulnerabilities in Ghostscript could allow an attacker to take over a routine and even execute commands on systems, Google Project Zero researcher Tavis Ormandy has discovered. 

Data leak vulnerabilities in Ghostscript could allow an attacker to take over a routine and even execute commands on systems, Google Project Zero researcher Tavis Ormandy has discovered. 

A suite of software based on an interpreter for Adobe’s PostScript and PDF page description languages, Ghostscript is maintained by Artifex and is widely used in both stand-alone and web applications, including highly popular packages such as GIMP and ImageMagick.

The software is not vulnerability-free, and some of the security bugs found in it were previously exploited by North Korea-linked hackers. Last year, Ormandy revealed that multiple critical vulnerabilities in Ghostscript also impacted ImageMagick, Evince, GIMP, and most other PDF/PS tools.

In December 2018, a month after Ghostscript 9.26 was released, the security researcher discovered that Ghostscript didn’t protect subroutines correctly, which could result in data leaks and in an attacker taking over the routine. 

The researcher explains that the manner in which subroutines are defined in PostScript could allow users to “peek inside and get references to operators they shouldn’t be allowed to use” if subroutines are not marked as executeonly when using system operators.

Furthermore, he notes that, even if subroutines are properly marked, they could still expose the contents to error handlers, meaning that they need to be made pseudo-operators with odef. 

On top of that, contents need to be bind, otherwise “name resolution happens on execution, not when you define it,” allowing an intruder to change the dictstack “so that commands and operators do something different than when you defined the subroutine.”

However, it’s not only simple routines that need to be marked executeonly, made pseudo-operators with odef, and bind to be protected, but the more complicated ephemeral routines as well, and Ghostscript failed to apply the proper protections to some ephemeral routines, Ormandy discovered. 

Advertisement. Scroll to continue reading.

The researcher also published proof-of-concept code that works with Ghostscript 9.26 and which allows the user to take over names that couldn’t be resolved at define time, thus providing a high degree of control over the routine. 

“This exploit should work via evince, ImageMagick, nautilus, less, gimp, gv, etc, etc. It might require some adjustment to work on older versions, because it requires precise alignment of the operand stack, but 9.26 and earlier are all affected,” Ormandy says. 

The researcher reported the discovery to Artifex in early December. After a series of failed fixes, the maintainers managed to address the bugs with patches released earlier this month. The vulnerability is tracked as CVE-2019-6116

The fix replaces references to operators with name objects in saved stacks for error handlers; makes all ephemeral procedures that contain dangerous operators executeonly, and any outer procedures; changes how error handlers behave in executeonly procedures so that faulting operators don’t leak; rewrites code so fewer pseudo-operators are exposed to users.

“I think this will work, although it’s hard to be confident they found all the transient routines – PostScript is really hard to read,” Ormandy says. 

Related: Unpatched Ghostscript Vulnerabilities Impact Popular Software

Related: North Korean Hackers Prep Attacks Against Cryptocurrency Exchanges: Report

Written By

Ionut Arghire is an international correspondent for SecurityWeek.

Click to comment

Trending

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Gain valuable insights from industry professionals who will help guide you through the intricacies of industrial cybersecurity.

Register

Join us for an in depth exploration of the critical nature of software and vendor supply chain security issues with a focus on understanding how attacks against identity infrastructure come with major cascading effects.

Register

Expert Insights

Related Content

Vulnerabilities

Less than a week after announcing that it would suspended service indefinitely due to a conflict with an (at the time) unnamed security researcher...

Data Breaches

OpenAI has confirmed a ChatGPT data breach on the same day a security firm reported seeing the use of a component affected by an...

IoT Security

A group of seven security researchers have discovered numerous vulnerabilities in vehicles from 16 car makers, including bugs that allowed them to control car...

Vulnerabilities

A researcher at IOActive discovered that home security systems from SimpliSafe are plagued by a vulnerability that allows tech savvy burglars to remotely disable...

Risk Management

The supply chain threat is directly linked to attack surface management, but the supply chain must be known and understood before it can be...

Cybercrime

Patch Tuesday: Microsoft calls attention to a series of zero-day remote code execution attacks hitting its Office productivity suite.

Vulnerabilities

Patch Tuesday: Microsoft warns vulnerability (CVE-2023-23397) could lead to exploitation before an email is viewed in the Preview Pane.

Vulnerabilities

The latest Chrome update brings patches for eight vulnerabilities, including seven reported by external researchers.