coding backdoor with brogramming

Published on November 4th, 2012 | by Luke Queenan

0

Designing a Backdoor

As any good brogrammer knows, designing before you code is usually a good idea. So today I’ll be taking you through the design work for a covert application I will be creating in the coming months. There are two parts to this application, a server and client component. The server will be the actual backdoor running on the compromised machine and the client will be the program we use to communicate with it. The backdoor, or server, will be designed to run on Linux, written in C, and will be tested on Fedora 17. The client will also be written in C and should run on any Nix based system.

Requirements

Let’s start with the requirements we would like the backdoor to have.

  • Disguised process name, obviously seeing “backdoor.out” running in top is going to give us away
  • Accept packets from behind the firewall (nothing should get in the way of a brogrammer’s backdoor)
  • Only accept packets that have our embedded passphrase contained within the header
  • Execute commands passed in the encrypted packet using the system() command
  • Return the results of the executed commands to the client application
  • Searching for a file, retrieving its contents, and returning them to the client
  • Opening a covert channel back to the client for transmitting data

Some additional features that would be good to have if time permits.

  • Key logging with offline and real time functionality
  • Web camera control for taking pictures or video and uploading media back to the client

The requirements for the client application are fairly straight forward

  • Encrypt passphrase into the header along with a command or filename
  • Listen for returning data
Now that the requirements of the application have been made clear, the actual design starts. For this application I’ll be doing state diagrams to define the behavior of the programs and pseudo code to flush out the high level code design.

State Diagrams

State diagrams are really useful for visualizing the application’s flow and function design. The backdoor application is presented first.

 

Next up is the client state diagram. As the diagram shows, the client is designed as a single command per execution.

Pseudo Code

The pseudo code shown here is fairly high level, no real functions are mentioned and read and write loops are not shown. The pseudo code for back door is up first.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

Next up is the client pseudo code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

That concludes the design work I’ve done for the backdoor. All that’s left to do is some brogramming.
 

Tags: , , , , , ,


About the Author

Software developer specializing in network security applications and administration, Windows/Unix client-server models using IPC and TCP/IP, keeping fit in the gym.



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*

Back to Top ↑