流量加密怎么办?主流webshell管理工具流量解密分析( 三 )

 
3.2.2 JavaAesRaw
请求响应均为为aes,key就是参数key,模式为ECB
关键代码如下:
this.encodeCipher = Cipher.getInstance("AES");this.decodeCipher = Cipher.getInstance("AES");this.encodeCipher.init(1, new SecretKeySpec(this.key.getBytes(), "AES"));this.decodeCipher.init(2, new SecretKeySpec(this.key.getBytes(), "AES"));public byte[] encode(byte[] data) {try {return this.encodeCipher.doFinal(data);} catch (Exception var3) {Log.error(var3);return null;}}public byte[] decode(byte[] data) {try {return this.decodeCipher.doFinal(data);} catch (Exception var3) {Log.error(var3);return null;}} 
3.3 CShapAes
3.3.1 CShapAesBase64
请求响应均为为aes+base64,key就是参数key,iv也是参数key,模式为CBC
关键代码如下:
this.encodeCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");this.decodeCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");this.encodeCipher.init(1, new SecretKeySpec(this.key.getBytes(), "AES"), new IvParameterSpec(this.key.getBytes()));this.decodeCipher.init(2, new SecretKeySpec(this.key.getBytes(), "AES"), new IvParameterSpec(this.key.getBytes()));public byte[] encode(byte[] data) {try {return (this.pass + "=" + URLEncoder.encode(functions.base64Encode(this.encodeCipher.doFinal(data)))).getBytes();} catch (Exception var3) {Log.error(var3);return null;}}public byte[] decode(byte[] data) {try {data = https://www.isolves.com/it/wl/js/2022-07-20/functions.base64Decode(this.findStr(data));return this.decodeCipher.doFinal(data);} catch (Exception var3) {Log.error(var3);return null;}} 
3.3.2 CShapAesRaw
请求响应均为为aes,key就是参数key,iv也是参数key,模式为CBC
关键代码如下:
this.encodeCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");this.decodeCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");this.encodeCipher.init(1, new SecretKeySpec(this.key.getBytes(), "AES"), new IvParameterSpec(this.key.getBytes()));this.decodeCipher.init(2, new SecretKeySpec(this.key.getBytes(), "AES"), new IvParameterSpec(this.key.getBytes()));public byte[] encode(byte[] data) {try {return this.encodeCipher.doFinal(data);} catch (Exception var3) {Log.error(var3);return null;}}public byte[] decode(byte[] data) {try {return this.decodeCipher.doFinal(data);} catch (Exception var3) {Log.error(var3);return null;}} 
3.3.3 CSharpEvalAesBase64
请求为明文可执行代码+加密数据,请求响应为aes,key就是参数key,iv也是参数key,模式为CBC
关键代码如下:
this.encodeCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");this.decodeCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");this.encodeCipher.init(1, new SecretKeySpec(this.key.getBytes(), "AES"), new IvParameterSpec(this.key.getBytes()));this.decodeCipher.init(2, new SecretKeySpec(this.key.getBytes(), "AES"), new IvParameterSpec(this.key.getBytes()));public byte[] encode(byte[] data) {try {return (String.format("%s=%s&", this.pass, this.evalContent) + this.shell.getSecretKey() + "=" + URLEncoder.encode(functions.base64Encode(this.encodeCipher.doFinal(data)))).getBytes();} catch (Exception var3) {Log.error(var3);return null;}}public byte[] decode(byte[] data) {try {data = https://www.isolves.com/it/wl/js/2022-07-20/functions.base64Decode(this.findStr(data));return this.decodeCipher.doFinal(data);} catch (Exception var3) {Log.error(var3);return null;}} 
3.3.4 CShapAsmxAesBase64
asmx加密方式与CShapAesBase64一致,只是传参变成xml格式

流量加密怎么办?主流webshell管理工具流量解密分析

文章插图
 
3.4 aspXor
asp系列的有一个改变就是非raw的首位16位填充变为了6位
流量加密怎么办?主流webshell管理工具流量解密分析

文章插图
 
3.4.1 AspRaw
抓包可以看到通信是明文的不需要解密
流量加密怎么办?主流webshell管理工具流量解密分析

文章插图
 
public byte[] encode(byte[] data) {try {return data;} catch (Exception var3) {Log.error(var3);return null;}}public byte[] decode(byte[] data) {if (data != null && data.length > 0) {try {return data;} catch (Exception var3) {Log.error(var3);return null;}} else {return data;}} 
3.4.2 AspBase64
加密方式为base64,响应首尾填充6位
流量加密怎么办?主流webshell管理工具流量解密分析

文章插图
 
public byte[] encode(byte[] data) {try {return this.E(data);} catch (Exception var3) {Log.error(var3);return null;}}public byte[] decode(byte[] data) {if (data != null && data.length > 0) {try {return this.D(this.findStr(data));} catch (Exception var3) {Log.error(var3);return null;}} else {return data;}}public byte[] E(byte[] cs) {return (this.pass + "=" + URLEncoder.encode(functions.base64EncodeToString(cs))).getBytes();}public byte[] D(String data) {byte[] cs = functions.base64Decode(data);return cs;}


推荐阅读