High memory usage for generating preview of broken image
A crafted image file causes the PHP process to allocate excessive memory and CPU when a preview is generated. An attacker could upload many such files to cause a denial of service.
- Triaged in 4 hours
- Fixed in 8 months
- Paid in 8 months
- Disclosed after 8 months
When the attached file is uploaded and a preview is generated (e.g. in the folder overview of the files app), the PHP process allocates a very large amount of memory (on my machine it was shortly around 5 GByte) and CPU.
Tested with latest master (1366b35081f1d92429787696f4175c19a602858a) on Ubuntu 20.04 (php7.4-fpm). Option "memory_limit" is set to 512M.
Impact
An attacker can cause a denial of service by uploading lots of such files which will cause the server to allocate too much memory / CPU.
Attachments
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
Likely the image preview generation code does not properly limit resources when handling malformed or specially crafted image files.
What the attacker needed
Ability to upload files; preview generation enabled
How it was found
- Upload the attached file.
- Trigger preview generation, for example by opening the folder overview in the files app.
- Observe the PHP process using a very large amount of memory and CPU.
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.
When you upload a file, the server often creates a small preview image. A specially made file can make that preview step use a huge amount of memory and processing power. If someone uploads many of these files, the server can become overloaded and stop working for normal users.
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.