Skip to content

CVE-2023-35936 Arbitrary file write is possible in Pandoc when using PDF output or --extract-media with untrusted input

MediumCVSS 5.0 EPSS 0.37%
Published
Updated
Exploit status
No public exploit known
Technology
UbuntuDebian

Description

Pandoc is a Haskell library for converting from one markup format to another, and a command-line tool that uses this library. Starting in version 1.13 and prior to version 3.1.4, Pandoc is susceptible to an arbitrary file write vulnerability, which can be triggered by providing a specially crafted image element in the input when generating files using the --extract-media option or outputting to PDF format. This vulnerability allows an attacker to create or overwrite arbitrary files on the system ,depending on the privileges of the process running pandoc. It only affects systems that pass untrusted user input to pandoc and allow pandoc to be used to produce a PDF or with the --extract-media option.

The fix is to unescape the percent-encoding prior to checking that the resource is not above the working directory, and prior to extracting the extension. Some code for checking that the path is below the working directory was flawed in a similar way and has also been fixed. Note that the --sandbox option, which only affects IO done by readers and writers themselves, does not block this vulnerability. The vulnerability is patched in pandoc 3.1.4. As a workaround, audit the pandoc command and disallow PDF output and the --extract-media option.

Upgrade path

17 packages: 6 fixed, 9 with no fix yet.

