06. Specter Implants

Overview

This tutorial will show you how to generate custom Specters (our term for implants).

Background Knowledge

The core implant for SpecterInsight is a .NET 2.0+ compatible binary referred to as a specter. The specter implant contains an internally hosted PowerShell 2.0+ compatible shell. Additionally, there are wrappers that encapsulate your specters to give them different running environments and allows this product to support a broad range of defense evasion techniques.

Payloads

The following payloads are generated every time you create a new specter:

PayloadObfuscatedDescription
.NET BinaryNoThe core SpecterInsight implant that can run in either 32-bit or 64-bit environments.
Win32 DLLNoA native 32-but or 64-bit DLL wrapper that will securely load a specter into memory.
Win32 EXENoA native 32-bit or 64-bit executable wrapper that will securely load a specter into memory.
Win32 SRDINoA native 32-bit or 64-bit shellcode wrapper that uses Shellcode Reflective DLL Injection that will securely load a specter into memory.
PowerShell ScriptYesAn obfuscated PowerShell cradle that will securely load a specter into memory.
PowerShell CommandYesA PowerShell command that will run a PowerShell process that will download an obfuscated PoweShell cradle that will securely load a specter into memory.
PowerShell URLYesA URL that will return an obfuscated PowerShell Script when a GET request is issued.
CSharp URLNoA URL that will return the core SpecterInsight implant when a GET request is issued.
CSharp Load ModuleYesAn obfuscated .NET executable containing an AMSI bypass that will reflectively load a specter into memory.
CSharp PowerShell HostYesAn obfuscated .NET executable containing an AMSI bypass that will start an internal PowerShell instance to download and run a PowerShell cradle to load a specter into memory.
CSharp Service Load ModuleYesThe same as the CSharp Load Module but compiled as a service binary compatible with the Windows Service Manager.
CSharp Service PowerShell HostYesThe same as the CSharp PowerShell Host but compiled as a service binary compatible with the Windows Service Manager.
CSharp Shellcode InjectYesAn obfuscated .NET executable that will download a shellcode loader to inject a specter into the current process.
⚠️ Payloads that are unobfuscated a highly vulnerable to signaturization by AV and EDR products. We highly recommend you deploy obfuscated payloads only in production environments.

Payload Options

SpecterInsight comes with a variety of configuration options to customize your specter to emulate a specific adversary or to change the behavior to achieve your specific engagement objectives. The following table summarizes the various options:

OptionExamplesDescription
Identifier7e541b7403fe4abebf2d5938c922be22An alphanumeric identification string for this particular implant build.
URLshttps://www.evil.com; https://103.56.32.163
https://localhost
A semi-colon seperated list of callback URLs using the specified protocol.
Connection PolicyFallback
Random
Fallback – the implant will try the last successful URL first and then try the remaining URLs in the order specified by the operator.
Random – the implant will try the last successful URL first and then try the remaining URLs in a random order.
Interval4 hours 0 minutes
2h30m
The minimum interval between specter checkins.
Window30 minutes 53 seconds
1h22m41s
A length if time after the interval when a specter will randomly checkin.
User AgentMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36The UserAgent string the specter will use when interacting with the C2 server.
Certificate ValidationTrue
False
Should the specter verify the C2 server SSL certificate using the local certificate store or not. This can help prevent Man-in-the-Middle attacks against your specters, but may prevent successful callbacks if the SSL certificate is not trusted by the environment.
AMSI/Logging BypassTrue
False
Should the native payloads employ AMSI and logging bypasses prior to loading the specter.
Environment ParametersLOG_PARAMSThis is the name of the environment variable the specter will check to find runtime configuration settings in key/value pair format.
Expiration Date22 August 2023 at 14:23The date and time in GMT that the specter will expire and shutdown.
Startup Script$system = Get-WmiObject -Namespace root\cimv2 -Class Win32_ComputerSystem | Select Name, Domain
if(!$system.Domain.EndsWith(“.target.net”, [StringComparison]::InvariantCultureIgnoreCase)) {
burnoff;
}
A PowerShell script that runs prior to registration. This can be used to survey the environment to make sure it is safe to execute in, prevent duplicate specters from running, or to run an initial recon survey. The example ensures that the specter will only run if it runs in the target.net domain, otherwise the specter will burnoff.
Expiration Scriptschtasks /DELETE /TN ‘CacheTask’ /F; [Environment]::SetEnvironmentVariable(‘GPO_AUX’, $null, ‘Machine’)A PowerShell script that runs just prior to shutdown either from the “burnoff” command or the expiration date is reached. This can be used to cleanup artifacts from the engagement such as persistence mechanisms. The example script here removes the persistence method by deleting the scheduled task.

Generate a New Implant

Navigate to Implants Page

Use the menu bar to navigate to Operations > Implants.

Configure Options

Click the “Add” button to create a new implant configuration.

Configure the options as required for your use case. We configure the specter to callback over HTTPS port 443 to 192.168.1.101 every 15 to 30 minutes. Here are some other possible options you could use for the Interval and Callback fields:

  • 5 seconds
  • 5s
  • 20m37s

For this particular scenario, we already know that our target is a Windows Active Directory environment with a domain called target.net. We configure a startup script that verifies the domain or exits. This ensures that our malware does not execute in sandboxed environments or non-target networks.

We have also configured an expiration script to delete a scheduled task. If you already know the persistence mechanism you want to use, then you can pre-bake an uninstall script so that the specter cleans up after itself. When combined with a reasonable expiration date, you can ensure engagement artifacts are not left behind after the engagement completes.

When done, click the “Create Implant” button at the bottom of the window.

General Options
Startup Script
Expiration Script

Download a Payload

Right-click on the implant you want to generate a payload for, then navigate down to PowerShell > Command.

Run the Payload

Copy and paste the contents of the payload.txt file into a command prompt.

Observe Callback in Sessions Page

You should get a pop-up notification in the bottom, right-hand corner of the screen indicating a successful registration. You should see the new Specter session in the Sessions page.

To interact with the session, right-click and select Interact or double click the row you’re interested in.

Scroll to Top