Cleartext Credential Recovery in ServiceNow
ServiceNow stores discovery and LDAP credentials encrypted, but an attacker with administrative roles can modify script includes to return cleartext secrets to the client. This allows recovery of passwords, SSH keys, and cloud service principal secrets that are otherwise not exposed.
Published on specterops.io
ServiceNow is a cloud IT service management platform (ITSM) enabling enterprise scale asset tracking, workflow automation, and much more. I first leveraged ServiceNow on a red team assessment in 2024 to gather information for objective targeting through ServiceNow’s configuration management database (CMDB).
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the script includes that handle credential testing can be modified by users with script_include_admin rights to return decrypted credential data instead of only using it internally.
Impact
An attacker with discovery_admin or script_include_admin roles could recover cleartext credentials of any type stored in discovery_credentials, including SSH keys and cloud secrets, and LDAP connection passwords, though the proof-of-concept may not work on instances using SSO or web-service-only accounts.
What the attacker needed
Discovery_admin or script_include_admin role; read access to discovery_credentials table; ability to modify sys_script_include records
How it was found
- Identify the CredentialTestAjax script include and its testCredential function.
- Modify the script include to add an early return of the decrypted credential JSON.
- Send the same AJAX request to /xmlhttp.do that the Test Credential button uses.
- Receive the cleartext credential values in the HTTP response.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
ServiceNow is a cloud platform for managing IT services. It stores credentials (like passwords and SSH keys) encrypted, so they cannot normally be read. The author found that someone with high-level admin permissions can change a piece of server-side code to make the server send back the decrypted secrets.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.