How to decrypt user password ?

Mahesh23
Mega Sage

Hello Community,

How to decrypt the user password using script ?

I am trying below script but its not working

var gr = new GlideRecord('sys_user');
gr.get(gs.getUserID())
var Encrypter = new GlideEncrypter(); 
var decrypted = Encrypter.decrypt(gr.user_password);  
gs.print(decrypted);
1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

This does not work for the password field on sys_user (which is of type Password (1 Way Encrypted)).

This would work on for example the basic_auth_credentials table for the password field (which is of type (Password (2 Way Encrypted)).

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

10 REPLIES 10

Mark Roethof
Tera Patron
Tera Patron

Hi there,

This does not work for the password field on sys_user (which is of type Password (1 Way Encrypted)).

This would work on for example the basic_auth_credentials table for the password field (which is of type (Password (2 Way Encrypted)).

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hello Mark,

Thanks for the response, could you please share any other scripts which decrypt the user password ?

For sys_user, you can't.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Okay, Thank you

As Password field in sys_user table is type password. is there any way to decrypt password of password2 type field ?