18/09/2018, 16:00

Phân tích, phát hiện và gỡ bỏ mã độc Practical Malware Analysis Lab12-04

Phân tích mã độc Lab12-04 trong cuốn sách Practical Malware Analysis Practical Malware Analysis: https://nostarch.com/malware Mẫu mã độc của Lab12-04 có thể tải về từ: https://github.com/mikesiko/PracticalMalwareAnalysis-Labs Phân tích Section resource của ...

lab1244

Phân tích mã độc Lab12-04 trong cuốn sách Practical Malware Analysis

Practical Malware Analysis: https://nostarch.com/malware

Mẫu mã độc của Lab12-04 có thể tải về từ: https://github.com/mikesiko/PracticalMalwareAnalysis-Labs

Phân tích

Section resource của Lab12-04.exe chứa shell code được gán nhãn BIN 101.

lab1241

Lab12-04.exe thực hiện các hành vi:

  • Duyệt tất cả các process, tìm kiếm process Winlogon.exe, gọi hàm SfcTerminateWatcherThread nhằm disable Windows File Protection và chiếm đặc quyền process Winlogon.exe bằng cách đặt quyền SeDebugPrivilege

Lab1242

  • Nếu thao tác trên thực hiện thành công, sửa tên WindowsDirectorysystem32wupdmgr.exe thành TempPathwinup.exe
  • Trích xuất shell code BIN 101 và ghi vào file WindowsDirectorysystem32wupdmgr.exe
  • Thực thi file WindowsDirectorysystem32wupdmgr.exe thông qua hàm WinExec.

lab1243

Shell code BIN 101 (WindowsDirectorysystem32wupdmgr.exe giả mạo) thực hiện các hành vi:

  • Thực thi file TempPathwinup.exe (là Windows Update Manager của Windows, sau khi bị chuyển sang thư mục TempPath) thông qua hàm WinExec. Khi user chạy Windows Update Manager, chương trình này hoạt động như bình thường

lab1244

  • Download file http://www.practicalmalwareanalysis.com/updater.exe và ghi vào WindowsDirectorysystem32wupdmgrd.exe thông qua hàm URLDownloadToFile, sau đó thực thi WindowsDirectorysystem32wupdmgrd.exe.

lab1245

  • Tại thời điểm phân tích, file http://www.practicalmalwareanalysis.com/updater.exe không còn tồn tại (HTTP response 301 Moved Permanently) nên mã độc wupdmge.exe kết thúc thực thi mà không thể thực hiện hành vi tải về và ghi file wupdmgrd.exe

Phát hiện

Lab12-04.exe có thể phát hiện bằng signature:

  • 20 byte từ fileoffset 4495, là đoạn cài đặt quyền SeDebugPrivilege đối với Winlogon.exe

lab1246

  • 20 byte từ fileoffset 4758, là đoạn tìm kiếm resource section BIN 101 để trích xuất ra file wupdmgr.exe giả mạo

lab1247

File wupdmgr.exe (shellcode) có thể phát hiện bằng signature:

  • 20 byte từ fileoffset 4257, là đoạn gọi thực thi Tempwinup.exe mỗi lần mã độc khởi chạy

lab1248

  • 20 byte từ fileoffset 4353, là đoạn download file updater.exe

lab1249

Gỡ bỏ

  • Xóa bỏ Lab12-04.exe, thêm WindowsDirectorysystem32wupdmgr.exe như mã độc liên quan

lab12450

  • Nếu phát hiện file wupdmgr.exe giả mạo, xóa nó và nếu nó nằm trong WindowsDirectorysystem32, chuyển TempPathwinup.exe về WindowsDirectorysystem32wupdmgr.exe, nếu không khôi phục file thành công, trả về FAIL; cố gắng xóa file WindowsDirectorysystem32wupdmgrd.exe

12451

Xem Thêm: Phân tích mã độc Lab TẠI ĐÂY

0