Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Encrypted way of dynamic API calls

In this code sample I tested a theory that you could call Windows API using encrypted strings in C#, and the proof of concept is here. Here I am defining two secure strings, one is "user32.dll" and the other "MessageBoxA", and then using LoadLibrary to load user32.dll and GetProcAddress to get the MessageBoxA procedural address. Afaik this is a first of it's kind, I could be wrong. I've never seen it before though.

This may or may not bypass or throw off AV scanners runtime scans.

[Image: 86exIgV.png]

[Image: Syr3DlV.png]
Great idea I think it could bypass av scantime easily.

Thanks for sharing this with us. Glad you still posting here.
Code
private SecureString ConvertToSecureString(string password)
{
    if (password == null)
        throw new ArgumentNullException("password");

    var securePassword = new SecureString();

    foreach (char c in password)
        securePassword.AppendChar(c);

    securePassword.MakeReadOnly();
    return securePassword;
}
:)
I implemented this in my open-source 64-bit traditional RunPE available on Github. It brought static detection down to 2/26, but without any evasions the dynamic detection was rated 60/100 using the reverse.it service.
[Image: Syr3DlV.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by phisnNov 11, 2020 08:44 AM 1 166 Nov 11, 2020 08:44 AM
Last Post: HFDone
[Java] by hichigoJun 20, 2020 04:02 PM 0 159 Jun 20, 2020 04:02 PM
Last Post: hichigo
[C] by myselfandiSep 9, 2019 11:26 AM 9 364 Sep 9, 2019 11:26 AM
Last Post: myselfandi