nemesisqp / Amber

POC Reflective PE packer.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AMBER Version License Golang Twitter

Banner

Amber is a proof of concept packer, it can pack regularly compiled PE files into reflective PE files that can be used as multi stage infection payloads. If you want to learn the packing methodology used inside the Amber check out below.

PS: This is not a complete tool some things may break so take it easy on the issues πŸ˜… and feel free to contribute.

Developed By Ege BalcΔ± from INVICTUS/PRODAFT.

REFLECTIVE PE PACKING WITH AMBER

BLOG POST
PENTESTBLOG
PAPER
PAPER

INSTALLATION

SUPPORTED PLATFORMS:

Operative system Version
Ubuntu 16.04\16.10\17.04
Kali linux *
Manjaro *
Arch Linux *
Black Arch *
Debian *
	sudo chmod +x Setup.sh
	sudo ./Setup.sh

USAGE

	//   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— 
	//  β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
	//  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•
	//  β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•  β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
	//  β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ•β• β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘
	//  β•šβ•β•  β•šβ•β•β•šβ•β•     β•šβ•β•β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β•β•šβ•β•  β•šβ•β•
	//  POC Reflective PE Packer                                             

	# Version: 1.0.0
	# Source: github.com/egebalci/Amber


	USAGE: 
	  amber file.exe [options]


	OPTIONS:
	  
	  -k, --key       [string]        Custom cipher key
	  -ks,--keysize   <length>        Size of the encryption key in bytes (Max:100/Min:4)
	  --staged                        Generated a staged payload
	  --iat                           Uses import address table entries instead of hash api
	  --no-resource                   Don't add any resource
	  -v, --verbose                   Verbose output mode
	  -h, --help                      Show this massage

	EXAMPLE:
	  (Default settings if no option parameter passed)
	  amber file.exe -ks 8

Fileless ransomware deployment with powershell

Multi Stage EXE deployment with metasploit stagers

DETECTION

Current detection rate (19.10.2017) of the POC packer is pretty satisfying but since this is going to be a public project current detection score will rise inevitably :)

When no extra parameters passed (only the file name) packer generates a multi stage payload and performs an basic XOR cipher with a multi byte random key then compiles it into a EXE file with adding few extra anti detection functions. Generated EXE file executes the stage payload like a regular shellcode after deciphering the payload and making the required environmental checks. This particular sample is the mimikats.exe (sha256 - 9369b34df04a2795de083401dda4201a2da2784d1384a6ada2d773b3a81f8dad) file packed with a 12 byte XOR key (./amber mimikats.exe -ks 12).  The detection rate of the mimikats.exe file before packing is 51/66 on VirusTotal. In this particular example packer uses the default way to find the windows API addresses witch is using the hash API, avoiding the usage of hash API will decrease the detection rate. Currently packer supports the usage of fixed addresses of  IAT offsets also next versions will include IAT parser shellcodes for more alternative API address finding methods.

VirusTotal (5/65)

VirusTotal

VirusCheckmate (0/36)

VirusCheckmate

NoDistribute (0/36)

NoDistribute

TODO

  • Add x64 support
  • Add MacOS support
  • Add.NET file support
  • Add a IAT parser shellcode to stub
  • Add yara rules to repo
  • Write a unpacker for Amber payloads
  • Automate IAT index address finding on --iat option
  • Add assembly encoder & anti debug features
  • Add more integrity checks to the file mapping function
  • Better installation mechanism

About

POC Reflective PE packer.

License:MIT License


Languages

Language:Go 77.2%Language:Assembly 19.5%Language:Shell 2.0%Language:C 1.1%Language:C++ 0.3%