Understanding: "Amayeta SWF Encrypt"
A brief guide to how amayeta obfuscation works
Understanding: Posted on: 04/26/2012 7:16am
Quote Post
Never let a computer tell me shit.
I found some info lying around and thought it was worth sharing, as the question has been raised more than once.


"Amayeta SWF Encrypt", uses a protection method which involves nothing more than hiding.

The Primary Method
First, the original bytecode is moved into a new record (type=253), and a new record is created with the type and header of the original bytecode (12 or 59, which are DoAction and DoInitAction respectively). Because the type 253 doesn't correspond to an existing type, decompilers ignore it.

Next, the original bytecode has nine bytes appended, which consist of two jumps:
  • The first leads to another jump inside the obfuscator's body
  • The second jumps to the OEP.
The target of the first jump is an END/HLT instruction, which is overwritten by the first of the jumps at the terminus of the original code. Following the type 253 record is the obfuscator body proper, consisting of a finite-state-machine of length approximately 100 states; the accepting state of this FSM involves jumping to the second of the jumps described above (which then further jumps to the OEP, allowing the execution of the original bytecode.)

In addition, amayeta adds a record of type 255 before the first 253 record; this "signature" record has consisted of a single byte of data, 0x20, in all of the protected SWFs the author has examined. ?


Ancillary Methods
A second obfuscation trick just places the code to be hidden in an instruction with an invalid opcode (0xFC). This instruction is then placed inside of the junk code.

A bit of junk code followed by the old jump-into-middle-of-instruction trick to confuse decompilers. Simply removing this code (first 0x2A bytes) fixes it.


Unprotect Method -=Click To Show=-



I use this AoB tool to make all the AoBs I post. Try the online version if you dont feel like downloading it.
"Obviously, windows are central to Windows. They are so important that they named the operating system after them. But what is a window?"