Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to decrypt user_password field in sys_user table?

henry_cheng
ServiceNow Employee
ServiceNow Employee

The password in sys_user table is encrypted by base64 seemingly. I tried to use below script to decrypt it but still fails.

It prints out encrypted password. Anyone has any idea to decrypt the password correctly?

+++++++++++++

var gr = new GlideRecord("sys_user");

gr.get("<sys_id>");

var Encrypter     = new GlideEncrypter();

var decryptedStringAsBase64 = Encrypter.decrypt(gr.user_password);

gs.log("Decoded string is " + decryptedStringAsBase64);

+++++++++++++

Thanks

3 REPLIES 3

Kamal17
Kilo Sage

Hi Henry,



If you are trying to decrypt the 'user_password' field in 'sys_user' table then the script won't work because the field is of type 'password (1 way encrypted)'



Please note, only 'password2' field types can be decrypted



-Udhay


Please Hit like, Helpful or Correct depending on the impact of the response


sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Henry,



The user_password field on sys_user table is a Password (1 way encrypted) type which means you can't decrypt it.



See here:



Field types



Password (1 Way Encrypted)


Text field that stores passwords with one-way encryption. One-way encryption stores the password as a secure hash value that cannot be decrypted.


Dave Smith1
ServiceNow Employee
ServiceNow Employee

Henry Cheng wrote:



The password in sys_user table is encrypted by base64 seemingly.


Incorrect - it may be stored as base64, but base64 isn't an encryption algorithm, but an encoding one.



As others have said, for good security one-way encryption is used - finding the unencrypted version involves dictionary attacks.