Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in AES decryption agent c# code #17

Open
antonioCoco opened this issue Dec 27, 2021 · 0 comments
Open

Bug in AES decryption agent c# code #17

antonioCoco opened this issue Dec 27, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@antonioCoco
Copy link
Owner

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:

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();
}
@antonioCoco antonioCoco added the bug Something isn't working label Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant