zjxhx 发表于 2017-2-13 12:50:53

weblogic 密码破解

适用于weblogic 8/9/10,都是采用DES加密
 
一、配置环境变量
在我的电脑-属性-高级-环境变量-系统变量的 CLASSPATH 中添加weblogic.jar路径
如: D:\bea\weblogic92\server\lib\weblogic.jar
 
二、编译、运行
我的电脑域目录为D:\bea\user_projects\domains\base_domain
从weblogic域目录(domain_home)\servers\AdminServer\security下的文件boot.properties得到weblogic控制台登陆的用户名、密码,已加密。如下
username={3DES}CkWXM0dA697kH3D9F1NOEA==
password={3DES}CkWXM0dA697kH3D9F1NOEA==
将用户名、密码替换到以下代码中。
 

import weblogic.security.internal.SerializedSystemIni;
import weblogic.security.internal.encryption.ClearOrEncryptedService;
import weblogic.security.internal.encryption.EncryptionService;
public class weblogic{
public static void main(String[] args) {
EncryptionService env=SerializedSystemIni.getExistingEncryptionService();
if(env==null){
System.out.println("需要设置变量:-Dweblogic.RootDirectory ");
}
ClearOrEncryptedService t= new ClearOrEncryptedService(env);
String str=t.decrypt("{3DES}CkWXM0dA697kH3D9F1NOEA==");
String str2=t.decrypt("{3DES}CkWXM0dA697kH3D9F1NOEA==");
System.out.println("用户名解密结果:"+str);
System.out.println("密码解密结果:"+str2);
}
}

  
javac weblogic.java (注:在环境变量中正确配置JAVA_HOME确定javac能运行)。
java -Dweblogic.RootDirectory=D:\bea\user_projects\domains\base_domain  weblogic
其中Dweblogic.RootDirectory为weblogic安装的域目录如:D:\bea\user_projects\domains\base_domain
 
该方法也可以用来破解weblogic配置数据库连接jdbc的密码,取出jdbc配置文件ProductDataSource-5236-jdbc.xml中的password-encrypted
该文件路径为D:\bea\user_projects\domains\base_domain\config\jdbc
 
注意事项:
  如果域目录Dweblogic.RootDirectory跟boot.properties中加密密文不匹配(即不是同一个域目录下的,因为des的密钥不同),会报以下错误:
Exception in thread "main" weblogic.security.internal.encryption.EncryptionServiceException: 
com.rsa.jsafe.JSAFE_PaddingException: Could not perform unpadding:invalid pad byte.
        at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptBytes(JSafeEncryptionServiceImpl.java:78)
        at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptString(JSafeEncryptionServiceImpl.java:94)
        at weblogic.security.internal.encryption.ClearOrEncryptedService.decrypt(ClearOrEncryptedService.java:87)
        at weblogic.main(weblogic.java:14)
Caused by: com.rsa.jsafe.JSAFE_PaddingException: Could not perform unpadding: invalid pad byte.
        at com.rsa.jsafe.JA_PKCS5Padding.a(Unknown Source)
        at com.rsa.jsafe.JG_BlockCipher.decryptFinal(Unknown Source)
        at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptBytes(JSafeEncryptionServiceImpl.java:68)
页: [1]
查看完整版本: weblogic 密码破解