CVE-2022-0907
Description
Unchecked Return Value to NULL Pointer Dereference in tiffcrop in libtiff 4.3.0 allows 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 f2b656e2.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
3Patches
Vulnerability mechanics
Root cause
"Unchecked return value from memory allocation leads to NULL pointer dereference in _TIFFmemset."
Attack vector
An attacker supplies a crafted TIFF file that triggers a memory allocation failure (the allocation of 271,321,920 bytes exceeds the default limit of 268,435,456 bytes) [ref_id=1]. The `createImageSection` function does not check whether the allocation succeeded before passing the result to `_TIFFmemset`, causing a write to address zero and a segmentation fault [ref_id=1]. No authentication or special network access is required; the victim only needs to run `tiffcrop` on the malicious file.
Affected code
The crash occurs in `_TIFFmemset` at `libtiff/tif_unix.c:340`, called from `createImageSection` in `tools/tiffcrop.c:7410`, which is invoked by `writeImageSections` at `tools/tiffcrop.c:7096` and ultimately from `main` at `tools/tiffcrop.c:2451` [ref_id=1]. The root cause is an unchecked return value that leads to a NULL pointer dereference.
What the fix does
The fix is available in commit `f2b656e2` [ref_id=1]. The patch adds a return-value check after the memory allocation in `createImageSection` so that if the allocation fails, the function returns an error instead of proceeding with a NULL pointer. This prevents the subsequent `_TIFFmemset` call from dereferencing a NULL address, closing the denial-of-service vector.
Preconditions
- inputVictim runs tiffcrop on a crafted TIFF file
- configThe crafted TIFF triggers a memory allocation that exceeds the default limit (268,435,456 bytes)
Reproduction
Build libtiff with AddressSanitizer (`CFLAGS="-g -fsanitize=address -fno-omit-frame-pointer" ./configure --disable-shared`), then run: `./build_asan/bin/tiffcrop -H 341 poc /tmp/foo` where `poc` is the crafted TIFF file [ref_id=1]. The tool will crash with a SEGV in `_TIFFmemset` due to a NULL pointer dereference [ref_id=1].
Generated on May 24, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
8- 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/gitlab-org/cves/-/blob/master/2022/CVE-2022-0907.jsonmitre
- gitlab.com/libtiff/libtiff/-/issues/392mitre
- gitlab.com/libtiff/libtiff/-/merge_requests/314mitre
- security.netapp.com/advisory/ntap-20220506-0002/mitre
News mentions
0No linked articles in our index yet.