You are on page 1of 3

4/10/2015 Tales 

from the Evil Empire ­ Recovering the admin password in Orchard

Recovering the admin password in
Orchard
Friday, April 29, 2011
ASP.NET (/bleroy/Tags/ASP.NET)   Orchard (/bleroy/Tags/Orchard)   Security (/bleroy/Tags/Security)   SQL (/bleroy/Tags/SQL)

These things happen, and it seems hopeless at first: you've
locked yourself out of your own site and that's that. Well, not
quite. If you still have access to the database there is a way out.
Access may be through FTP and WebMatrix or Visual Studio if
using SQL CE or through SQL Server Management Studio or
whatever is your preferred way to access your database. In this
tutorial I'll use WebMatrix over a local SqlCe database but other
tools would work just as well with minor differences.

Open the database and go to the
Orchard_Users_UserPartRecord table. You should see
something like this:

As you can see, the passwords are stored hashed, and the password format is specified for each user.
Possible values are Hashed (the default), Encrypted and Clear.

Edit the Password column and replace the value with a temporary reset password of your choice. Then
edit the PasswordFormat column and set it to Clear.

Now you should be able to log into the site using these new credentials.

You should now click on the "admin" link in order to change that password:

https://weblogs.asp.net/bleroy/recovering­the­admin­password­in­orchard 1/3
4/10/2015 Tales from the Evil Empire ­ Recovering the admin password in Orchard

Once your password is reset, the data in the table should be back to a hashed password:

Many thanks to Sébastien Ros for hinting me to this trick.

UPDATE: since Orchard 1.8, content items such as users store a lot of their contents in the infoset that's
on Orchard_Framework_ContentItemRecord (http://orcharddojo.net/orchard­
resources/Library/Wiki/InfosetPart). On those versions of Orchard, in order to recover the admin
password, you'll have to go into that table, and find the content item for the admin user (that's 2 in the
example above). In the data column of that table, you'll see a large XML blob. That's the infoset. Look for
the XML attributes with the same names as the columns of the user part record table. You'll have to
update these values in there, the same way you did for the values in the table.

3 Comments
@Jay: wow, not by any stretch of the imagination. Not that many people know how to hash a
password, and even if you do, this is considerably easier. You are also fogetting about the salt
here. 
And BTW, I did not talk about encryption at all in the post, so I'm not sure what you mean here. 
To move to a better hash algorithm, you can always replace the implementation, using a module,
yes. 
—  Bertrand Le Roy (http://weblogs.asp.net/bleroy/) ­ Friday, April 29, 2011 5:07:21 AM (/bleroy/recovering­the­admin­
password­in­orchard#comment­613)

Why no password iteration count? 
—  RichB ­ Friday, April 29, 2011 5:46:52 AM (/bleroy/recovering­the­admin­password­in­orchard#comment­614)

https://weblogs.asp.net/bleroy/recovering­the­admin­password­in­orchard 2/3
4/10/2015 Tales from the Evil Empire ­ Recovering the admin password in Orchard

@Rich: because you haven't contributed it yet. 
—  Bertrand Le Roy (http://weblogs.asp.net/bleroy/) ­ Friday, April 29, 2011 5:48:10 AM (/bleroy/recovering­the­admin­
password­in­orchard#comment­615)

Comments have been disabled for this content.

Terms Of Use (http://www.asp.net/terms­of­use) ­ Powered by Orchard (http://www.orchardproject.net)

https://weblogs.asp.net/bleroy/recovering­the­admin­password­in­orchard 3/3

You might also like