导航

Web安全手册

分享本身就是件快乐的事 我因别人得到帮助而感到幸福

« WPA的梦魇----GPU运算之高速破解WPA-PSK密码ZeroBoard4 pl8 (07.12.17) Multiple Remote/Local Vulnerability »

MS-SQL [2000&2005] User Enumeration Via sp_who

In SQL server 2005, if you are not ’sa’ you can’t do much. This is primarily because openrowset is by default not available unless you are privileged. Stored procedure sp_who is available for public(in mssql 2000 and 2005). This procedure “provides information about current Microsoft® SQL Server™ users and processes”.

Enumeration:

 
  1. exec sp_who 'validuser';

 

returns no records(as you don't have privileges to see information about other users) but no errors too..:)
-------------------------
 

 
  1. exex sp_who 'invaliduser';

returns error:
Msg 15007, Level 16, State 1, Procedure sp_who, Line 59
'invaliduser' is not a valid login or you do not have permission.
————————

Hence, you can enumerate usernames. You can also enumerate Windows users (if mixed mode authentication is enabled) like this:

 
  1. exec sp_who ‘test-system\Administrator’

 

and also possibly the domain users, depending upon which domain users are allowed to connect(typically domain admins).

You need to know the valid machine_name/domain_name for this to work. But that’s not a problem as this can be obtained from the following:

  1.  IIS NTLM authentication, which discloses machine name and domain name(use hoppy).
  2.  This can also be obtained from terminal services dialog box.
  3.  This stored procedure(sp_who) itself returns the hostname.
  4.  There are other several ways to obtain this.

After you have enumerated users, you know what to do next. Try cracking passwords through other services e.g. RDP, SMB etc.

Through SQL Injections use this poc to enumerate logins(assuming a blind sql injection):-

 
  1. http://127.0.0.1/upload/sqlinjection/?qid=1;BEGIN TRY exec sp_who 'TEST-SYSTEM\blah' END TRY BEGIN CATCH return END CATCH waitfor delay '00:00:20'--

 

When the username is right, it will wait for 20 seconds.

 Post BY SID

  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Powered By Z-Blog .Theme from Google黑板报 By Washun

Copyright 2008-2009 Pcsec.org. Some Rights Reserved.苏ICP备08110306号

Search

网站分类

文章归档

最新评论及回复

最近发表