Author Topic: [BASIC] Hide Payloads with executables to create Trojan Horses  (Read 1066 times)

grinch

  • Administrator
  • Hero Member
  • *****
  • Posts: 1926
  • Reputation: 187
  • the digital grinch who stole your data
    • @DigitalGrinch
  • Badges:
  • iDevices: iPhone 3GS 4.3.3, HTC Evo V 4G ICS
Today we are going to create one of the first types of malware ever, the Trojan Horse. Not going to get into mythology, but a trojan horse, or trojan for short, is a program with good intentions containing a malicious one inside. There are many ways to create a trojan program, as it is a concept, not defined by a specific structure. This is probably the simplest method, and it uses software provided to you by micro$oft
Once you learn this simple method of how they are created, you will understand the concept, see how they work, and will have some idea on how to defend yourself. You will also realize why it is good to use file checksums to make sure the file you want is the file you have, and the importance of an Antivirus

You will need a (non-malicious) carrier program, and malicious payload. If you'd like to test, you can use a non-malicious executable as your payload, if it runs, so will your malicious payload.

For this tutorial, I will be using the TrueCrypt installer as my carrier, and to test payload function, a non-malicious, single executable program called SpaceMonger(a graphical program to see hard disk space, makes freeing up space quick and easy, get the older freeware version)

Not covered here is creating your malicious payload, use MSF, hand code one. There are other tutorials on creating malware

Download program to use as a trojan carrier
www.truecrypt.org

Download iconsextract and Resource hacker
http://www.angusj.com/resourcehacker/
http://www.nirsoft.net/utils/iconsext.html , Download link is at bottom of page

Install Resource Hacker

Install Iconsextract, run
Open trojan carrier in Iconsextract

Choose icon that matches your carrier package

Extract and save icon, exit


The software to create the trojan is already on your machine, provided by micro$oft. The original intent was to create self extracting, self executing executables, but like many computing things created with good intentions, people find a way to use them otherwise. It is called IExpress.
Open IExpress, Win key + R
Code: [Select]
iexpressNew SED

First option > extract and run

I use name of trojan program install window, but does not matter

No prompt

No license. (No pic of this screen.)
Add both files, carrier and payload

Install program is carrier, post install is your payload

I left window at default, so the TrueCrypt installer window shows

No message. (No pic of this screen.)
Choose name “TrueCrypt Setup 7.1a.exe” and location, check Hide File Extracting progress

I choose only restart if needed, if your malware requires reboot, choose “Always...” I also check the “Do not prompt user for restart” box

You can choose to save or not save SED. these are usually one-offs for me so i do not save
Next to create package

In windows explorer, right click your package, “Open using Resource Hacker”
Action > Replace Icon

Choose icon, replace

Save As. You will need to save to a different location than source to be able to use same name
Done!

To see it in action, run it, once the installer closes, either successful or cancelled by user, the payload should run. In my case, if SpaceMonger opens then it was successful

You can see how easy this is, and how invisible it can be to users, including yourself. This is why it is a good idea to follow the Sandwich Rule for computer programs, a good idea to use file checksums, like MD5 or SHA1 hashes that verify a files authenticity. This tells you the file you have is the file you intended to have, nothing more or less. This is also why an up-to-date AntiVirus is important, it can detect most malicious payloads before they can execute.
« Last Edit: August 27, 2012, 01:26:49 am by grinch »
If I help you or you appreciate my work, clicking that +1 button is the best thanks I could get.

My opinions are my own, you may agree or disagree with them, but they are only just that; opinions
For example: facebook is the microsoft of social networks

http://goo.gl/PiVjI

@DigitalGrinch
https://twitter.com/DigitalGrinch

I follow all iNinjas members back. PM me if I am not following you

1337

  • Sr. Member
  • ****
  • Posts: 254
  • Reputation: 13
  • Computers: HP - Possible future  alienware!
  • iDevices: iPod 4th Gen
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #1 on: August 27, 2012, 03:24:21 am »
Sweet tutorial! +1
Learning python 2.5..
PM to make signature/avatar

UberN00b

  • Hero Member
  • *****
  • Posts: 523
  • Reputation: 22
  • Perfection is a process.
  • Computers: em250-kav60 netbook
  • iDevices: iPhone 4
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #2 on: August 27, 2012, 06:04:41 am »
I had to stop before reading on. I researched last night learning about md5, sha and salt. Embedding a payload in truecrypt, that's just scary! Ok, back on topic and reading.
A million strands of spiderwebs weaved to make my vest!

