Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2023-52356-libtiff-analysis — Root-cause analysis and patch validation of CVE-2023-52356 in libtiff using AddressSanitizer and GDB. | Kitploit
Tools/GitHubGitHub/yardenbenita/cve-2023-52356-libtiff-analysis
Vulnerability AnalysisDebuggersBinary AnalysisPapers & ResearchLearning & Education
GitHubyardenbenita/cve-2023-52356-libtiff-analysis

CVE-2023-52356-libtiff-analysis

Root-cause analysis and patch validation of CVE-2023-52356 in libtiff using AddressSanitizer and GDB.

View Repository
4710 days agoNot yet reviewed
Share

CVE-2023-52356 – libtiff TIFFReadRGBATileExt Analysis

Overview

This lab analyzes CVE-2023-52356 in libtiff, focusing on the behavior of TIFFReadRGBATileExt when it receives image coordinates outside the valid image bounds.

The analysis includes reproduction of the original crash, debugging with AddressSanitizer and GDB, root-cause analysis, examination of the upstream patch, analysis of the original reproducer, and verification of the fixed version.

About libtiff

libtiff is an open-source C library used for reading, writing, and processing images in the Tagged Image File Format (TIFF).

TIFF is a flexible image format commonly used in document scanning, publishing, and scientific imaging.

From a security perspective, libtiff is an interesting research target because it processes complex, potentially untrusted image files. Incorrect handling of image dimensions, offsets, or memory boundaries can lead to memory-safety vulnerabilities.

This project investigates CVE-2023-52356, a vulnerability affecting the TIFFReadRGBATileExt function, with a focus on reproducing the issue, understanding its root cause, and examining the upstream fix.

Test Environment

  • Target: libtiff
  • Vulnerable commit: 4d0329a4
  • Fix commit: 51558511
  • Trigger file: triger_input_47
  • Tools: Clang, AddressSanitizer, GDB, CMake

Crash Reproduction

The original reproducer was compiled against the vulnerable libtiff build with AddressSanitizer enabled.

The reproducer was executed with the provided trigger file:

LD_LIBRARY_PATH="$PWD/libtiff/build-asan/libtiff" ./poc triger_input_47

The execution reproduced a segmentation fault caused by an invalid memory read. The AddressSanitizer stack trace identified the failure during a memmove operation called from TIFFReadRGBATileExt.

Root Cause Analysis

Using GDB, the crash condition was reproduced with the following runtime values:

row = 34
img.height = 33
tile_ysize = 1

The vulnerable code then executed:

read_ysize = img.height - row;

With the observed values, this calculation is:

33 - 34 = -1

Because read_ysize is unsigned, the result wrapped to:

read_ysize = 4294967295

which is UINT32_MAX.

The value of read_ysize was later used in the source pointer calculation for memmove.

Immediately before the failing memmove, GDB showed:

read_ysize = 4294967295
read_xsize = 1
tile_ysize = 1
tile_xsize = 1
i_row = 0
raster = 0x7d0ff67e2d40

The destination pointer evaluated to:

0x7d0ff67e2d40

which was the start of the raster buffer.

The source pointer evaluated to:

0x7d13f67e2d38

The calculated source pointer was 17179869176 bytes, approximately 16 GiB, beyond the start of the raster buffer.

Executing the memmove in GDB resulted in:

SIGSEGV, Segmentation fault

The backtrace showed the following crash path:

__sanitizer_internal_memmove
__asan_memmove
TIFFReadRGBATileExt at tif_getimage.c:3345
LLVMFuzzerTestOneInput at poc.cc:61

This confirms that the unsigned underflow in read_ysize produced an out-of-bounds source offset. The resulting invalid source pointer was then used by memmove, causing an invalid memory read and a segmentation fault.

Patch Analysis and Fix Validation

The upstream fix added an explicit bounds check before the vulnerable read_ysize calculation:

