CVE-2022-3626
Description
LibTIFF 4.4.0 has an out-of-bounds write in _TIFFmemset in libtiff/tif_unix.c:340 when called from processCropSelections, tools/tiffcrop.c:7619, 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 236b7191.
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 input validation in tiffcrop allows unsupported option combinations that cause an undersized buffer allocation, leading to a heap-buffer-overflow in _TIFFmemset."
Attack vector
An attacker supplies a crafted TIFF file and invokes `tiffcrop` with a combination of mutually-exclusive options such as `-X 1 -Y 2 -R 180 -H 300 -V 300 -i` [ref_id=1]. The tool does not reject this unsupported option combination, causing `processCropSelections` to compute an undersized buffer in `rotateImage`. A subsequent `_TIFFmemset` write then overflows the heap buffer, leading to a crash or denial-of-service [ref_id=1].
Affected code
The out-of-bounds write occurs in `_TIFFmemset` at `libtiff/tif_unix.c:340`, called from `processCropSelections` in `tools/tiffcrop.c:7612` (line 7619 in the CVE description). The allocation path goes through `rotateImage` at `tools/tiffcrop.c:8621`, which calls `limitMalloc` and `_TIFFmalloc` [ref_id=1].
What the fix does
The patch adds a validation check in `process_command_opts` that rejects any combination of crop options (`-X`, `-Y`, `-Z`, `-z`) together with other `PAGE_MODE_x` options (`-H`, `-V`, `-P`, `-J`, `-K`) [ref_id=2]. It also updates documentation and usage strings with "Note 2" warning that such combinations are unsupported and may cause buffer overflows [ref_id=2]. By exiting early when an illegal combination is detected, the patch prevents the undersized buffer allocation and subsequent heap overflow.
Preconditions
- inputThe attacker must provide a crafted TIFF file that triggers the vulnerable code path.
- inputThe user must invoke tiffcrop with an unsupported combination of options (e.g., -X, -Y, -Z, or -z together with -H, -V, -P, -J, or -K).
Reproduction
Build libtiff with AddressSanitizer (`CFLAGS="-g -fsanitize=address -fno-omit-frame-pointer" ./configure --prefix=$PWD/build_asan --disable-shared; make -j; make install`). Then run: `./build_asan/bin/tiffcrop -X 1 -Y 2 -R 180 -H 300 -V 300 -i poc /tmp/foo` where `poc` is the crafted file from the issue tracker [ref_id=1].
Generated on May 26, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- lists.debian.org/debian-lts-announce/2023/01/msg00018.htmlmitremailing-list
- gitlab.com/gitlab-org/cves/-/blob/master/2022/CVE-2022-3626.jsonmitre
- gitlab.com/libtiff/libtiff/-/commit/236b7191f04c60d09ee836ae13b50f812c841047mitre
- gitlab.com/libtiff/libtiff/-/issues/426mitre
- security.netapp.com/advisory/ntap-20230110-0001/mitre
News mentions
0No linked articles in our index yet.