views:

230

answers:

7

I want to get the various user account passwords which are stored in my computer programatically using Visual C++. Are there any APIs to help me do this?

+5  A: 

There is no way to retrieve windows passwords nor passwords to most other programs via Win32 APIs.

For Windows passwords you typically have to ask the user to enter their username/password and verify it, all by using LogonUser.

For other programs they are usually stored on disk encrypted by the host application.

Brian R. Bondy
+1  A: 

It depends what passwords are you trying to get?

Some passwords can not be retrieved, like the Windows login passwords. Some other password are stored (plain or encrypted) somewhere in the disk or registry, depending on how the application stores them.

The Win32 API CredEnumerate, for example, can give you the user credentials (login and password) for some of the applications (Internet explorer passwords, ... etc).

Aziz
+3  A: 

This is most definitely not allowed on Windows.

Consider the consequences of letting any given program obtain passwords. That would mean that programs like Solitaire would be able to get your password and use it in any number of nefarious ways. Worse, the program could use the password to access other machines in resources.

In short, it would throw security out the window

JaredPar
A: 

You can only recover the hashed password, not the password itself.

Edouard A.
+2  A: 

No. That would be a security hole. See this article.

JosephStyons
A: 

I have no personal experience with this but I was once told that there are utilities out there (usually found on .ru sites ;)) that will do this sort of job for you. And that it's appalling to see how this happens, makes you paranoid. I can't however suggest a particular tool for doing this, but would like to oppose to all those that keep saying it's not possible.

Peter Perháč