if (col >= img.width || row >= img.height)
{
    TIFFErrorExtR(tif, TIFFFileName(tif),
                  "Invalid row/col passed to TIFFReadRGBATile().");
    TIFFRGBAImageEnd(&img);
    return (0);
}

Using GDB on the fixed version, the following runtime values were observed:

row = 34
img.height = 33
col = 0
img.width = 2047

For these values, the new validation condition evaluates to true because:

row >= img.height
34 >= 33

The function therefore reported:

Invalid row/col passed to TIFFReadRGBATile()

and returned 0.

As a result, execution did not reach the vulnerable calculation:

read_ysize = img.height - row;

This prevents the unsigned underflow observed in the vulnerable version and stops the invalid value from being used in the later memmove source pointer calculation.

Reproducer Analysis and Preconditions

The original reproducer incorrectly calculates the number of tiles along the Y axis.

The relevant code passes the return value of TIFFGetField() directly as the Y coordinate to TIFFComputeTile():

TIFFComputeTile(
    in_tif,
    0,
    TIFFGetField(in_tif, TIFFTAG_IMAGELENGTH, &tile_height),
    0,
    0)

Using GDB, tile_height was observed to contain:

tile_height = 33

However, TIFFGetField() returned:

1

The return value indicates success; it is not the image height. Therefore, the call effectively becomes:

TIFFComputeTile(in_tif, 0, 1, 0, 0)

For this TIFF, GDB showed that this call returns:

2047

This value is a tile index, not the number of tiles along the Y axis.

The original reproducer then used this value in its calculation of num_tiles_y, resulting in:

num_tiles_y = 63

However, the image dimensions and tile dimensions are:

image_width  = 2047
image_height = 33
tile_width   = 1
tile_height  = 1

Therefore, the correct number of tiles along the Y axis is:

num_tiles_y = 33

The incorrect value of 63 causes the loop to iterate with Y values from 0 through 62, even though the image height is 33 and the valid Y coordinates are only 0 through 32.

This allows an invalid value such as:

row = 34

to be passed to TIFFReadRGBATileExt.

The vulnerable libtiff version did not reject this out-of-range coordinate before performing the unsigned img.height - row calculation. This allowed the invalid API input generated by the reproducer to become a memory-safety failure.

The maintainer-provided corrected reproducer calculates the number of tiles directly from the image and tile dimensions.

For the same TIFF, the corrected calculation produces:

num_tiles_x = 2047
num_tiles_y = 33

The corrected reproducer was tested against the same vulnerable libtiff build and the same trigger file.

The program exited with status 0, and no AddressSanitizer or SIGSEGV report was produced.

This supports the maintainer's observation that the original reproducer contains an incorrect tile-count calculation. However, the vulnerable libtiff version still lacked defensive row and column validation, allowing invalid API coordinates to result in a memory-safety failure.

Validation Summary

Reproducerlibtiff VersionResult
Original PoCVulnerable (4d0329a4)Invalid read and SIGSEGV in memmove
Corrected reproducerVulnerable (4d0329a4)Exit status 0, no ASan/SEGV
Original PoCFixed (51558511)Invalid row/col rejected, no ASan/SEGV

Conclusion

The crash in TIFFReadRGBATileExt occurs when an out-of-range image coordinate reaches the vulnerable libtiff implementation.

In the original reproducer, an incorrect tile-count calculation causes num_tiles_y to be calculated as 63 instead of the correct value 33. As a result, the reproducer can pass a row outside the valid image range to TIFFReadRGBATileExt.

In the vulnerable libtiff version, the row and column arguments were not validated before the calculation:

read_ysize = img.height - row;

For the reproduced case, row was 34 while img.height was 33. Because read_ysize is unsigned, the subtraction underflowed to UINT32_MAX. This value was subsequently used in the source pointer calculation for memmove, producing an invalid memory read and a segmentation fault.

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    945
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    555
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    350
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    339
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    338
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    292

Explore all tools

Browse our collection of tools

View all tools →