SqlShare.com Logo
 
Skip Navigation Links
Home
Video List
Events
Classes
About Us
Login / Register
Subscribe RSS Feed 

Confio Ignite

Auditing your SQL Server Logins for Blank Passwords

In this video Brian takes us through finding blank password for your SQL Server Logins. He shows you how to write a script using the sys.logins views and a what not to do when trying to find blank passwords.

Duration:
5 mins 21 secs
Skill Level:
100
Rating:
4.44 out of 5
Publish Date:
December 15, 2008
Auditing your SQL Server Logins for Blank Passwords You must be logged in to view this video.  
Bookmark and Share
 
1=Poor, 3=Good, 5=Excellent

About the Author

Image of K. Brian Kelley
Brian is a SQL Server author, columnist, and MVP focusing primarily on SQL Server security. He currently serves as database administrator / architect at AgFirst Farm Credit Bank where he can focus on his passion: SQL Server. He formerly served as a systems and security architect for AgFirst Farm Credit Bank where he worked on Active Directory, Windows security, VMware, and Citrix. In the technical...

References

There are no downloads or recommended reading links for this video

Comments
Frank Kirk on 12/26/2008
Interesting. Using variables to create sql code also interesting.

0F8FF7F87A on 9/23/2009
Question: How would this react if the login and password matches? Or what would be a good test case for it?

FELIX on 9/23/2009
Good Tip!

Sara Karasik on 9/23/2009
What a fantastic hack!

bhaskar on 9/23/2009
good one

bhaskar on 9/23/2009
good one

F8DA83F0DD on 9/23/2009
nice

Travis on 9/23/2009
attaching the code code would be nice...

Dugi on 9/25/2009
Yea nice info for the logins!

K. Brian Kelley on 9/26/2009
Here's the code: SELECT 'PRINT ''Testing ' + [name] + '...'' GO EXEC sp_password @loginame = ''' + [name] + ''', @old='''', @new=''''; GO ' FROM sys.sql_logins;

K. Brian Kelley on 9/26/2009
This will not test for where the login and password matches. You could, however, modify the script where you specify the [name] as the old and new passwords. That would do the trick.

K. Brian Kelley on 9/26/2009
Here's the code for testing if the password is identical (this includes case) to the login name: SELECT 'PRINT ''Testing ' + [name] + '...'' GO EXEC sp_password @loginame = ''' + [name] + ''', @old=''' + [name] + ''', @new=''' + [name] + '''; GO ' FROM sys.sql_logins;

Ahmad Elayyan on 9/27/2009
Excellent

Tonci on 9/29/2009
Great workaround to get sql login blank passwords!

Rajesh on 10/21/2009
GOOD

lucas on 12/24/2009
learned: about being creative in scripting - nice but @travis: retyping (or trying to reinvent) the code for this one time makes you learn more than copy paste ;)

Robert Johnson on 1/6/2010
Instructor was better about speaking slower and with more clarity.

A Alagu Ganesh on 1/20/2010
Good

mark mcnary on 5/18/2010
excellent video. It answered just what I was looking for.

mark mcnary on 11/16/2010
This might be more useful if it were expanded to show how it could work as a stored proc that could be called and generate email to the dbas when blank passwords were found.

Olu on 12/16/2010
Very useful - a quick and efficient way of auditing passwords

Jamshid Nouri on 12/21/2010
excellent

37F4DA828D on 12/21/2010
nice trick - gives me an idea on another issue - thanks!

Alok Joshi on 12/21/2010
Too fast.

Joe DeMarco on 12/21/2010
Excellent topic

D151BB6B9F on 12/21/2010
Got lost on what the code was to generate the script used at the end.

Edward Pochinski on 12/21/2010
Great video, this is how I find the blank passwords. /* Check All SQL Logins Have a Password */ PRINT '' PRINT '********************************' PRINT 'Check SQL Logins have Passwords' PRINT '********************************' PRINT '' SELECT @Statement = 'SELECT ISNULL(name,loginname) as ' + '''SQL Logins Without Passwords''' + ' FROM syslogins WHERE password IS NULL and isntname = 0' EXEC ( @Statement ) If @@rowcount = 0 Print 'No Blank Passwords on common logins' Print ''

Don Weigend on 12/21/2010
Nice straight forward technique!

John Torrey on 12/22/2010
Nice tool for DBAs.

Robert Neal on 12/22/2010
This is not a good solution. Should demo a better way to audit passwords. I have never audited passwords but would like to.

Mark Cook on 12/22/2010
Great video, Brian. Here is the same code only resvised to use ALTER LOGIN instead of sp_password. 2008 BOL states that sp_password is depricated. SELECT 'PRINT ''Testing ' + name + '...'' GO ALTER LOGIN [' + name + '] WITH PASSWORD='''' OLD_PASSWORD =''''; GO ' FROM sys.sql_logins;

Jason Yousef on 12/22/2010
can you add the code! i'm getting errors when I run it!

Mark Cook on 12/22/2010
Hussein - When the code is added in the comment box the line breaks are removed. The code will thus fail if you copy it and run it as is. You need to enter a line break immediately before and after each of the GO statements. There will thus be five separate lines of code.

Martin Miller on 12/28/2010
Nice trick for detecting blank passwords.

ravi on 12/28/2010
very good video

WChaster on 12/30/2010
For an Auditing role we should also write the results to an audit table or file.

Dean Gross on 1/2/2011
if we used sql security this would be very helpful.

Mauricio Afanador on 6/22/2011
Great way to audit passwords

5D4F14C035 on 7/7/2011
The solution works but sp_password will be deprecated in future versions of SQL. Why not use the PWDCOMPARE example in BOL? http://msdn.microsoft.com/en-us/library/dd822792.aspx

Abdul Rauf on 8/10/2011
Good

Sean on 9/12/2011
You would think that there woudl be a better way then to try and recreate all the accounts to find the no-password ones.

John on 11/1/2011
I like that it covers fine details of system level objects and also provides SQL scripting tips.

Frank on 11/26/2011
Clever

Agus on 1/27/2012
Great! Keep up the good work!

SQL_Group on 1/27/2012
good

Jamshid Nouri on 1/27/2012
excellent demo!

Jeff Lovett on 1/27/2012
good info

Eric Moreau on 1/27/2012
a bit long

hemant patel on 1/27/2012
Excellent , sweet and short!!

Dexter Jones on 1/27/2012
Nifty script - thanks, Brian!

Michael on 1/27/2012
Logic of the final query was a little too tricky to 'get' quickly.

Michael on 1/27/2012
Logic of the final query was a little too tricky to 'get' quickly.

Gil on 1/27/2012
Clever solution. But, it's still manual and error-prone. It would be better if it was shown how to use error-handling to populate a table with results.

Russell Todd on 1/30/2012
nice trick, probably messes up password reset schedule

Very tricky. Nice!

Kuljit Singh on 1/30/2012
Short and sweet

manu jaidka on 2/12/2012
Liked it very much. Very simple approach for security auditing.



Must Be Logged In
 

How Do I Become a Video Author? |  Newsletter History

Copyright © Fourdeuce, Inc., 2005-2009. All Rights Reserved | Privacy Policy | Terms & Conditions