CVE-2022-0891
Description
A heap buffer overflow in ExtractImageSection function in tiffcrop.c in libtiff library Version 4.3.0 allows attacker to trigger unsafe or out of bounds memory access via crafted TIFF image file which could result into application crash, potential information disclosure or any other context-dependent impact
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
36- osv-coords34 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%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%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%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%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.1
< 4.0.9-23.el8+ 33 more
- (no CPE)range: < 4.0.9-23.el8
- (no CPE)range: < 4.0.9-23.el8
- (no CPE)range: < 4.0.9-23.el8
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.3.0-2.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-44.48.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-44.48.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-44.48.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
- (no CPE)range: < 4.0.9-150000.45.8.1
Patches
Vulnerability mechanics
Root cause
"Incorrect offset and size calculations in `extractImageSection` that omit the `spp` (samples per pixel) multiplier, combined with a use-after-free from `rotateImage`, cause out-of-bounds heap reads."
Attack vector
An attacker supplies a crafted TIFF image with malformed tags (e.g., missing `StripByteCounts`, invalid `PageNumber` count) and specific crop/rotate parameters (`-E l -H 10 -V 10 -S 8:4 -R 270`). When `tiffcrop` processes the image, `rotateImage` allocates a buffer, then frees it, and `extractImageSection` subsequently reads from the freed buffer (heap-use-after-free at line 6866) [ref_id=2]. The incorrect offset calculations in `extractImageSection` also cause heap buffer overflows by reading beyond the allocated region [ref_id=1].
Affected code
The vulnerability resides in `extractImageSection` in `tools/tiffcrop.c` (line 6866). The function computes buffer offsets using `shift2` and `offset2` variables that were removed in the patch; the old code used `offset2` (derived from `last_col * bps / 8`) without accounting for `spp`, leading to out-of-bounds reads. The patch also corrects the `img_rowsize` calculation and the `sectsize` computation in `writeImageSections` (line 7091) to multiply by `spp` before dividing by 8 [ref_id=1].
What the fix does
The patch removes the `shift2` and `offset2` variables and corrects all offset calculations to multiply by `spp` before dividing by 8, ensuring proper byte alignment for multi-sample pixels [ref_id=1]. It also fixes `img_rowsize` to `((img_width * spp * bps) + 7) / 8` and `full_bytes` to `(sect_width * spp * bps) / 8`, and corrects `sectsize` in `writeImageSections` to `ceil((width * bps * spp + 7) / 8.0) * length`. These changes prevent out-of-bounds reads and writes by computing accurate buffer sizes and offsets.
Preconditions
- inputAttacker must provide a crafted TIFF file that triggers the heap-use-after-free condition when processed by tiffcrop.
- inputThe tiffcrop tool must be invoked with crop/rotate flags such as '-E l -H 10 -V 10 -S 8:4 -R 270' to reach the vulnerable code path.
Reproduction
Clone libtiff source, compile with AddressSanitizer (`-fsanitize=address,undefined`), then run: `./tiffcrop -i -E l -H 10 -V 10 -S 8:4 -R 270 poc.tif a.tif` [ref_id=2]. The ASAN log confirms a heap-use-after-free read at `extractImageSection` line 6866, with the freed region originating from `rotateImage` at line 8697 [ref_id=2].
Generated on May 24, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
9- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/RNT2GFNRLOMKJ5KXM6JIHKBNBFDVZPD3/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ZQ4E654ZYUUUQNBKYQFXNK2CV3CPWTM2/mitrevendor-advisory
- security.gentoo.org/glsa/202210-10mitrevendor-advisory
- www.debian.org/security/2022/dsa-5108mitrevendor-advisory
- gitlab.com/freedesktop-sdk/mirrors/gitlab/libtiff/libtiff/-/commit/232282fd8f9c21eefe8d2d2b96cdbbb172fe7b7cmitre
- gitlab.com/gitlab-org/cves/-/blob/master/2022/CVE-2022-0891.jsonmitre
- gitlab.com/libtiff/libtiff/-/issues/380mitre
- gitlab.com/libtiff/libtiff/-/issues/382mitre
- security.netapp.com/advisory/ntap-20221228-0008/mitre
News mentions
0No linked articles in our index yet.