Friday, October 31, 2008

MS SQL Server Password Recovery

For database admins, it is not a nightmare to handle with lost sql server password, which can be easily retrieved from application source code or just reset it in Enterprise Manager.

But for a penetration tester, he should know where the passwords store, how to dump hashes, and crack them to gain more information. And it is necessary to audit the strength of sql server passwords, because weak sql passwords could cause system command execution remotely by a malicious hacker, compromising the application security.

David Litchfiled has written a good paper about cracking sql server passwords in 2002. You should read it to understand the mechanism of hashes, and after that, practice the following instructions and tools.

1. Dump hash locally

C:\>osql -E
1> select name, password from master..sysxlogins where name='sa'
2> go
name password

sa 0x0100EA1ED32230A0DC42EE75F0A8D98234E26DDFF9720590BB687641F98DE93C45E05E6406A0E1BE291FA4D8205C
1>


2. Crack it!

Split the hash as following:

0x0100
EA1ED322 (salt, 8 chars)
30A0DC42EE75F0A8D98234E26DDFF9720590BB68 (case sensitive hash, 40 chars)
7641F98DE93C45E05E6406A0E1BE291FA4D8205C (upper case hash, 40 chars)

Launch your favorite hash crackers, here I use PasswordsPro, add hash then crack.



Mention that it is not an instant recovery, it must use dictionary or brute force. But this demo password was cracked by a preliminary crack immediately!




3. Reset password

The sql server passwords are stored in master.mdf, located in C:\Program Files\Microsoft SQL Server\MSSQL\Data. The Russian company ElcomSoft released a tool named Advanced SQL Password Recovery, which provides instant recovery of sql passwords by modifying master.mdf.






Another choice is SQL Password by LastBit, which can both reset and crack sql password, while ElcomSoft can only reset password. But SQL Password cannot parse some master.mdf files through my test.


11 comments:

  1. For work with sql files advise use-recover mssql,also tool is free,it can help with this problem and retrieve the data, that was considered to be lost,mwill extract housekeeping data from the source database and preview the data, that can be recovered,this tool is a good solution to recover data from corrupted databases in MS SQL Server format,restore databases represent files, like any other documents, they can be easily corrupted by viruses, all sorts of malware, hard drive failures, file system errors, incorrect user actions, etc,supports both data extraction to your hard drive as scripts in SQL format and data export directly to a database in MS SQL Server format.

    ReplyDelete
  2. Some days ago I used this tool for sql files-repair your sql server,also program is free,it can help with this problem and retrieve the data, that was considered to be lost,mwill extract housekeeping data from the source database and preview the data, that can be recovered,this tool is a good solution to recover data from corrupted databases in MS SQL Server format,restore databases represent files, like any other documents, they can be easily corrupted by viruses, all sorts of malware, hard drive failures, file system errors, incorrect user actions, etc,supports both data extraction to your hard drive as scripts in SQL format and data export directly to a database in MS SQL Server format.

    ReplyDelete
  3. For realize this actions for solve the problems,I recommend next software-sql server repair,application helped me many times and has not one facility,software repair data from corrupted databases in the MS SQL Server format (files with the *.mdf extension),supports data extraction via the local area network,can save recovered data as SQL scripts, it is also possible to split data into files of any size,compatible with all supported versions of Microsoft Windows, such as Windows 98, Windows Me, Windows NT 4.0, Windows 2000, Windows XP, Windows XP SP2, Windows 2003 Server, Windows Vista,tool supports the following database formats: Microsoft SQL Server 7.0, 2000, 2005,also can repair .mdf files of Microsoft SQL Server 2005, repair mdf file of Microsoft SQL Server 2005 (64-bit).

    ReplyDelete
  4. All in all in this situation there are many ways of solution this task,and in my opinion one of the best-sql recovery,software has free status as far as I know,it can help with this problem and retrieve the data, that was considered to be lost,mwill extract housekeeping data from the source database and preview the data, that can be recovered,this tool is a good solution to recover data from corrupted databases in MS SQL Server format,restore databases represent files, like any other documents, they can be easily corrupted by viruses, all sorts of malware, hard drive failures, file system errors, incorrect user actions, etc,supports both data extraction to your hard drive as scripts in SQL format and data export directly to a database in MS SQL Server format.

    ReplyDelete
  5. Nice Post.
    SQL repair software is used repair corrupted .mdf files, tables, views, stored procedures, rules, defaults, user defined data types and triggers from Microsoft SQL server database

    ReplyDelete
  6. Thank you for your nice post.I really enjoy to visit your post.Good job keep posting..
    Split system repairs

    ReplyDelete
  7. A few days ago I forgot the SA password, later I use SQL Server Password Changer to successfully reset the SA password, it's worth a try.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. To reset forgotten SQL password is not an easy task as some days ago I forgot my SQL server password and I have used many SQL password recovery product to reset SQL server password but all are useless. Soon after I have utilize SQL password recovery software and successfully reset my SQL Server password. Get this SQL password recovery software here: http://www.systoolsgroup.com/sql-password-recovery.html

    ReplyDelete
  10. If you want to recover password from your SQL server then you try any third party SQL server password recovery tool, which recover password from your SQL server without damaged any .mdf files. Visit here for free download: http://www.softwaredatarecovery.net/sqlpasswordrecovery.html

    ReplyDelete
  11. chutiye pane ke software hain ye, madharchod free main kuch bhee nahi hai

    ReplyDelete