CVE-2022-3599
Description
LibTIFF 4.4.0 has an out-of-bounds read in writeSingleSection in tools/tiffcrop.c:7345, allowing attackers to cause a denial-of-service via a crafted tiff file. For users that compile libtiff from sources, the fix is available with commit e8131125.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
45- osv-coords43 versionspkg:rpm/almalinux/libtiffpkg:rpm/almalinux/libtiff-develpkg:rpm/almalinux/libtiff-toolspkg:rpm/opensuse/tiff&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/tiff&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/tiff&distro=openSUSE%20Leap%20Micro%205.2pkg:rpm/opensuse/tiff&distro=openSUSE%20Leap%20Micro%205.3pkg:rpm/opensuse/tiff&distro=openSUSE%20Tumbleweedpkg:rpm/suse/tiff&distro=SUSE%20Enterprise%20Storage%206pkg:rpm/suse/tiff&distro=SUSE%20Enterprise%20Storage%207pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-ESPOSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP1-LTSSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP2-ESPOSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP2-LTSSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-ESPOSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-LTSSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Micro%205.2pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Micro%205.3pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP3pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP4pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Desktop%20Applications%2015%20SP3pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Package%20Hub%2015%20SP3pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Package%20Hub%2015%20SP4pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP2-BCLpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP3-BCLpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP4-LTSSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP5pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-BCLpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP1-LTSSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP2-BCLpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP2-LTSSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%2015-LTSSpkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP4pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP5pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP1pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP2pkg:rpm/suse/tiff&distro=SUSE%20Linux%20Enterprise%20Software%20Development%20Kit%2012%20SP5pkg:rpm/suse/tiff&distro=SUSE%20Manager%20Proxy%204.1pkg:rpm/suse/tiff&distro=SUSE%20Manager%20Retail%20Branch%20Server%204.1pkg:rpm/suse/tiff&distro=SUSE%20Manager%20Server%204.1pkg:rpm/suse/tiff&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/tiff&distro=SUSE%20OpenStack%20Cloud%20Crowbar%209
< 4.4.0-7.el9+ 42 more
- (no CPE)range: < 4.4.0-7.el9
- (no CPE)range: < 4.4.0-7.el9
- (no CPE)range: < 4.4.0-7.el9
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.4.0-5.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-44.59.1
- (no CPE)range: < 4.0.9-44.59.1
- (no CPE)range: < 4.0.9-44.59.1
- (no CPE)range: < 4.0.9-44.59.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-44.59.1
- (no CPE)range: < 4.0.9-44.59.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-44.59.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-150000.45.19.1
- (no CPE)range: < 4.0.9-44.59.1
- (no CPE)range: < 4.0.9-44.59.1
Patches
Vulnerability mechanics
Root cause
"Missing bounds validation when handling a malformed InkNames tag that lacks a null terminator leads to a heap-buffer-overflow read in writeSingleSection."
Attack vector
An attacker crafts a TIFF file with a malformed `InkNames` tag whose ASCII value does not end in a null byte, as shown by the warning "ASCII value for tag 'InkNames' does not end in null byte. Forcing it to be null." [ref_id=2]. When `tiffcrop` reads this file (e.g., `tiffcrop -H 341 poc /tmp/foo`), the forced null-termination can produce a buffer whose actual allocated size is smaller than the string length the code expects, leading to a heap-buffer-overflow read of size 1 at `writeSingleSection` [ref_id=2]. The attack requires no authentication and is delivered via a crafted TIFF file opened by the victim.
Affected code
The out-of-bounds read occurs in `writeSingleSection` at `tools/tiffcrop.c:7345` [ref_id=2]. The heap-buffer-overflow is triggered when `tiffcrop` processes a crafted TIFF file whose `InkNames` tag contains data that does not end with a null byte, causing the ASCII value to be forced null-terminated by `TIFFFetchNormalTag` [ref_id=2]. The allocation trace shows the buffer was allocated via `_TIFFsetNString` in `_TIFFVSetField` (tif_dir.c:485) [ref_id=2].
What the fix does
The fix (commit e8131125) [ref_id=1] replaces the old `checkInkNamesString` function with a new `countInkNamesString` function that safely counts null-separated ink names within the buffer bounds. It also adds proper validation when setting `TIFFTAG_INKNAMES` and `TIFFTAG_NUMBEROFINKS`, ensuring `NumberOfInks` is derived from the actual count of ink names in the string rather than trusting a potentially mismatched value. Additionally, `FIELD_NUMBEROFINKS` is promoted from `FIELD_CUSTOM` to a proper well-known field, and the `_TIFFVGetField` handler for `NumberOfInks` now returns `td->td_numberofinks` directly instead of truncating from custom values [ref_id=1].
Preconditions
- inputVictim must open a crafted TIFF file using tiffcrop
- inputThe crafted TIFF file must contain an InkNames tag whose ASCII value lacks a terminating null byte
Reproduction
Build libtiff with AddressSanitizer: `CFLAGS="-g -fsanitize=address -fno-omit-frame-pointer" CXXFLAGS="-g -fsanitize=address -fno-omit-frame-pointer" ./configure --prefix=$PWD/build_asan --disable-shared && make -j && make install`. Then run: `./build_asan/bin/tiffcrop -H 341 poc /tmp/foo` using the attached PoC file [ref_id=2]. The tool will output various TIFF warnings and then crash with an AddressSanitizer heap-buffer-overflow at `writeSingleSection` [ref_id=2].
Generated on May 26, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- www.debian.org/security/2023/dsa-5333mitrevendor-advisory
- lists.debian.org/debian-lts-announce/2023/01/msg00018.htmlmitremailing-list
- gitlab.com/gitlab-org/cves/-/blob/master/2022/CVE-2022-3599.jsonmitre
- gitlab.com/libtiff/libtiff/-/commit/e813112545942107551433d61afd16ac094ff246mitre
- gitlab.com/libtiff/libtiff/-/issues/398mitre
- security.netapp.com/advisory/ntap-20230110-0001/mitre
News mentions
0No linked articles in our index yet.