Skip to content
DoS Write-up Intermediate

How a ~3 KB TIFF Can Make libtiff Ask for 16 GB of Memory

A crafted TIFF file with an oversized SamplesPerPixel metadata value caused libtiff to compute a decoded buffer size of roughly 16.4 GB and attempt that allocation. An attacker could use a tiny file to exhaust memory and cause a denial of service in software that parses images with the library.

medium.com

Published on medium.com

A tiny malformed image, one oversized SamplesPerPixel tag, and a denial-of-service bug in one of the most widely used TIFF parsing libraries. Most people see a small image file and think: harmless.

Aleens-labs, on medium.com

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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the SamplesPerPixel metadata value was multiplied into the decoded buffer size calculation without a sanity check on how large the resulting allocation would be.

Impact

A small crafted TIFF could trigger an out-of-memory denial of service in any application using the affected libtiff decoding path; the text makes no code execution claim.

What the attacker needed

Attacker supplies a crafted TIFF; victim software parses it with libtiff

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 write-up has not been written yet. The Original tab links to the source.

A TIFF image file contains labels that describe the picture, such as how wide it is and how many colour values each pixel has. The library trusted one of those labels without checking whether it was realistic, so it tried to reserve a huge amount of memory for a file that was only a few kilobytes. Reserving that much memory can make the program, or the whole machine, run out of memory and stop working.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.