H4CK3R

  • Haxor
  • Sr. Member
  • *****
  • Posts: 407
  • Reputation: 42
  • I try and write cool tweaks!
    • Kyle Howells
  • Badges:
  • Computers: MacBook Pro
  • iDevices: iPod 1G, iPod 2G, iPod 4G, iPhone 4S, iPad 2, iPad mini
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #3 on: August 27, 2012, 06:17:23 am »
Wow, great tutorial.
Wish there was a little technical details at the end of what is actually happening when the user runs it. How does it run even if they cancel?

Apetrick

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3511
  • Reputation: 90
  • <Apetrick> lank is 1337
  • Badges:
  • iDevices: Ipod Touch 4g
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #4 on: August 27, 2012, 07:35:23 am »
Sweet tutorial, ima have to try this.
<%a12danrulz> Idk, but doing a DoS from an apple device is like fighting a bear with a plastic spork

Don't like seeing ads? Click here to register!

grinch

  • Administrator
  • Hero Member
  • *****
  • Posts: 1926
  • Reputation: 187
  • the digital grinch who stole your data
    • @DigitalGrinch
  • Badges:
  • iDevices: iPhone 3GS 4.3.3, HTC Evo V 4G ICS
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #5 on: August 27, 2012, 08:53:48 am »
I had to stop before reading on. I researched last night learning about md5, sha and salt. Embedding a payload in truecrypt, that's just scary! Ok, back on topic and reading.

Yes, I chose TrueCrypt on purpose, bc it is a security related program that is safe, and trusted. Not something people would suspect malware inside, but would be upset to learn it could. This is why the Sandwich Rule https://ininjas.com/forum/index.php?topic=4134.0 for computer programs is so important. Trust the source, not the delivery, and verify source with checksum

Wow, great tutorial.
Wish there was a little technical details at the end of what is actually happening when the user runs it. How does it run even if they cancel?

The original intent of IExpress was to create self-extracting, self-executing programs. Thats all this is. Essentially we zipped the 2 programs together into an .exe, with instructions to run program B after program A. We told the program to not prompt user or even show the extraction to them. A user clicks the .exe, it unzips programs to temp dir, runs program A, and on exit of program A, program B runs, regardless of success or failure.

Simple but effective
If I help you or you appreciate my work, clicking that +1 button is the best thanks I could get.

My opinions are my own, you may agree or disagree with them, but they are only just that; opinions
For example: facebook is the microsoft of social networks

http://goo.gl/PiVjI

@DigitalGrinch
https://twitter.com/DigitalGrinch

I follow all iNinjas members back. PM me if I am not following you

UberN00b

  • Hero Member
  • *****
  • Posts: 523
  • Reputation: 22
  • Perfection is a process.
  • Computers: em250-kav60 netbook
  • iDevices: iPhone 4
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #6 on: August 27, 2012, 10:11:46 am »
i also watched a tut about encypting hidden files/folder within an encrypted hidden file/folder within the folder/s of an encrypted system. If I'm correct you could encrypt a payload within a non-malicious payload of your Trojan to hide from scanners as tough as malwarebytes and chkrootkit... Although I remember in topic somewhere on the site  about anti-viruses catching this no matter how many times you encrypt your payload, but  I think It was just for emails.
A million strands of spiderwebs weaved to make my vest!

