Source: ghostscript
Version: 10.0.0~dfsg-11+deb12u9
Severity: important
Tags: security patch fixed-upstream bookworm
X-Debbugs-CC: [email protected], [email protected]

Hello,

While checking which upstream ghostscript fixes made it into
bookworm, I found that 15 memory-safety bugs fixed upstream are still
present in 10.0.0~dfsg-11+deb12u9. They all come from OSS-Fuzz and
have public test files. As far as I can tell, none of them has a CVE.
trixie already has all 15 fixes.

Four of them take down the stock gs, even with -dSAFER:

  OSV-2023-285 (stack buffer overflow in fn_ElIn_evaluate)
  gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=cups -o /dev/null <input>
  -> segfault (exit 139). Fixed upstream in 7eced55b5700
  https://osv.dev/vulnerability/OSV-2023-285

  OSV-2024-80 (stack buffer overflow in line_join_points)
  gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pxlcolor -o /dev/null <input>
  -> "*** stack smashing detected ***", abort (exit 134). Fixed
  upstream in 0782358e011f
  https://osv.dev/vulnerability/OSV-2024-80

  OSV-2022-1194 (heap buffer overflow in sputs)
  gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null <input>
  -> segfault (exit 139). Fixed upstream in c745108a1b72
  https://osv.dev/vulnerability/OSV-2022-1194

  OSV-2023-297 (invalid read in pdfi_read_cff_font)
  gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=psdcmyk -o /dev/null <input>
  -> segfault (exit 139). Fixed upstream in acaa21f68ede
  https://osv.dev/vulnerability/OSV-2023-297
  (I couldn't find any shipped program or config that selects
  psdcmyk.)

Of the other 11, five give invalid memory accesses under valgrind but
gs still exits normally, and six only show up in an AddressSanitizer
build of the Debian source.

I checked every one the same way. I ran the test file on the stock gs
under valgrind and on an ASan rebuild of your source, then applied
just the upstream commit and ran it again. Each time the bug's own
error was gone with the fix (OSV-2022-1097's input also triggers
OSV-2022-866; the file says which error is which).

The patches are attached, one .diff per bug, exactly as I applied them.
They each go in with patch -p1 on their own, without touching a line
(9 need an offset, none needs fuzz). For four of them (OSV-2022-1121,
OSV-2023-88, OSV-2024-80, OSV-2024-251) I left out one hunk that only
bumps the copyright year in a file header.

ghostscript_bookworm_entries.txt has the details for all 15: the
command, the hash and OSV page of the test file, the valgrind and
ASan results, and how I looked for CVEs. Seven CVEs matched on
function names, but they turned out to be different bugs; the file
lists them, along with 22 that matched only on write(), a C library
function. I didn't attach the test files because mail filters tend
to eat them. I'm happy to send them.

Some context that may help with triage. On a default bookworm
desktop, cups-filters runs gs with the cups device (gstoraster, for a
PDF job to a raster queue), pxlmono or pxlcolor (gstopxl, only for a
queue whose PPD names it), ps2write (pdftops, when it uses gs) and
pdfwrite (gstopdf for PostScript jobs, pdftopdf only when PDF forms
are flattened). I found nothing shipped that selects psdcmyk or
xpswrite, which matters for two of the 15: OSV-2023-297 and
OSV-2022-1121. Also, 7 of the 15 are stack buffer overflows according
to ASan, like CVE-2026-103226, which the 2026-11-17 update fixed.

To be clear, nothing here is new upstream, and I haven't tried to
exploit any of it. I'm only reporting that the fixes didn't reach
bookworm.

I put everything in one report because it's one package and one
release. If you'd rather have one bug per issue, tell me and I'll
split it.

Would you consider backporting these? If CVE ids would help, I can
request them from MITRE, or leave that to you, whichever you prefer.
And if you decide some of them aren't worth fixing (minor, no-dsa), a
short note saying so would help me: this report is part of a research
study on how upstream fixes for OSS-Fuzz bugs reach distribution
packages. Decisions will be reported at the team level only, never
attributed to a person.

If CVE ids do get assigned, please credit me as the reporter (Aniket
Sunil Salunke).

