Skip to content
Memory corruption Advisory Advanced CVE-2016-5652

LibTIFF TIFF2PDF TIFFTAG_JPEGTABLES Remote Code Execution Vulnerability

A heap-based buffer overflow in LibTIFF's TIFF2PDF tool occurs when processing a crafted TIFF image with JPEG compression and JPEG tables, due to a size calculation error that allocates a buffer two bytes too small. An attacker could exploit this to cause a crash or potentially achieve remote code execution.

Tyler Bohan Follow

Originally disclosed on Cisco Talos

Medium 6.4 View original

An exploitable heap based buffer overflow exists in the handling of TIFF images in LibTIFF’s TIFF2PDF tool. A crafted TIFF document can lead to a heap based buffer overflow resulting in remote code execution.

Tyler Bohan, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The size calculation for the JPEG tables buffer subtracts 2 from the required size, but the subsequent copy uses the full size, causing a 2-byte overflow.

Impact

The overflow corrupts heap memory, causing a crash and potentially enabling remote code execution.

What the attacker needed

Victim opens a crafted TIFF file

How it was found

  1. Create a TIFF image with JPEG compression and JPEG tables.
  2. Run the TIFF2PDF tool on the crafted TIFF file.
  3. The tool calculates the buffer size incorrectly, leading to a heap overflow during copying.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This report describes a bug in a tool that converts TIFF images to PDF. When the tool reads a special TIFF file, it sets aside a small memory space but then copies slightly more data into it, overflowing into neighbouring memory. This can crash the program or, in the worst case, let an attacker run their own code.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Tyler Bohan

View all

84 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.