Aliases and Extensions
Aliases and Extensions
Sliver allows an operator to extend the local client console and its features by adding new commands based on third party tools. The easiest way to install an alias or extension is using the armory.
Aliases Command Parsing
IMPORTANT: It's important to understand that all alias commands have certain Sliver shell flags (those that appear in --help). Your Sliver shell commands are lexically parsed by the Sliver shell first, and only unnamed positional arguments are passed to the alias code. This means you may need to escape certain arguments in order for them to be correctly parsed.
For example with Seatbelt, seatbelt -group=system will fail because the Sliver shell will attempt to interpret the -group flag as a named flag (i.e., arguments that appear in --help). To ensure this argument is parsed as a positional argument we need to tell the CLI that no more arguments are to be passed to the sliver command using --, so the correct syntax is "seatbelt -- -group=system"
Another trick is to provide a single empty string argument, after which all arguments will be parsed as positional e.g., "seatbelt '' -group=system"
Arguments passed to .NET assemblies and non-reflective PE extensions are limited to 256 characters. This is due to a limitation in the Donut loader Sliver is using. A workaround for .NET assemblies is to execute them in-process, using the --in-process flag, or a custom BOF extension like inline-execute-assembly. There is currently no workaround for non-reflective PE extension.
What's the difference between an alias and an extension?
From an end-user perspective there's not much of a difference between the two, except that extensions' arguments will show up in --help and may be required.
An alias is essentially just a thin wrapper around the existing sideload and execute-assembly commands, and aliases cannot have dependencies.
An extension is a shared library that is reflectively loaded into the Sliver implant process, and is passed several callbacks to return data to the implant. As such these extensions must implement the Sliver API. Extensions may also have dependencies, which are other extensions. For example, the COFF Loader is a DLL extension that loads and executes BOFs, in turn BOFs simply extensions that rely on the COFF Loader as a dependency. These types of extensions do not need to implement any Sliver-specific API, since the Sliver API is abstracted by their dependency.
Aliases
A Sliver alias is nothing more than a folder with the following structure:
Alias json file structure
It contains a single JSON object, which has the following fields:
Field name --> Description
Files
To load an alias in Sliver, use the alias load command:
Writing Aliases
To write a new alias, one must either create a shared library or a .NET assembly, then write a manifest file compliant with the description above.
As the alias support relies on Sliver side loading capabilities, please make sure to read the Using 3rd party tools section, to understand how shared libraries are loaded on all platforms.
Extensions
Extensions are currently only supported when using Windows implants, though we're actively working on MacOS/Linux support.
Extensions are similar in structure to an alias, but internally work differently. An extension is an artifact of native code that is reflectively loaded by the implant and passed certain callbacks. These callbacks allow the extension to return data to the C2 server. Extensions may also have dependencies (other extensions), which Sliver will load prior to the extension; circular dependencies are not allowed. For example, all BOF extensions (.o files) rely on the COFF Loader extension (a .dll).
Last updated