CVE-2026–65650
Elgg's avatar upload handler passed user-supplied images to the GD library without bounding their pixel dimensions or decoded memory cost. A single low-privileged user could upload a small, highly compressed image with huge dimensions and force the server to allocate hundreds of megabytes, potentially causing an out-of-memory kill of PHP-FPM workers and taking the site down.
medium.com
Published on medium.com
Open Source
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.
Context
Elgg is an open-source social networking engine used to build community platforms. Like most social platforms it lets users upload a profile avatar, and the upload path runs through actions/avatar/upload.php, which hands the file to saveIconFromUploadedFile() on the owner entity. That function takes whatever a user uploads, generates an icon, and resizes it into the various thumbnail sizes Elgg needs across the UI. It is a small piece of infrastructure that almost every account on an instance touches at least once.
The bug is an unbounded image upload in that avatar handler. A single low-privileged request can turn into a memory-exhaustion denial of service, and the researcher built a PoC to prove it. The finding is tracked as CVE-2026-65650 and GHSA-7983-35fr-8qwm, filed under CWE-770, allocation of resources without limits or throttling.
Setup
The attack needs one registered, low-privileged account and one file picker. No admin role, no rare workflow and no chained exploit are involved. The PoC is a Python script, CVE-2026-65650.py, published at github.com/swornim619/CVE-2026-65650, which uses Pillow to generate the image. The impact was observed on a 14 GB test box with no swap enabled.
Finding it
The gap is that nothing between the upload and the resize call inspects the image's dimensions. Nothing bounds how large the decoded bitmap is allowed to be, and nothing checks the ratio between the file's on-disk size and what it claims to decode to.
That matters because of how PHP's GD library works. GD does not care about a file's size on disk. It allocates memory based on the image's pixel dimensions once decoded: width times height times bytes per pixel. A PNG can compress an enormous canvas down to a few hundred kilobytes on disk and still demand hundreds of megabytes the instant GD decodes it into memory to resize it. So the attack shape is simple: craft an image with extreme dimensions but a small compressed footprint, upload it as an avatar, and let GD do the rest. No exploit chain, no privilege escalation, just a decode operation that costs far more than the file it operates on suggests.
Exploitation
Step 1: generate the image
The script creates a genuine, decodable image rather than a header trick that GD might reject outright. It uses Pillow to create a 10,000 by 10,000 pixel RGB canvas filled with a single solid colour, then saves it as a PNG at maximum compression:
width = 10000
height = 10000
# Create real image with actual pixel data
img = Image.new('RGB', (width, height), color=(255, 0, 0))
img.save('CVE-2026-65650.png', format='PNG', compress_level=9)
A solid-colour canvas compresses extremely well, which is exactly the point. PNG's compression collapses a huge, uniform pixel grid down to a small file, but GD still has to reconstruct the full 10,000 by 10,000 grid in memory before it can do anything with it.
The script computes the expected cost directly from the dimensions, at 3 bytes per pixel for RGB, and prints it alongside the actual file size so the gap between the two is obvious before the upload even happens:
mem = (width * height * 3) / (1024 * 1024)
print(f" Memory GD needs to decode : ~{mem:.0f} MB")
print(f" Memory GD needs to resize : ~{mem*2:.0f} MB (src + dst buffer)")
Run it with python3 CVE-2026-65650.py to produce CVE-2026-65650.png.
Step 2: log in as a low-privileged user
Any registered, low-privileged account is enough.
Step 3: upload the file as an avatar
Navigate to Profile > Edit Avatar and upload the generated file. The upload path runs through actions/avatar/upload.php, which pulls the uploaded file and immediately hands it off:
$avatar = elgg_get_uploaded_file('avatar', false);if (!$owner->saveIconFromUploadedFile('avatar')) { return elgg_error_response(elgg_echo('avatar:resize:fail'));}
Nothing between the upload and the resize call inspects the image's dimensions.
Result
The result was consistent every time. Uploading the roughly 308 KB file forced GD to allocate around 286 MB just to decode it, matching the script's own estimate, then another 572 MB on top of that to resize it, for close to 850 MB total from a single request. On the 14 GB test box with no swap enabled, one upload dropped available memory to about 1.3 GB.
That is from one request, from one account. Nothing about the attack requires elevated privileges or repeated attempts. Concurrent or repeated uploads from multiple accounts compound the effect further and push a memory-constrained deployment toward an OOM kill of PHP-FPM workers, which takes the site down without any self-recovery path.
Root cause
The root cause is a missing bound, not a logic error. saveIconFromUploadedFile() trusts whatever dimensions the uploaded image claims to have and proceeds straight into decode and resize. Nothing in the path validates that a file's claimed dimensions are reasonable relative to its actual size on disk, and nothing caps the memory an avatar upload is allowed to consume.
This is the same failure pattern that shows up across a lot of image and file-upload handling: file size on disk is not a proxy for decoded memory cost, and any code path that decodes user-supplied media needs its own explicit ceiling, independent of whatever the file format's compression happens to achieve.
Impact
A single authenticated, low-privileged user can upload a roughly 308 KB PNG and force the server to allocate close to 850 MB decoding and resizing it. On memory-constrained deployments that is enough to trigger a kernel OOM kill of PHP-FPM workers and take the site down, with no self-recovery. Concurrent or repeated uploads from multiple accounts compound the effect.
GitHub's advisory rates the issue moderate severity with a CVSS v3.1 base score of 4.3 (network vector, low attack complexity, low privileges required, no user interaction, availability impact only). That score reads lower than the practical impact might suggest, mostly because CVSS scores a single request's theoretical worst case rather than what happens when several accounts fire uploads concurrently. On a memory-constrained box, that gap between the standardised score and the operational reality is worth keeping in mind when triaging findings like this one.
Fix
The fix landed in Elgg/Elgg#15041 (commit ab91d59) and shipped in Elgg 6.3.5, with the same fix carried into the final 7.0.0 release after the 7.0 release candidates. CVE-2026-65650 covers the Elgg 6.x line before 6.3.5, along with the 7.0.0 release candidates before the final 7.0.0 release.
Variants to test
What happened, in plain words
Elgg is a piece of open-source software that people use to build their own social networks, a bit like a small, self-hosted Facebook. Every user on an Elgg site can upload a picture to use as their profile picture, which the site calls an avatar. When you upload that picture, the server does not just store it. It opens the picture, shrinks it, and makes several smaller copies for different places on the page (a tiny one next to your name, a bigger one on your profile).
The researcher found that this shrinking step has no limit on how much work it will do. A picture file can be tiny on disk, a few hundred kilobytes, and still describe a gigantic image, for example 10,000 pixels wide by 10,000 pixels tall. The software that opens the picture, a library called GD, has to build the whole giant image in the server's memory before it can shrink it. Memory is the working space a computer uses to hold things it is actively doing something with, and it is finite. A small file can therefore force the server to use hundreds of megabytes of memory, and if several people do it at once, the server runs out and the site goes down.
This kind of bug is called a denial of service: the attacker does not steal data or take over the site, they just make it stop working for everyone. The researcher built a small program to prove it, reported it to the Elgg maintainers, and they released a fix. The issue is tracked as CVE-2026-65650 and GHSA-7983-35fr-8qwm, filed under CWE-770, allocation of resources without limits or throttling.
A few terms before we start. A CVE is a public catalogue number for a known security flaw, so people can talk about the same bug unambiguously. A GHSA is GitHub's own advisory identifier for the same kind of thing. CWE-770 is a category label meaning "the program hands out resources without any cap". A PoC, short for proof of concept, is a small demonstration that shows the bug is real.
Background: how avatars work in Elgg
Elgg is an open-source social networking engine used to build community platforms. Like most social platforms it lets users upload a profile avatar. The upload path runs through actions/avatar/upload.php, which hands the file to saveIconFromUploadedFile() on the owner entity.
In plain words: when you pick a file in the browser and press upload, the browser sends the file to a specific address on the server. That address is handled by a file called actions/avatar/upload.php. That file then calls a function, saveIconFromUploadedFile(), which is a named block of code that does the actual work of turning your upload into an icon. The "owner entity" is just the account the avatar belongs to.
That function takes whatever a user uploads, generates an icon, and resizes it into the various thumbnail sizes Elgg needs across the UI. UI means user interface, the parts of the page you see and click. It is a small piece of infrastructure that almost every account on an instance touches at least once. An instance is one running copy of Elgg, one website.
Why does this matter? Because a bug in a feature that everybody uses is much more dangerous than a bug in a feature almost nobody uses. The attacker does not need to be an administrator, does not need a rare sequence of clicks, and does not need to combine several bugs. They need one ordinary account and one file picker, the little dialog your browser shows when you choose a file to upload.
The bug: no limit on how big the picture is allowed to be
The gap is that nothing between the upload and the resize call inspects the image's dimensions. Dimensions means width and height in pixels. Nothing bounds how large the decoded bitmap is allowed to be, and nothing checks the ratio between the file's on-disk size and what it claims to decode to.
A bitmap is the raw grid of coloured dots that a picture becomes once it is unpacked. A decoder is the piece of software that unpacks it. "On-disk size" is how many bytes the file takes up when stored, which is what you see in your file manager.
That matters because of how PHP's GD library works. PHP is the programming language Elgg is written in, and GD is a helper library inside PHP for handling images. GD does not care about a file's size on disk. It allocates memory based on the image's pixel dimensions once decoded: width times height times bytes per pixel. Allocates means reserves for its own use. Bytes per pixel is how much memory one dot costs; a simple colour picture uses three bytes per dot, one each for red, green and blue.
A PNG can compress an enormous canvas down to a few hundred kilobytes on disk and still demand hundreds of megabytes the instant GD decodes it into memory to resize it. PNG is a common image file format, and compression is the trick of storing repeated information only once. A picture that is one solid colour is extremely repetitive, so it compresses very well.
An everyday comparison: imagine a document that says "paint the whole wall red". That sentence is short, a few words on disk. But actually painting the wall takes a lot of paint and a lot of time. The file is the sentence; the memory GD needs is the paint. GD reads the sentence and then has to buy all the paint.
So the attack shape is simple: craft an image with extreme dimensions but a small compressed footprint, upload it as an avatar, and let GD do the rest. No exploit chain, no privilege escalation, just a decode operation that costs far more than the file it operates on suggests. An exploit chain is several bugs used one after another; privilege escalation means going from an ordinary account to an administrator one. Neither is needed here.
Building the proof of concept
The attack needs one registered, low-privileged account and one file picker. No admin role, no rare workflow and no chained exploit are involved. The PoC is a Python script, CVE-2026-65650.py, published at github.com/swornim619/CVE-2026-65650, which uses Pillow to generate the image. Python is a programming language, and Pillow is a free library for Python that creates and edits images. The impact was observed on a 14 GB test box with no swap enabled. A box here means a test server with 14 gigabytes of memory. Swap is disk space the computer can borrow as emergency memory when the real memory runs out; with swap disabled, there is no such safety net.
Step 1: generate the image
The script creates a genuine, decodable image rather than a header trick that GD might reject outright. A header trick would mean writing fake dimensions into the file's header, the small block of information at the start of an image file, without the actual picture data to match. GD might notice the mismatch and refuse the file, so the researcher made a real image instead. It uses Pillow to create a 10,000 by 10,000 pixel RGB canvas filled with a single solid colour, then saves it as a PNG at maximum compression. RGB means red, green and blue, the three colour channels that make up a normal colour picture.
width = 10000
height = 10000
Line by line: the first line stores the number 10,000 in a variable called width, which is just a labelled box holding a value. The second line stores 10,000 in height. These two numbers are the size of the picture the script is about to make.
# Create real image with actual pixel data
img = Image.new('RGB', (width, height), color=(255, 0, 0))
img.save('CVE-2026-65650.png', format='PNG', compress_level=9)
Line by line: the first line is a comment, starting with #, which the computer ignores; it is a note for humans. The second line asks Pillow to create a new image: 'RGB' says it is a colour image, (width, height) says how big, and color=(255, 0, 0) says every pixel is pure red, because 255 red, 0 green and 0 blue is red. The third line saves that image to a file named CVE-2026-65650.png, in PNG format, with compress_level=9, the highest compression setting.
A solid-colour canvas compresses extremely well, which is exactly the point. PNG's compression collapses a huge, uniform pixel grid down to a small file, but GD still has to reconstruct the full 10,000 by 10,000 grid in memory before it can do anything with it.
The script computes the expected cost directly from the dimensions, at 3 bytes per pixel for RGB, and prints it alongside the actual file size so the gap between the two is obvious before the upload even happens:
mem = (width * height * 3) / (1024 * 1024)
print(f" Memory GD needs to decode : ~{mem:.0f} MB")
print(f" Memory GD needs to resize : ~{mem*2:.0f} MB (src + dst buffer)")
Line by line: the first line multiplies width by height to count the pixels, multiplies by 3 because each pixel needs three bytes, and divides by 1024 twice to convert bytes into megabytes. The result is stored in mem. The second line prints a sentence showing that number, rounded to a whole number, as the memory needed just to decode the picture. The third line prints the memory needed to resize it, which is roughly double, because the program needs one buffer for the original picture and one for the resized copy. A buffer is a temporary holding area in memory.
Run it with python3 CVE-2026-65650.py to produce CVE-2026-65650.png. python3 is the command that runs a Python script, and the rest is the name of the script file.
Step 2: log in as a low-privileged user
Any registered, low-privileged account is enough. Low-privileged means an ordinary user with no special rights. This step matters because it shows the bug is not hidden behind an admin-only feature: anyone who can sign up can trigger it.
Step 3: upload the file as an avatar
Navigate to Profile > Edit Avatar and upload the generated file. The upload path runs through actions/avatar/upload.php, which pulls the uploaded file and immediately hands it off:
$avatar = elgg_get_uploaded_file('avatar', false);if (!$owner->saveIconFromUploadedFile('avatar')) { return elgg_error_response(elgg_echo('avatar:resize:fail'));}
Line by line: the first statement asks Elgg for the file the user just uploaded under the name avatar and stores it in a variable called $avatar. The second statement calls saveIconFromUploadedFile('avatar') on the owner, which is the function that decodes and resizes the picture. The ! in front means "if this fails". If it fails, the code returns an error response with the message avatar:resize:fail, which is the text the user would see if resizing did not work. The important part is what is missing: between receiving the file and calling the resize function, nothing looks at the picture's dimensions.
Nothing between the upload and the resize call inspects the image's dimensions. That single missing check is the whole bug.
Result
The result was consistent every time. Uploading the roughly 308 KB file forced GD to allocate around 286 MB just to decode it, matching the script's own estimate, then another 572 MB on top of that to resize it, for close to 850 MB total from a single request. KB means kilobytes, MB means megabytes; 308 KB is about the size of a small photo, while 850 MB is a large chunk of a server's memory.
On the 14 GB test box with no swap enabled, one upload dropped available memory to about 1.3 GB. Available memory is the free memory the system still has for other work. Going from 14 GB to 1.3 GB from one upload shows how much headroom a single request can eat.
That is from one request, from one account. Nothing about the attack requires elevated privileges or repeated attempts. Concurrent or repeated uploads from multiple accounts compound the effect further and push a memory-constrained deployment toward an OOM kill of PHP-FPM workers, which takes the site down without any self-recovery path. Concurrent means at the same time. An OOM kill is what the operating system does when memory runs out: it forcibly stops a process to protect the machine. PHP-FPM workers are the processes that run Elgg's PHP code and serve pages; killing them means the site stops answering. No self-recovery path means it does not come back on its own.
Root cause
The root cause is a missing bound, not a logic error. A bound is a limit. A logic error would be code that does the wrong calculation; here the code does exactly what it was written to do, it just was never told to stop. saveIconFromUploadedFile() trusts whatever dimensions the uploaded image claims to have and proceeds straight into decode and resize. Nothing in the path validates that a file's claimed dimensions are reasonable relative to its actual size on disk, and nothing caps the memory an avatar upload is allowed to consume.
This is the same failure pattern that shows up across a lot of image and file-upload handling: file size on disk is not a proxy for decoded memory cost, and any code path that decodes user-supplied media needs its own explicit ceiling, independent of whatever the file format's compression happens to achieve. A proxy is a stand-in; here, file size is a bad stand-in for memory cost. A ceiling is a hard maximum.
Impact
A single authenticated, low-privileged user can upload a roughly 308 KB PNG and force the server to allocate close to 850 MB decoding and resizing it. Authenticated simply means logged in. On memory-constrained deployments that is enough to trigger a kernel OOM kill of PHP-FPM workers and take the site down, with no self-recovery. A deployment is one installed and running copy of the software. The kernel is the core of the operating system that decides which process gets stopped when memory runs out. Concurrent or repeated uploads from multiple accounts compound the effect.
GitHub's advisory rates the issue moderate severity with a CVSS v3.1 base score of 4.3 (network vector, low attack complexity, low privileges required, no user interaction, availability impact only). CVSS is a standard scoring system for security flaws, from 0 to 10. Network vector means the attacker works over the internet rather than sitting at the machine. Low complexity means no special conditions are needed. Low privileges means an ordinary account is enough. No user interaction means no victim has to click anything. Availability impact only means the harm is to whether the site works, not to the secrecy or integrity of data.
That score reads lower than the practical impact might suggest, mostly because CVSS scores a single request's theoretical worst case rather than what happens when several accounts fire uploads concurrently. On a memory-constrained box, that gap between the standardised score and the operational reality is worth keeping in mind when triaging findings like this one. Triaging means deciding how urgently to deal with a reported issue.
Fix
The fix landed in Elgg/Elgg#15041 (commit ab91d59) and shipped in Elgg 6.3.5, with the same fix carried into the final 7.0.0 release after the 7.0 release candidates. A pull request, the #15041 part, is a proposed change to the code; a commit, ab91d59, is one saved change with a short identifier. Release candidates are near-final test versions. CVE-2026-65650 covers the Elgg 6.x line before 6.3.5, along with the 7.0.0 release candidates before the final 7.0.0 release. In other words, the 6.x line before 6.3.5 and the 7.0.0 release candidates are affected.
Resource footprint means how much memory and processing power something will need.
Variants to test
These are other places where the same idea might work, useful if you are learning to look for this kind of bug yourself.
Glossary
- Avatar: the profile picture a user uploads to represent themselves on a site.
- Bitmap: the raw grid of coloured dots a picture becomes once unpacked in memory.
- Bound: a limit placed on something, such as how much memory an operation may use.
- Buffer: a temporary holding area in memory for data being worked on.
- Byte: a unit of digital storage, roughly one character of text.
- Commit: one saved change to a codebase, identified by a short code such as
ab91d59. - Compression: storing repeated information only once so a file takes less space on disk.
- Concurrent: happening at the same time.
- CVE: a public catalogue number for a known security flaw.
- CVSS: a standard 0 to 10 scoring system for the severity of a security flaw.
- CWE-770: a category label for programs that allocate resources without limits or throttling.
- Decoder: software that unpacks a stored file, such as an image, into its raw form.
- Denial of service: an attack that makes a service stop working for its normal users.
- Deployment: one installed and running copy of a piece of software.
- Dimensions: the width and height of an image, measured in pixels.
- Endpoint: a specific address on a server that accepts a particular kind of request.
- Exploit chain: several bugs used one after another to achieve more than any one alone.
- GD: a PHP library for creating and resizing images.
- GHSA: GitHub's advisory identifier for a security flaw.
- Header: the small block of information at the start of a file describing what it contains.
- Instance: one running copy of a website or application.
- Kernel: the core of an operating system that manages memory and processes.
- KB / MB / GB: kilobytes, megabytes and gigabytes, units of digital storage that grow by roughly a thousand each step.
- Low-privileged: an ordinary user account with no special rights.
- OOM kill: the operating system forcibly stopping a process because memory ran out.
- PHP: the programming language Elgg is written in.
- PHP-FPM worker: a process that runs PHP code and serves pages for a site.
- Pillow: a free Python library for creating and editing images.
- Pixel: one dot in an image.
- PNG: a common image file format that compresses well.
- PoC (proof of concept): a small demonstration that proves a bug is real.
- Privilege escalation: going from an ordinary account to one with more rights, such as an administrator.
- Proxy: a stand-in used to estimate something else, such as file size standing in for memory cost.
- Pull request: a proposed change to a codebase, reviewed before it is merged.
- Python: a programming language, used here to generate the test image.
- Release candidate: a near-final test version of software before the official release.
- RGB: red, green and blue, the three colour channels of a normal colour image.
- Root cause: the underlying reason a bug exists, as opposed to its symptoms.
- Swap: disk space a computer can borrow as emergency memory when real memory runs out.
- Triaging: deciding how urgently to deal with a reported issue.
- UI (user interface): the parts of a page a person sees and clicks.
- Variable: a labelled box in a program that holds a value.