VDB
Sign up
MEDIUM5.3

GHSA-g2pr-qxjg-7r2w

ImageMagick has memory leak of watermark Image object in ReadSTEGANOImage on multiple error/early-return paths

Quick fix

GHSA-g2pr-qxjg-7r2w — Magick.NET-Q16-AnyCPU: upgrade to the fixed version with the command below.

dotnet add package Magick.NET-Q16-AnyCPU --version 14.10.3

Details

### Summary

In `ReadSTEGANOImage()` (`coders/stegano.c`), the `watermark` Image object is not freed on three early-return paths, resulting in a definite memory leak (~13.5KB+ per invocation) that can be exploited for denial of service.

``` Direct leak of 13512 byte(s) in 1 object(s) allocated from: #0 0x7f5c11e27887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x55cdc38f65c4 in AcquireMagickMemory MagickCore/memory.c:536 #2 0x55cdc38f65eb in AcquireCriticalMemory MagickCore/memory.c:612 #3 0x55cdc3899e91 in AcquireImage MagickCore/image.c:154 ```

Are you affected?

Enter the version of the package you're using.

Affected packages

NuGet/Magick.NET-Q16-AnyCPU
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-AnyCPU --version 14.10.3
NuGet/Magick.NET-Q16-HDRI-AnyCPU
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-HDRI-AnyCPU --version 14.10.3
NuGet/Magick.NET-Q16-HDRI-OpenMP-arm64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-HDRI-OpenMP-arm64 --version 14.10.3
NuGet/Magick.NET-Q16-HDRI-OpenMP-x64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-HDRI-OpenMP-x64 --version 14.10.3
NuGet/Magick.NET-Q16-HDRI-arm64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-HDRI-arm64 --version 14.10.3
NuGet/Magick.NET-Q16-HDRI-x64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-HDRI-x64 --version 14.10.3
NuGet/Magick.NET-Q16-HDRI-x86
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-HDRI-x86 --version 14.10.3
NuGet/Magick.NET-Q16-OpenMP-arm64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-OpenMP-arm64 --version 14.10.3
NuGet/Magick.NET-Q16-OpenMP-x64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-OpenMP-x64 --version 14.10.3
NuGet/Magick.NET-Q16-OpenMP-x86
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-OpenMP-x86 --version 14.10.3
NuGet/Magick.NET-Q16-arm64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-arm64 --version 14.10.3
NuGet/Magick.NET-Q16-x64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-x64 --version 14.10.3
NuGet/Magick.NET-Q16-x86
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q16-x86 --version 14.10.3
NuGet/Magick.NET-Q8-AnyCPU
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q8-AnyCPU --version 14.10.3
NuGet/Magick.NET-Q8-OpenMP-arm64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q8-OpenMP-arm64 --version 14.10.3
NuGet/Magick.NET-Q8-arm64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q8-arm64 --version 14.10.3
NuGet/Magick.NET-Q8-x64
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q8-x64 --version 14.10.3
NuGet/Magick.NET-Q8-x86
Introduced in: 0Fixed in: 14.10.3
Fixdotnet add package Magick.NET-Q8-x86 --version 14.10.3

References