Beacon Object Files (BOF)
Last updated
Last updated
A Beacon Object File (BOF) is a compiled C program, written to a convention that allows it to execute within a Beacon process and use internal Beacon APIs. BOFs are a way to rapidly extend the Beacon agent with new post-exploitation features
Create by including <windows.h> - windows header file add beacon.h to the local folder
For the example below we use the Windows API (WINADVAPI) to create a new user token that we can use in CobaltStrike to change user. otherwise known as LogonUserA ()
To get the informaiton for it, lets look in mingw to see the calls:
should result in the following:
Repeat for 'GetLastError' and 'CloseHandle'.
Using this before the API call, we need to add the library i.e. ADVAPI32$LogonUserA using the new information
the 'go' variable is default for BOF in CobStrike, but others can be used.
The 'BeaconDataParse()' variable gets the data submitted into Cob (supplied from CNA).
The 'BeaconDataExtract()' variable calls the data (in order) from the BeaconDataParse()
The 'BeaconIsAdmin()' variable check is the beacons elevated and privileges, then
The 'BeaconUseToken()' handles new tokens
The 'BeaconPrintf()' prints to session
When calling a module, we need to add the DLL to get the calls from, this can be done by checking the Microsoft site and seeing the requirments () - here we can see we need the ADVAPI32.dll