PackageAffectedFixed inStatus
ubuntu/pandoc(Ubuntu 14.04) = 1.11.1-2build2; = 1.11.1-4; = 1.11.1-5; = 1.12.2.1-1 +3 more No fix listed No fix yet
ubuntu/pandoc(Ubuntu 16.04) = 1.13.2.1~dfsg-1build6; = 1.15.1.1~dfsg-2; = 1.15.1.1~dfsg-2build1; = 1.16.0.2~dfsg-1 +1 more No fix listed No fix yet
ubuntu/pandoc(Ubuntu 18.04) = 1.19.2.1.0-1; = 1.19.2.4~dfsg-1build1; = 1.19.2.4~dfsg-1build2; = 1.19.2.4~dfsg-1build3 +2 more No fix listed No fix yet
ubuntu/pandoc(Ubuntu 20.04) = 2.5-2; = 2.5-3; = 2.5-3build1; = 2.5-3build2 +1 more No fix listed No fix yet
ubuntu/pandoc(Ubuntu 22.04) = 2.9.2.1-1ubuntu4; = 2.9.2.1-3ubuntu1; = 2.9.2.1-3ubuntu2; All versions No fix listed No fix yet
ubuntu/pandoc(Ubuntu 24.04) = 2.17.1.1-3ubuntu1; = 3.0.1+ds-3; = 3.1.3+ds-1; = 3.1.3+ds-2 +1 more No fix listed No fix yet
ubuntu/pandoc(Ubuntu 25.10) = 3.1.11.1+ds-2; = 3.1.11.1+ds-4; All versions No fix listed No fix yet
ubuntu/pandoc(Ubuntu 26.04) = 3.1.11.1+ds-4; = 3.7.0.2+ds-1; All versions No fix listed No fix yet
ubuntu/pandoc(Ubuntu 26.10) = 3.7.0.2+ds-1; = 3.9.0.2-1; = 3.10-1; = 3.11-1 +1 more No fix listed No fix yet
debian/haskell-pandoc(Debian 13) < 3.0.1-2 3.0.1-2 Fixed
debian/haskell-pandoc(Debian 14) < 3.0.1-2 3.0.1-2 Fixed
debian/pandoc(Debian 12) < 2.17.1.1-2~deb12u1; = 2.17.1.1-1.1 2.17.1.1-2~deb12u1 Fixed
debian/pandoc(Debian 13) < 2.17.1.1-2 2.17.1.1-2 Fixed
debian/pandoc(Debian 14) < 2.17.1.1-2 2.17.1.1-2 Fixed
pandoc >= 1.13, < 3.1.4 3.1.4 Fixed
debian linux = 10.0 No fix listed Versions listed
jgm pandoc = >= 1.13, < 3.1.4 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
debian/haskell-pandoc(Debian:13) < 3.0.1-2 3.0.1-2
debian/haskell-pandoc(Debian:14) < 3.0.1-2 3.0.1-2
debian/pandoc(Debian:12) < 2.17.1.1-2~deb12u1 2.17.1.1-2~deb12u1
debian/pandoc(Debian:12) = 2.17.1.1-1.1 No fix listed
debian/pandoc(Debian:13) < 2.17.1.1-2 2.17.1.1-2
debian/pandoc(Debian:14) < 2.17.1.1-2 2.17.1.1-2
jgm pandoc = >= 1.13, < 3.1.4 No fix listed
ubuntu/pandoc(Ubuntu:22.04) All versions No fix listed
pandoc >= 1.13, < 3.1.4 3.1.4
debian linux = 10.0 No fix listed
ubuntu/pandoc(Ubuntu:24.04) All versions No fix listed
ubuntu/pandoc(Ubuntu:26.04) All versions No fix listed
ubuntu/pandoc(Ubuntu:26.10) All versions No fix listed
ubuntu/pandoc(Ubuntu:14.04) All versions No fix listed
ubuntu/pandoc(Ubuntu:14.04) = 1.11.1-2build2 No fix listed
ubuntu/pandoc(Ubuntu:14.04) = 1.11.1-4 No fix listed
ubuntu/pandoc(Ubuntu:14.04) = 1.11.1-5 No fix listed
ubuntu/pandoc(Ubuntu:14.04) = 1.12.2.1-1 No fix listed
ubuntu/pandoc(Ubuntu:14.04) = 1.12.2.1-1build1 No fix listed
ubuntu/pandoc(Ubuntu:14.04) = 1.12.2.1-1build2 No fix listed
ubuntu/pandoc(Ubuntu:16.04) All versions No fix listed
ubuntu/pandoc(Ubuntu:16.04) = 1.13.2.1~dfsg-1build6 No fix listed
ubuntu/pandoc(Ubuntu:16.04) = 1.15.1.1~dfsg-2 No fix listed
ubuntu/pandoc(Ubuntu:16.04) = 1.15.1.1~dfsg-2build1 No fix listed
ubuntu/pandoc(Ubuntu:16.04) = 1.16.0.2~dfsg-1 No fix listed
Show 27 more
ProductAffected versionsFixed in
ubuntu/pandoc(Ubuntu:18.04) All versions No fix listed
ubuntu/pandoc(Ubuntu:18.04) = 1.19.2.1.0-1 No fix listed
ubuntu/pandoc(Ubuntu:18.04) = 1.19.2.4~dfsg-1build1 No fix listed
ubuntu/pandoc(Ubuntu:18.04) = 1.19.2.4~dfsg-1build2 No fix listed
ubuntu/pandoc(Ubuntu:18.04) = 1.19.2.4~dfsg-1build3 No fix listed
ubuntu/pandoc(Ubuntu:18.04) = 1.19.2.4~dfsg-1build4 No fix listed
ubuntu/pandoc(Ubuntu:20.04) All versions No fix listed
ubuntu/pandoc(Ubuntu:20.04) = 2.5-2 No fix listed
ubuntu/pandoc(Ubuntu:20.04) = 2.5-3 No fix listed
ubuntu/pandoc(Ubuntu:20.04) = 2.5-3build1 No fix listed
ubuntu/pandoc(Ubuntu:20.04) = 2.5-3build2 No fix listed
ubuntu/pandoc(Ubuntu:22.04) = 2.9.2.1-1ubuntu4 No fix listed
ubuntu/pandoc(Ubuntu:22.04) = 2.9.2.1-3ubuntu1 No fix listed
ubuntu/pandoc(Ubuntu:22.04) = 2.9.2.1-3ubuntu2 No fix listed
ubuntu/pandoc(Ubuntu:24.04) = 2.17.1.1-3ubuntu1 No fix listed
ubuntu/pandoc(Ubuntu:24.04) = 3.0.1+ds-3 No fix listed
ubuntu/pandoc(Ubuntu:24.04) = 3.1.3+ds-1 No fix listed
ubuntu/pandoc(Ubuntu:24.04) = 3.1.3+ds-2 No fix listed
ubuntu/pandoc(Ubuntu:25.10) All versions No fix listed
ubuntu/pandoc(Ubuntu:25.10) = 3.1.11.1+ds-2 No fix listed
ubuntu/pandoc(Ubuntu:25.10) = 3.1.11.1+ds-4 No fix listed
ubuntu/pandoc(Ubuntu:26.10) = 3.7.0.2+ds-1 No fix listed
ubuntu/pandoc(Ubuntu:26.10) = 3.9.0.2-1 No fix listed
ubuntu/pandoc(Ubuntu:26.10) = 3.10-1 No fix listed
ubuntu/pandoc(Ubuntu:26.10) = 3.11-1 No fix listed
ubuntu/pandoc(Ubuntu:26.04) = 3.1.11.1+ds-4 No fix listed
ubuntu/pandoc(Ubuntu:26.04) = 3.7.0.2+ds-1 No fix listed

References