Friday, January 22, 2016

Decrypt WebLogic Credential From Boot Properties

Tested On: 10.3.6.0
Description: Uses WebLogic API to decrypt credentials from the boot.properties file.
Reference: https://gokhanatil.com/2015/03/how-to-recover-weblogic-administration-password-of-enterprise-manager.html

1. Set your classpath to include the WebLogic jar files. Executing "setDomainEnv.sh" located in "$DOMAIN_HOME/bin" directory should set that up for you.
cd /home/oracle/Oracle/Middleware/user_projects/domains/base_domain/bin/
source ./setDomainEnv.sh

WebLogic Libraries Included in CLASSPATH

2. Create the java source code called "recoverpassword.java".
import weblogic.security.internal.encryption.ClearOrEncryptedService;
import weblogic.security.internal.SerializedSystemIni;

public class recoverpassword
{
   public static void main(String[] args)
   {
      String domainHome = args[0];
      String encryptedValue = args[1];

      ClearOrEncryptedService encServ = new ClearOrEncryptedService(SerializedSystemIni.getEncryptionService(domainHome));
      System.out.println(encServ.decrypt(encryptedValue));
   }
}

3. Compile your java source file. A "recoverpassword.class" file should be generated.
javac recoverpassword.java

4. Run java program.
The "boot.properties" file is located in $DOMAIN_HOME/servers/AdminServer/security" directory.

java -classpath $CLASSPATH:. recoverpassword <DOMAIN_HOME> <ENCRYPTEDVALUE>

java -classpath $CLASSPATH recoverpassword /home/oracle/Oracle/Middleware/user_projects/domains/base_domain/ {AES}xQbrM8hYbjx9RquOgUtoGOvMThMEJ5PyUj1FYIIhNdw=

No comments:

Post a Comment