CVE-2022-3627
Description
LibTIFF 4.4.0 has an out-of-bounds write in _TIFFmemcpy in libtiff/tif_unix.c:346 when called from extractImageSection, tools/tiffcrop.c:6860, 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 `process_command_opts` allows mutually exclusive crop and page-mode options to be combined, leading to an undersized buffer allocation and a subsequent heap-buffer-overflow in `_TIFFmemcpy`."
Attack vector
An attacker supplies a crafted TIFF file and invokes `tiffcrop` with a combination of mutually exclusive options — specifically, any of `-X`, `-Y`, `-Z`, or `-z` together with other `PAGE_MODE_x` options such as `-H`, `-V`, `-P`, `-J`, or `-K` [ref_id=2]. The reproducer uses `tiffcrop -Z 1:4,3:3 -R 90 -H 300 -i poc2 /tmp/foo` [ref_id=1]. The tool reads the malformed image, allocates a buffer based on incorrect size calculations, and then `_TIFFmemcpy` writes beyond the allocated heap region, causing a heap-buffer-overflow [ref_id=1]. No authentication or special network access is required; the attacker only needs to deliver the crafted file to a victim who runs `tiffcrop` on it.
Affected code
The out-of-bounds write occurs in `_TIFFmemcpy` at `libtiff/tif_unix.c:346`, called from `extractImageSection` at `tools/tiffcrop.c:6860` [ref_id=1]. The allocation is performed by `limitMalloc` at `tools/tiffcrop.c:627` during `loadImage` at `tools/tiffcrop.c:6220` [ref_id=1]. The patch adds a validation check in `process_command_opts` at `tools/tiffcrop.c:2143` to reject unsafe option combinations before they reach the image-processing code [ref_id=2].
What the fix does
The commit [ref_id=2] adds a new validation block in `process_command_opts` that checks whether any of the crop options (`-X`, `-Y`, `-Z`, `-z`) are active together with other `PAGE_MODE_x` options (such as `-H`, `-V`, `-P`, `-J`, `-K`). If such a combination is detected, the program prints an error and exits immediately with `EXIT_FAILURE`. The patch also updates all documentation strings (the file header comment, the `usage_info` string, and the `tiffcrop` man page) with a new "Note 2" explicitly warning that these option combinations are unsupported and may cause buffer overflows [ref_id=2]. By rejecting the dangerous option combination at the argument-parsing stage, the fix prevents the corrupted state that led to the heap-buffer-overflow in `extractImageSection`.
Preconditions
- inputVictim must run tiffcrop with a combination of -X/-Y/-Z/-z and -H/-V/-P/-J/-K options on the attacker-supplied file.
- inputThe crafted TIFF file must trigger the malformed internal state that leads to the incorrect buffer allocation.
Reproduction
1. 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` [ref_id=1]. 2. Obtain the PoC file `poc2` from the issue attachment [ref_id=1]. 3. Run: `./build_asan/bin/tiffcrop -Z 1:4,3:3 -R 90 -H 300 -i poc2 /tmp/foo` [ref_id=1]. 4. Observe the AddressSanitizer heap-buffer-overflow report at `_TIFFmemcpy` in `tif_unix.c:346` [ref_id=1].
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-3627.jsonmitre
- gitlab.com/libtiff/libtiff/-/commit/236b7191f04c60d09ee836ae13b50f812c841047mitre
- gitlab.com/libtiff/libtiff/-/issues/411mitre
- security.netapp.com/advisory/ntap-20230110-0001/mitre
News mentions
0No linked articles in our index yet.