The agent webshell has a bug that converts the returned decrypted blob data into a string and then converts it back to an array of bytes. While it seems there are no particular problems in exchanging data, it could cause some issues for future use, e.g. Network tunneling.
ICryptoTransform decryptor = rijAlg.CreateDecryptor(rijAlg.Key, rijAlg.IV);
using (MemoryStream msDecrypt = new MemoryStream(encrypted))
{
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
{
csDecrypt.Read(encrypted, 0, encrypted.Length);
}
plain = msDecrypt.ToArray();
}
The agent webshell has a bug that converts the returned decrypted blob data into a string and then converts it back to an array of bytes. While it seems there are no particular problems in exchanging data, it could cause some issues for future use, e.g. Network tunneling.
This code https://github.com/antonioCoco/SharPyShell/blob/master/agent/runtime_compiler/runtime_compiler_aes.cs#L49 should be replaced with something like this: