Over a million developers have joined DZone.

These Packers Are Not From Wisconsin

DZone's Guide to

These Packers Are Not From Wisconsin

Sorry Green Bay, we're actually talking about the method cyberattackers use to hide or obfuscate malware when attacking a system.

· Security Zone ·
Free Resource

Discover how to provide active runtime protection for your web applications from known and unknown vulnerabilities including Remote Code Execution Attacks.

Malware uses a wide variety of techniques to stay hidden or obfuscated, or otherwise, make malware analyst's lives more difficult. One of the techniques they use is payload packing.

Now, packers, as they're called, have been around forever. They were originally designed years ago to compress software that was delivered over modems. There's a wide variety of them, including custom variants, in the wild today. One of the most popular packers today is UPX.

Why use them? Well, if you're a malware author, you want to make life as difficult as you can for malware analysts - you know, the guys that develop malware signatures, figure out how to clean systems of your malware, that kind of thing? And packers are one way to do that (though today, it's really more of an annoyance than a show-stopper most of the time).

By using a packer, you limit the amount of malware analysis someone can do on a static program image. Most of the time, with programs that aren't protected with some kind of obfuscation, it's trivial to load them into a disassembler or decompiler and get some idea of what the program does. We'll search for strings in the file. Look at the imported library functions. Examine function names - those kinds of things. But all these require a readable program, which you don't have if it's packed.

A packer works, essentially, by compressing the code and potentially the data sections of a program (you can compress other segments too, no reason why you couldn't) and then inserting the compressed information into another section in the executable. The packer will then usually insert a very simple, small section of code into the program image that will run when the file is executed. This code will just expand the compressed program into a program section and then transfer control to the expanded code.

When you look into a packed program with a disassembler, for example, you may only see two or three function calls and maybe a few library calls - not nearly enough for any useful program. But after you expand the program? Well, then you can see the entire payload and can understand exactly what it does. But expanding that code is not always as easy as you'd like. Sometimes, you can use utilities that will extract the compressed code and create a new executable. Other times, you need to use a debugger to step through the program, stopping and saving the program image immediately after decompression. Not as easy as it sounds if the program is using anti-debugging techniques.

Packers are useful for everybody after all - including malware authors. Not so much for malware analysts.

Find out how Waratek’s award-winning application security platform can improve the security of your new and legacy applications and platforms with no false positives, code changes or slowing your application.

packers ,malware ,security

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}