Scott Cate Weblog 

scott.cate@myKB.com
http://scottcate.myKB.com



Scott Cate KB > Microsoft.com/PDC Oct 2003 > SQL Server 2003 - [Yukon] Start Over
Search the Knowledge Base
 
Start Search in the Following Category
Date Modified
Sunday, November 30, 2003
Undocumented SQL 2003 Encryption Routines

My good friend Brady Gaster, once again, comes through with the best tip of today. A SQL guru he works with tipped him to this and he shared with me (just so proper credit gets served).

Really pretty simple actually. Paste this into Query Analyzer.

select pwdencrypt('Scott Cate')
select pwdcompare('Scott Cate',pwdencrypt('Scott Cate')

I found this article online about a buffer overrun error, but it's pretty old and seems to have been fixed with SP3. They claimed a buffer overrun with this call.

SELECT pwdencrypt(REPLICATE('A',353))

I tried it in SP3 and it fails because the parameter is invalid, not because of an overrun.

Thanks Brady.

Warning/Update: Since I read about and wrote this, I've been sent a couple of links; informing me that this is not a good idea to use. First of all, since it's undocumented the hashing algorithms inside SQL server might change, rendering your pwdCompare() function useless. Also the hashed code itself can be broken pretty easily.

Thanks Tim Heuer for this link, explaining the vulnerability.


All rights reserved. All details are the personal opinion of Scott Cate.
All trademarks referenced are the property of their respective owners.
Scott Cate is a lead programmer for www.myKB.com and
owner of The Arizona .NET User Group and an all around nice guy ;)


Knowledge Base Software - myKB.com

 

Cameron Cate Pictures
Cameron Cate Pix

Site Navigation

Home
Knowledge Base
Wiki Discussions
Photo Album

Sites I Own & Run


Easy Search ASP.NET
mykb.com knowledge base software logo
myKB.com
Knowledgebase Software

KBAlertz.com
Arizona .NET user Group
Group Leader

Affiliations


ASP.NET MVP
2004
2005
2006
2007
2008
2009


Blog Sites I Read

Brady Gaster
Rob Howard
G. Andrew  Duthie
Robert McLaws
Alex Lowe

World of Scott.Net

Scott Guthrie
  -  Father of ASP.NET

Scott Watermasyk
  - .Text (Weblog)

Scott Sargent
Scott Mitchell
ScottG.net
Scott Bellware
Scott Forsyth
Scott Hanselman
Scott Cate

Favorite Books


ASP.NET Cookbook


First Looks @ ASP.NET 2.0