A 65,529-Sample Lie: How a Tiny TIFF Fooled GDAL Into Asking for 16 GB
A tiny TIFF file with an abnormal SamplesPerPixel metadata value caused GDAL's GTiff driver to request a 16.4 GB memory allocation, leading to a processing failure and denial of service. The issue was fixed upstream with a codec-aware check on realistic compression ratios.
Three kilobytes. That is all it took.
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 GTiff driver calculated an uncompressed buffer size from attacker-controlled SamplesPerPixel metadata without checking whether the claimed compressed-to-uncompressed ratio was realistic for the active codec.
Impact
A service that automatically processes attacker-controlled TIFF files through GDAL could suffer job failure, worker termination under memory limits, or repeated resource exhaustion; no confidentiality, integrity, or code-execution impact was demonstrated.
What the attacker needed
Attacker-controlled TIFF input; application processes TIFFs via GDAL
The fix
The final fix was merged into GDAL's internal libtiff, adding a codec-aware maximum compression ratio check so implausibly large decoded sizes are rejected before allocation.
How it was found
- Create a small TIFF file with an abnormal SamplesPerPixel value.
- Run gdal_translate on the file to convert it.
- Observe the error reporting a failed allocation of about 16.4 GB.
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 stores metadata that tells the decoder how big the image is. By setting one metadata field to an absurdly high number, a tiny file made the decoder try to reserve a huge amount of memory, which failed and stopped the conversion. This is a denial-of-service bug: the attacker does not steal data, they just make the program waste resources.
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.