text
stringlengths
0
1.99k
wVw4jjj1Jxkmvd+Ne67Kn9NLQBS26PrAJdMzQPWSDlzB3u5XQ2dl3wlNfPbn2SJddMqv6R1UBW1
KJoAaY93Yr9swTECJ3FME9mxN44o5hV0yCya067PNpi8pyLWtIHMMJjVY+kCMgAoCfBmQJVxj/u
lfUAsM+JyBXYaiYjz3mwbQmj8tCJp4Zb7n//TJ+c8oh/j/i1j7TjTe4//pdHbP/ssmc7kT//8Z5
UOgAJH/dlxZs+Kz/2G2qtZOwkFbyH1bj2zb2at2ZTixu3WeCWJE3q0DfqbhUySauVsv2nMxgVd2
ql/ux8Vnoa1a1ZjaWAPlg6YCyyLX1fFVu9xvCuOrQrVeYvZ+/8Z8ABVVU6HBElR6Mka+TG8R4uM
kiY/0Awv634grPirAGW3LeNHZn56e4raydGaKrjtUdadNPiYY+onPpdCnZ0AgQfmNVgbPruAkoi
AFmgRRBD9/e22JVdjUn+5woTKutwSwirrt0uW42wPL7ipKkhc+1i0UcQdkoQq8VUcBETT7LRjJQ
eCgjzMXpHcYfxxB6n+hHwCOy0K/h0NsjotzqTibjbOhi2AIgUYQpsOIkvDeuMnHC/LrFoGo3zWU
35Ya3rpwEXRG9ubcBlnyQB17oI576QwIIvIR++S4IJCny9//gBH8GUpMNBNvHc1CUfqwxF8+DmW
lSEslvHMZW/lAgPT73Gk9lVM5lVM5lVM5lVM5lVM5lVM5lVM5lVM5lVM5lVP5ueV/Af0Tn8AAMA
IA
EOF
|=[ EOF ]=---------------------------------------------------------------=|
==Phrack Inc.==
Volume 0x10, Issue 0x47, Phile #0x09 of 0x11
|=-----------------------------------------------------------------------=|
|=--------------------------=[ Broodsac ]=-------------------------------=|
|=-----=[ A VX Adventure in Build Systems and Oldschool Techniques ]=----=|
|=-----------------------------------------------------------------------=|
|=--------=[ Amethyst Basilisk <amethyst.basilisk@gmail.com> ]=----------=|
|=-----------------------------------------------------------------------=|
--[ Table of Contents
1. Introduction
2. Planning the Virus
3. Designing the Virus
4. Building the Virus
5. Dealing with Development Hazards
5.1. The Original Design Fails
5.2. Antivirus Catches It
6. Conclusions
7. Shouts
8. References
9. Artifacts
--[ 1. Introduction
There is nothing more thrilling than a successful payload. But in the
pursuit of payloads, we are susceptible to dopamine addiction. And in
that addiction, we seek shortcuts to get our hit. Indeed, the urgence of
speed requires us to hunt these shortcuts as well. Just use bash glue.
Don't worry about code maintainability. I have the compiler, why make
things more complicated?
It is easy to forget when pursuing our dark arts-- from viral writing to
exploitation-- that in everything we do, we are creating software. And
software gets complicated. Certainly, for shellcoding, it is merely a one-
liner with NASM to create a binary blob of your creation. That's not
complicated at all. But isn't the shellcode going somewhere? C won't let
you simply merge binary blobs into your code. (Not until C23, anyway.)
And it's not always as easy as concatenating your creation onto your
executable. What if you want to encrypt the shellcode somehow? And what
if another program has to handle that shellcode? And that program might
be the payload of another program in the chain! This doesn't even begin
to consider what automation your assembly payload might require, such as
dynamic obfuscation.
Our dark arts are a mess of project management-- payload factories,
matryoshka obfuscation, a plethora of moving parts necessitating
cleverness. It is not to say our quick hacks are not worthy of their
purpose-- they are. But they are more often than not optimized for speed,
not interoperability, maintainability or portability. A good build system,
by sometimes sacrificing short-term speed of development, provides these
things.
Unix users are already familiar with this. One of the oldest build
systems, GNU Make and the autotools suite, is fundamental to sharing
and building code on Unix-like platforms. Windows users, however, don't
have this culture. Everything is Visual Studio projects. And like
everything Windows, the MSVC build system is a veritable black box
behind the Visual Studio IDE. The hackers who can wield MSVC's black
magic to their whim have undoubtedly inspired us with their mindblowingly
assembled payloads. Lord knows I would love to see SmokeLoader's build
system[10].
You can think of this article as a cooking recipe. While the virus
technique used here is nowhere near novel ("roy g biv already did it"),
it is wrapped in techniques and best practices to build any type of virus.
We will cover the use of a robust build system to construct our virus and
discuss techniques for build systems that bolster our malware development.
We will also be covering some techniques necessary to circumvent Windows
Defender, as this is now the baseline we must develop against.
To follow along, grab a copy of Visual Studio with C++ support, CMake
(https://cmake.org) and NASM for Windows (https://nasm.us). To fully
understand this article, you are expected to have a basic understanding
of PE files.
--[ 2. Planning the Virus
We want to write an executable infector for Windows. To do that, we need
to break down the moving pieces involved in an executable infector. While
traditional executable infectors have gone out of style due to advances
in executable security, it can still be done-- especially in the advent
of developers not being able to afford or care for signing their binaries.