[null]

  • Hero Member
  • *****
  • Posts: 646
  • Reputation: 43
  • the halloween jack is a real cool cat
  • Computers: I have a PC running Windows 7 that was built by my uncle. I also have a Newsmy T3 Android Tablet.
  • iDevices: iPod Touch 4G
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #7 on: August 27, 2012, 03:34:12 pm »
VERY nice tut! I can't wait to try this out! +1!!
__  __           ___    ___          
/\ \/\ \         /\_ \  /\_ \          
\ \ `\\ \  __  __\//\ \ \//\ \     
 \ \ , ` \/\ \/\ \ \ \ \  \ \ \          
  \ \ \`\ \ \ \_\ \ \_\ \_ \_\ \_
   \ \_\ \_\ \____/ /\____\/\____\
    \/_/\/_/\/___/  \/____/\/____/

Ironman

  • Administrator
  • Hero Member
  • *****
  • Posts: 5099
  • Reputation: 251
  • Badges:
  • Computers: ASUS UL50VT
  • iDevices: iPhone 5, iPhone 4S, iPhone 4, iPhone 3GS
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #8 on: August 27, 2012, 05:19:16 pm »
Fine job grinch!! +1
Click for How to Add Our Repo
If you're going to ask questions....
At least make them good ones.

Knowledge is the one thing that can never be taken from you

A3MIRAL

  • Leader
  • Hero Member
  • *****
  • Posts: 2899
  • Reputation: 105
  • A3MIRAL -- Reporting for Duty
    • A3MIRAL
  • Badges:
  • Computers: Dell XPS15 (6 GB ram, Core i7 @ 2.0 GHz, 750 GB HDD @ 7200 RPM)
  • iDevices: iPod touch 3G 32GB, iPhone 5 32GB
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #9 on: August 27, 2012, 08:01:23 pm »
I like iexpress for packing stuff. I've used it for a key logger. Good idea about the Trogan. I could make a Trogan key logger type thing

Don't like seeing ads? Click here to register!

grinch

  • Administrator
  • Hero Member
  • *****
  • Posts: 1926
  • Reputation: 187
  • the digital grinch who stole your data
    • @DigitalGrinch
  • Badges:
  • iDevices: iPhone 3GS 4.3.3, HTC Evo V 4G ICS
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #10 on: August 27, 2012, 09:46:43 pm »
I like iexpress for packing stuff. I've used it for a key logger. Good idea about the Trogan. I could make a Trogan key logger type thing

If your payload is a keylogger, you are making a trojan already. That is the whole thing about trojans, its a concept, they payload may be some other clearly defined type of malware, like a keylogger, while the concept of a trojan is very loose. It is just something with malicious intent hidden inside something with good or non-malicious intent. The payload may be packed together like with IEpress or the carrier modified with the payload inside of it. As long as it fits that broad concept, of bad hiding inside good, it is a trojan
If I help you or you appreciate my work, clicking that +1 button is the best thanks I could get.

My opinions are my own, you may agree or disagree with them, but they are only just that; opinions
For example: facebook is the microsoft of social networks

http://goo.gl/PiVjI

@DigitalGrinch
https://twitter.com/DigitalGrinch

I follow all iNinjas members back. PM me if I am not following you

H4CK3R

  • Haxor
  • Sr. Member
  • *****
  • Posts: 407
  • Reputation: 42
  • I try and write cool tweaks!
    • Kyle Howells
  • Badges:
  • Computers: MacBook Pro
  • iDevices: iPod 1G, iPod 2G, iPod 4G, iPhone 4S, iPad 2, iPad mini
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #11 on: August 29, 2012, 08:35:17 am »
Thanks for the extra details.

LankAsif

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2390
  • Reputation: 90
  • Forum pride 8)
  • Badges:
  • Computers: i7 with bits and pieces
  • iDevices: iPod Touch 1G (Basically storage for iNinja tools), iPhone 5
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #12 on: August 30, 2012, 06:38:39 am »
This is kind of a weird use/idea for binding a 2nd executable to the 1st, but if you bind the same file to the original would that result in constant opening of that executable and basically halt the system? Kinda like a DoS on PC resources.

Education is never achieved by wise men. it is only believed to have been achieved by fools

A3MIRAL

  • Leader
  • Hero Member
  • *****
  • Posts: 2899
  • Reputation: 105
  • A3MIRAL -- Reporting for Duty
    • A3MIRAL
  • Badges:
  • Computers: Dell XPS15 (6 GB ram, Core i7 @ 2.0 GHz, 750 GB HDD @ 7200 RPM)
  • iDevices: iPod touch 3G 32GB, iPhone 5 32GB
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #13 on: August 30, 2012, 04:06:44 pm »
Fork bomb is a lot easier :P (and that's what that is...but a condeluted version)

OneHappyTaco

  • Sr. Member
  • ****
  • Posts: 404
  • Reputation: 11
  • Who Dares Wins
  • Computers: Mac
  • iDevices: Iphone 4s
Re: [BASIC] Hide Payloads with executables to create Trojan Horses
« Reply #14 on: January 25, 2013, 08:02:43 pm »
I am sure you already no this, but the Backdoored Executable is disguised as a Trojan Horse.