Thanks,
Aniket Sunil Salunke
Graduate researcher, MBZUAI
[email protected]
ghostscript in Debian 12 (bookworm): full entries (attachment to the bug report 
"ghostscript 10.0.0~dfsg-11+deb12u9: 15 OSS-Fuzz bugs fixed upstream but not in 
bookworm; 4 crash or abort unmodified gs -dSAFER; no CVE found")

How to read the result lines: 'stock binary' = the unmodified package binary 
(/usr/bin/gs from the archive) run under
valgrind; 'ASan rebuild' = the same distro source rebuilt with 
AddressSanitizer, nothing else changed. 'exit 139
(SIGSEGV)' means the process crashed; 'valgrind-reported, process exited 
normally' means valgrind flagged an invalid
memory access but the program did not crash. 'fix applied' = the same build 
plus only the upstream fix commit; 'clean'
means that build no longer shows the error ('both builds' = the plain rebuild 
under valgrind and the ASan rebuild).

The results below are for 10.0.0~dfsg-11+deb12u9, the update dated 2026-11-17 
(CVE-2026-39919, CVE-2026-125396,
CVE-2026-101258, CVE-2026-103226). That update does not contain any of the 
fixes listed here: none of the 57 patches
in its series carries one of these upstream commits, and all 15 inputs were 
rerun on it, with and without each fix.

Current release: Debian 13 (trixie) ships ghostscript 10.05.1~dfsg-1+deb13u3, 
which contains the fixes for all 15 bugs
in this report, by a source check: each upstream fix commit is in the history 
of the tag ghostpdl-10.05.1, the
upstream release the package is based on (checked in the ghostpdl git 
repository); none of the 20 patches in the
package's patch series (debian/patches) changes a file that these fixes change, 
so none of them reverts a fix; and
none of those files is removed from the repacked upstream source. As a 
supporting check, the inputs of all 15 bugs
were run on the shipped binary under valgrind on 2026-11-17 and showed no 
valgrind error and no crash. That test
cannot detect several of these bugs even where they are present (see the 'stock 
binary' lines below), so the statement
rests on the source check. The version is unchanged as of 2026-11-26.

Package versions were checked against the archive on 2026-11-26. "No CVE" means 
that none was found by these checks:
OSV aliases, the Debian and Ubuntu security trackers' ghostscript CVE lists, 
and the CVE List and NVD searched for
each fix commit (2026-11-17 to 2026-11-22, NVD including the ghostscript CVEs 
published since 2026-11-13; the CVE List
also daily up to 2026-11-26 by the same keys). On 2026-11-24 and 2026-11-25 all 
431,114 CVE records (the CVE List of
2026-11-13 plus records new or changed up to 2026-11-24) were also searched for 
each bug's OSS-Fuzz issue number, OSV
id and fix commit, and for the function names in the OSS-Fuzz crash state and 
in every error report of our runs that
show the bug (sanitizer reports and all valgrind errors). Leaving aside matches 
that arise only through a C-library or
runtime function name (such as write), the name searches matched 7 CVEs, each 
ruled out as a different flaw
(CVE-2009-1605: it concerns another product (MuPDF); CVE-2010-4054, 
CVE-2015-3228, CVE-2017-9835, CVE-2021-45944,
CVE-2021-45949: their fixes are already in the upstream release your package is 
based on; CVE-2024-29508: it names
versions that already contain the fix for our bug). If you know of a CVE for 
any entry, I would be glad to correct it.

Matches set aside in the CVE paragraph above: 22 CVEs matched only through the 
name write, a C-library function
(defined by the C library of the images our runs used, not by ghostscript), 
which appears in valgrind's "Syscall param
write(buf) points to uninitialised byte(s)" reports of our runs of OSV-2022-949 
and OSV-2023-1079 through the ps2pdf
wrapper: CVE-2001-1353, CVE-2012-4405, CVE-2016-7563, CVE-2016-7564, 
CVE-2016-8728, CVE-2016-9109, CVE-2016-10132,
CVE-2016-10133, CVE-2016-10246, CVE-2016-10247, CVE-2017-7948, CVE-2017-17866, 
CVE-2018-6187, CVE-2018-15908,
CVE-2020-19609, CVE-2020-26519, CVE-2020-27792, CVE-2020-36773, CVE-2021-37220, 
CVE-2023-28879, CVE-2026-3308,
CVE-2026-101258.

Test inputs: not attached, since mail filters often drop crash-triggering 
files. Each entry gives the SHA-256 of the
public OSS-Fuzz testcase and its public OSV page, which links to the OSS-Fuzz 
issue that holds the testcase. I can
send the inputs on request.

== Debian 12 (bookworm), source package ghostscript 10.0.0~dfsg-11+deb12u9 ==

-- The unmodified gs ends with a signal --

* OSV-2023-285  upstream: Stack-buffer-overflow in fn_ElIn_evaluate
  upstream fix commit (ghostpdl): 7eced55b5700c0d2aa2e102ed78f10b0ce755a64
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=cups -o /dev/null <input>
  input: public OSS-Fuzz testcase, 6132 bytes, SHA-256 
ac6376d27d4fa8ea4f222fdf5439bff96949076337aa9cf680dd46984943305d
  public record: https://osv.dev/vulnerability/OSV-2023-285
  stock binary: ERROR: invalid read, exit 139 (SIGSEGV): crashed
  ASan rebuild: ERROR: stack-buffer-overflow (write)
  fix applied: clean on both builds

* OSV-2024-80  upstream: Stack-buffer-overflow in line_join_points
  upstream fix commit (ghostpdl): 0782358e011f158ba5c49137189e5ee320580af2
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pxlcolor -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 4109 bytes, SHA-256 
828a294d4d9095bdabd0e2d6c88184306ed6d661b7fb243a8bfe6dc8cbbddf6c
  public record: https://osv.dev/vulnerability/OSV-2024-80
  stock binary: the process aborts with "*** stack smashing detected ***" 
(SIGABRT, exit 134): the stack protector fires in stroke_add_compat 
(gxstroke.c:2355); valgrind reports no invalid access before the abort
  ASan rebuild: ERROR: stack-buffer-overflow (write)
  fix applied: clean (ASan rebuild); in a later control a plain rebuild of your 
source aborts the same way in 5 of 5 runs, and with only the fix applied it 
exits normally in 5 of 5 runs, without the abort

* OSV-2022-1194  upstream: Heap-buffer-overflow in sputs
  upstream fix commit (ghostpdl): c745108a1b72b7b14899e048ee76b99ee49d9d80
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 18857 bytes, SHA-256 
fae47d9317683b6e4cb46b74f50f851ddfdd3d60b721f3189833b049eb51f83d
  public record: https://osv.dev/vulnerability/OSV-2022-1194
  stock binary: ERROR: invalid read, exit 139 (SIGSEGV): crashed
  ASan rebuild: ERROR: heap-buffer-overflow (read)
  fix applied: clean on both builds

-- valgrind reports an invalid memory access; gs exits normally --

* OSV-2022-949  upstream: Heap-use-after-free in s_file_write_flush
  upstream fix commit (ghostpdl): ebfb46da46e3f2872e4d1136571224a60891f80a
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 263581 bytes, SHA-256 
ee645b03415d16b3195358e3af866b8dca7d9517d7e3efc59198b4809a80661d
  public record: https://osv.dev/vulnerability/OSV-2022-949
  stock binary: ERROR: invalid read and invalid write, exit 0: 
valgrind-reported, process exited normally (no crash)
  ASan rebuild: ERROR: heap-use-after-free (read)
  fix applied: clean on both builds

* OSV-2022-926  upstream: Heap-buffer-overflow in Ins_PUSHW
  upstream fix commit (ghostpdl): a34f2ae161150be22b966b1fd584f4979f5d97aa
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=ps2write -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 41002 bytes, SHA-256 
61905ae90318cc0ffb9fe8263364c027333dcb30ede4ae394c363a42bfec0a9c
  public record: https://osv.dev/vulnerability/OSV-2022-926
  stock binary: ERROR: invalid read, exit 0: valgrind-reported, process exited 
normally (no crash)
  ASan rebuild: ERROR: heap-buffer-overflow (read)
  fix applied: clean on both builds

* OSV-2022-1097  upstream: Stack-use-after-return in gs_type2_interpret
  upstream fix commit (ghostpdl): 28a4b16ec292d181b7227040dd47925e3b0949d9
  note: the same input also triggers OSV-2022-866 (listed separately). Verified 
on this version: with only the OSV-2022-866 fix applied, the valgrind-reported 
read on this input is still present (2026-11-24, 5 of 5 runs); with only this 
bug's fix applied it is gone (2026-11-20, 1 run). The two entries are 
independent. The AddressSanitizer report on this input belongs to OSV-2022-866: 
it is gone with only the OSV-2022-866 fix applied (2026-11-24, 5 of 5 runs) and 
stays when only this bug's fix is applied (2026-11-20, 1 run).
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 62746 bytes, SHA-256 
a5f1aea3d5aa6ec50c21fffdc948ba6d8589775abb66e7bf6ee2198e467cda60
  public record: https://osv.dev/vulnerability/OSV-2022-1097
  stock binary: ERROR: invalid read, exit 0: valgrind-reported, process exited 
normally (no crash)
  ASan rebuild: ERROR: stack-buffer-overflow (read) (see note)
  fix applied: the invalid read is gone on the plain rebuild under valgrind; 
one use-of-uninitialised-value report remains there, and it is equally present 
without the fix. ASan rebuild: see note

* OSV-2023-1079  upstream: Heap-buffer-overflow in Calc_Length
  upstream fix commit (ghostpdl): 74bfcfea5faa35ee3c5e7e2690b2473e0c4aac59
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 117259 bytes, SHA-256 
1e7f91fe4ca22b958d5fd4e0a07c99cbf2bdf73af9d619c47450752326b3bb0f
  public record: https://osv.dev/vulnerability/OSV-2023-1079
  stock binary: ERROR: invalid read, exit 0: valgrind-reported, process exited 
normally (no crash)
  ASan rebuild: ERROR: heap-buffer-overflow (read)
  fix applied: clean on both builds

* OSV-2024-251  upstream: Heap-use-after-free in gx_device_forward_finalize
  upstream fix commit (ghostpdl): 5fb7114f814645ebf679a8228350e9770bf3f009
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pxlmono -o /dev/null <input>
  input: public OSS-Fuzz testcase, 28258 bytes, SHA-256 
6c8fe878c8859620f7cb90d62e021028a0ee7d7dec8f30589abd5b905270cf70
  public record: https://osv.dev/vulnerability/OSV-2024-251
  stock binary: ERROR: invalid read, exit 0: valgrind-reported, process exited 
normally (no crash)
  ASan rebuild: ERROR: heap-use-after-free (read)
  fix applied: clean on both builds

-- Shown only by the AddressSanitizer rebuild --

* OSV-2023-88  upstream: Stack-buffer-overflow in pdfi_read_cff_dict
  upstream fix commit (ghostpdl): 8cfe505e168185fecd1b573711c68252aefb9f77
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 15905 bytes, SHA-256 
4e484fde88ccc63dcef0750a3940daeb67dbd65b40b8177eeb5a98a6e64f1410
  public record: https://osv.dev/vulnerability/OSV-2023-88
  stock binary: no error reported
  ASan rebuild: ERROR: stack-buffer-overflow (write)
  fix applied: clean (ASan rebuild)

* OSV-2022-866  upstream: Stack-buffer-underflow in gs_type2_interpret
  upstream fix commit (ghostpdl): 92b792f6a34d2436772dd141760faf925e139c01
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 93239 bytes, SHA-256 
31dd994f17a6c3e1b3fbbbbd3b96e6c5b596960f9886df5251c3233dcfaff65a
  public record: https://osv.dev/vulnerability/OSV-2022-866
  stock binary: no invalid memory access reported (valgrind reports uses of 
uninitialised values only; not counted here)
  ASan rebuild: ERROR: stack-buffer-overflow (read)
  fix applied: clean (ASan rebuild)

* OSV-2022-888  upstream: Stack-buffer-overflow in gs_type2_interpret
  upstream fix commit (ghostpdl): 893e67b7b7253aa147740269525b2a071c7bbe79
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 34312 bytes, SHA-256 
e291d7655d73b994ee337e7f58fd4931f053683eded9a7de03d66aebb46fb44a
  public record: https://osv.dev/vulnerability/OSV-2022-888
  stock binary: no invalid memory access reported (valgrind reports uses of 
uninitialised values only; not counted here)
  ASan rebuild: ERROR: stack-buffer-overflow (read)
  fix applied: clean (ASan rebuild)

* OSV-2022-1021  upstream: Stack-buffer-underflow in gs_type2_interpret
  upstream fix commit (ghostpdl): b7f934c26b6d139d665ab924167036c74a973360
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 6966 bytes, SHA-256 
e13c99b2abb0cd53689ff25ead9ccb845f1854c62ded666448d5ce0122474bc7
  public record: https://osv.dev/vulnerability/OSV-2022-1021
  stock binary: no error reported
  ASan rebuild: ERROR: stack-buffer-overflow (read)
  fix applied: clean (ASan rebuild)

* OSV-2022-1148  upstream: Stack-buffer-underflow in gs_type2_interpret
  upstream fix commit (ghostpdl): 519ca4efe92bd16f850cd32ac783c1015191230c
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 3084 bytes, SHA-256 
9c290ef2f846cdfe0b221958aba3bb8c2734f142ddbd8d4e97d096ed44dc65de
  public record: https://osv.dev/vulnerability/OSV-2022-1148
  stock binary: no invalid memory access reported (valgrind reports uses of 
uninitialised values only; not counted here)
  ASan rebuild: ERROR: stack-buffer-overflow (read)
  fix applied: clean (ASan rebuild)

== Debian 12 (bookworm), source package ghostscript 10.0.0~dfsg-11+deb12u9: 2 
further bugs, no shipped caller found ==

For the 2 bugs below the error is confirmed in the package as shipped (see each 
entry), but I found no shipped program
or configuration that selects the output device named in the command. They are 
listed separately so that you can judge
them on their own.

-- The unmodified gs ends with a signal --

* OSV-2023-297  upstream: UNKNOWN READ in pdfi_read_cff_font
  upstream fix commit (ghostpdl): acaa21f68ede3ae8fca48136fa95ee32de6533b2
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=psdcmyk -o /dev/null <input>
  input: public OSS-Fuzz testcase, 8120 bytes, SHA-256 
9305e09d781778893dd5c77a4b4dd211dd85c3c9c224c4a56c41b68ba7867e56
  public record: https://osv.dev/vulnerability/OSV-2023-297
  stock binary: ERROR: invalid read, exit 139 (SIGSEGV): crashed
  ASan rebuild: ERROR: segmentation fault (read)
  fix applied: clean on both builds

-- Shown only by the AddressSanitizer rebuild --

* OSV-2022-1121  upstream: Global-buffer-overflow in get_unpack_proc
  upstream fix commit (ghostpdl): fa394e79b7e2228aacc4c8366cd41c3b2d6b05f5
  command: gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=xpswrite -o /dev/null 
<input>
  input: public OSS-Fuzz testcase, 166056 bytes, SHA-256 
d939899acf92f873b9bcc638120e5128fa7b0e04bf4f0ba1eb9d5fce494515ef
  public record: https://osv.dev/vulnerability/OSV-2022-1121
  stock binary: no error reported
  ASan rebuild: ERROR: global-buffer-overflow (read)
  fix applied: clean (ASan rebuild)

Attachment: OSV-2022-866.diff
Description: OSV-2022-866.diff

Attachment: OSV-2022-888.diff
Description: OSV-2022-888.diff

Attachment: OSV-2022-926.diff
Description: OSV-2022-926.diff

Attachment: OSV-2022-949.diff
Description: OSV-2022-949.diff

Attachment: OSV-2022-1021.diff
Description: OSV-2022-1021.diff

Attachment: OSV-2022-1097.diff
Description: OSV-2022-1097.diff

Attachment: OSV-2022-1121.diff
Description: OSV-2022-1121.diff

Attachment: OSV-2022-1148.diff
Description: OSV-2022-1148.diff

Attachment: OSV-2022-1194.diff
Description: OSV-2022-1194.diff

Attachment: OSV-2023-88.diff
Description: OSV-2023-88.diff

Attachment: OSV-2023-285.diff
Description: OSV-2023-285.diff

Attachment: OSV-2023-297.diff
Description: OSV-2023-297.diff

Attachment: OSV-2023-1079.diff
Description: OSV-2023-1079.diff

Attachment: OSV-2024-80.diff
Description: OSV-2024-80.diff

Attachment: OSV-2024-251.diff
Description: OSV-2024-251.diff

Reply via email to