Page MenuHomePhabricator

LilyPond allows arbitrary PostScript and does not use -dSAFER (CVE-2020-17353)
Closed, ResolvedPublicSecurity

Description

As noted by @faidon in T257062, LilyPond allows arbitrary PostScript to be added to the intermediate output. When PNG output is requested, this arbitrary PostScript is passed to GhostScript without -dSAFER. So arbitrary read/write/execute is allowed, even when LilyPond is run with -dsafe.

I've confirmed that the issue is present in LilyPond 2.18, but not in 2.20. It regressed again in the 2.21 unstable branch.

I reported it upstream by email yesterday, and they immediately responded with a proposed patch that disables the PostScript injection feature when safe mode is active. It is unclear whether they plan on backporting it to 2.18 but they have agreed that it is a security issue and have asked for discretion pending a release.

WMF production is not currently affected. There will be a workaround in the Score extension, which I think we should announce as an urgent security update for third-party Score users. The vulnerability trivially allows arbitrary execution via wikitext in the default configuration of the Score extension, so it is of high severity.

The workaround will probably be to run LilyPond with --ps, requesting PostScript output, which MediaWiki will convert to PNG by separately running gs -dSAFER.

Event Timeline

tstarling created this task.

I'll get that fixed in 2.18 as shipped in Debian Buster (Stretch lacks a Lilypond package due to Guile bugs which prevented it from entering the release) when upstream considers the issue public (and will also request a CVE)

The workaround will probably be to run LilyPond with --ps, requesting PostScript output, which MediaWiki will convert to PNG by separately running gs -dSAFER.

To simplify review and deployment, I uploaded that as a public change at https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Score/+/615594 , but without pointing out that it is a security issue and without linking to this bug. We'll announce what it's actually for when everyone's ready.

I haven't heard back, will ping the original "We've received your request" mail later.

This is CVE-2020-17353 (which covers both postscript and SVG)

MoritzMuehlenhoff renamed this task from LilyPond allows arbitrary PostScript and does not use -dSAFER to LilyPond allows arbitrary PostScript and does not use -dSAFER (CVE-2020-17353).Aug 5 2020, 1:59 PM

Given that the commit message is specific, MITRE directly made this one visible in the CVE feed: It's now at https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-17353

What are the upstream plans for commiting a fix for the other issue (T259210)? Ideally this one should not be too far away, so that distros can fix both in a single update.

What are the upstream plans for commiting a fix for the other issue (T259210)? Ideally this one should not be too far away, so that distros can fix both in a single update.

I'll forward you the email thread.

This specific task can be closed, right? It's fixed upstream, there was a DSA for Debian (https://lists.debian.org/debian-security-announce/2020/msg00163.html), it's fixed in our Lilypond stretch package and Score extension also applies the workaround with the intermediate step.

@tstarling - Anything left to do here or can this be closed?

@tstarling - Anything left to do here or can this be closed?

Ping? :-)

Legoktm assigned this task to faidon.
Legoktm changed the visibility from "Custom Policy" to "Public (No Login Required)".
Legoktm changed the edit policy from "Custom Policy" to "All Users".