Scripts

The Scripts menu provides access to the underlying Kudzu Scripting API. This will be where our exploits reside, and where we test new features/modifications.

<kudzu> scripts
<kudzu scripts> help
run: executes kudzu script
        usage: run hello.kzs
load: loads kudzu script for use and prints options
        usage: load hello.kzs
ls/list: lists scripts available
        usage: list

Get Kudzu script info

<kudzu scripts> load hello.kzs
hello.kzs is a test script demonstrating Kudzu's use of go templates 
and the yaegi interpreter.
Options:
LHOST
RHOST
CMD

Set script options and run script

<kudzu scripts> setop Lhost 127.0.0.1 
<kudzu scripts> setop Rhost 1.1.1.1   
<kudzu scripts> setop cmd tesing this is a command
<kudzu scripts> run hello.kzs
Output:
Hello from kudzu!
127.0.0.1
1.1.1.1
CMD: tesing this is a command

Kudzu Scripting

Kudzu leverages an embedded interpreter and golang templates to generate and execute custom scripts. The info command parses the initial comment, or Kudzu Header, identified by the /*{ }*/ field. Kudzu scripts will not load without this header.

Examples

hello.kzs

simple_implant.kzs

A touch more in depth

Above is a relatively basic example of the capabilities, here we dig a little deeper. This script, kashdump.kzs, is a bit of a monster, but since we are delivering the entire payload in one file, things grew out of hand. The important parts are related to how we gain access to a process token, enable SeDebug privileges, and finally dump memory from LSASS. Note that this is not opsec safe in the slightest, we are writing a memory dump directly to the directory in which our implant is running. Good improvements on this would implement a write to buffer/memory instead of write to file, but that will be for a future weekend (or someone else!)

TLDR: We can do some pretty advanced and very useful stuff. Check out main() and dumplsass()

Some things ive realized, we are sorta limited to the standard libraries (including syscall and unsafe) so extra massaging is required to avoid using external libs. I don't see a way around this, so get used to digging into source code and re-implementing things!

Last updated

Was this helpful?