HITCON
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners 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

      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.
      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
    • Transfer ownership
    • Delete this note
    • 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 Help
Menu
Options
Engagement control 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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners 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

    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.
    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
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 藍隊綜合培訓:惡意程式偵測技術的整合訓練 - Joey Chen {%hackmd @HITCON/HkzqEGQsR %} > 從這裡開始 ## 近十年較大的資安事件 ## Agenda - 近期惡意程式趨勢 - 惡意程式定義 > 很多人從CTF開始入手或逆向知道惡意程式,但真正在做惡意程式分析時,被問到這隻惡意程式哪一段是惡意行為無法說清楚 > - 哪些惡意程式需要判斷 :arrow_right: 要判斷的惡意程式有什麼特性 :arrow_right: 依據不同特性會有不同方法 - 惡意程式特性 - 惡意程式偵測方法與工具 - 惡意程式預警與應變 ## 近期惡意程式趨勢 (近十年較大的資安事件) ### Supply Chain Attack - 近幾年逐漸猖獗的攻擊 - 企業角度 - 攻擊對象: 供應商、系統、整合商、代理商等 - 獲取權限: 該廠商的郵件伺服器、機敏資訊、客戶資料 - 軟體角度 - 攻擊對象: 第三方授權軟體、開源套件等 - 獲取權限: 合法第三方軟體(含簽證) #### Case - 2017 CCleaner Date - CCleaner v5.33 被植入惡意程式且被超過兩百億的使用者所下載 - 打進 CCleaner 並在伺服器安裝後門(被譽為完美的入侵) - 2019 ASUS Live Updater - ASUS Live Updater 被植入 shadowpad 且影響十萬以上的使用者 - shadowpad:中國 APT 組織愛用的 malware program family(Remote access trojan) - 2020 SolarWinds - Onion Platform - 從入侵開始到SolarWinds知曉已是1年3個月後 - SolarWinds: 強大的基礎建設平台,監控、架構用的管理平台 - 駭客早在2019年4月入侵SolarWinds的內網並潛伏在裡面,2020年才正式將後門(Sunburst)部署到公司的系統環境裡面 - 2023 3CXDesktopApp - 目標是接收駭客基礎設施指令,部署第2階段攻擊行動 - 3CXDesktopApp: 網路電話APP - 駭客組織針對開發的流程下手,跟著開發人員一起開發(強調後門一定要穩定不要斷線) - 2022年有員工自TradingTechnology下載一隻已經遭北韓駭客組織感染的惡意程式,而且因為有簽章所以防毒軟體沒有跳警告 ### Cloud Attack - 根據 CrowdStrike 2023 Cloud Risk Report - 雲端漏洞攻擊的案例上升了95% - 攻擊者針對雲端環境的攻擊上升了288%(三倍的成長率) #### Case 1. infostealer - TeamTNT駭客組織 - 偷幣、挖礦行為 - 專寫容器上的 Script 入侵 2. Target attack - 中國駭客 Storm-0558 - 針對 exchange online server & AD - 入侵過程中只有用到Powershell跟python腳本 3. Cybercrime - 攻擊目標: AWS 設定 policy - 偷資料、帳密、挖礦賺錢 ## 惡意程式定義 - Malware:<font color="red">Mal</font>icious Soft<font color = "red">ware</font> - 展現惡意行為 - 沒有使用者介入 - 傷害 + 影響 ### 惡意行為 - Propagation - 經由實體媒介或網路散布惡意程式去其他系統 - Destruction - 能夠刪除關鍵系統檔案或停止作業系統 - Unexpected Behavior - 能執行惡意程式且不需要使用者的介入 - Remote Control(Backdoor) - 能夠未經授權的去控制該台機器或系統 - Information Theft - 能夠竊取主機上之關鍵貨機敏資訊 - Exploitation - 能夠利用系統或軟體漏洞去取得系統的權限 - Deception - 誘騙使用者去下載惡意檔案或元件 - Hidden/Stealth Mechanism - 規避防毒軟體的檢測與移除 - Extortion - 惡意軟體是能夠加劇威脅或是勒索錢財 - 如勒索軟體 ### 惡意程式特性 - 安裝行為 - Self-extracting Zip(SFX) - Executable - Windows Installer(MSI) - 丟檔行為 - log.log - Self-copy - Payload.enc - etc. - 注入可執行程式碼 - DLL injection - APC injection - Thread execution hijacking - 自動啟動行為(持久化 Persistance) - Auto-start folder - Modify Register - Create service - 開啟Process&Thread - 啟動另一隻process - 呼叫同一隻之process去執行另一個thread #### 安裝行為(Delivery & Installation) - 釣魚網站 - 惡意郵件 - 惡意文件 - 惡意安裝檔 - 內網植入 - 移動式裝置植入 #### 丟檔行為 - 複製惡意程式自己 - 複製丟檔案做自動啟動 - 複製丟檔案做觸發條件 - 複製丟檔案做擴散感染(好做其他惡意程式的 Bypass 軟體) - 丟下惡意程式元件 - 使惡意程式可以完整執行 - 使惡意程式感染其他主機使惡意程式難以刪除 - 丟下其他惡意程式 - 充當其他惡意程式的載體 - 充當惡意程式的其他下載器或啟動器 ##### 丟檔行為相關 Windows API(以下 api 是否有被呼叫到) - CreateFile - CopyFile - DeleteFile - MoveFile - SetFilePointer - CloseHandle - CreateDirectory - ReadFile - WriteFie - SetFileAttributes - GetWindows Directory - GetSystemDirectory #### 自動啟動 1. 能夠自動啟動惡意程式的任意做法 2. 能確保惡意程式保持在執行的階段 3. 常見方式 - Windows Startup Folder - WIN.INI Modification - SYSTEM.INI Modification - Regitry Modification - AUTORUN.INF Modification ##### 常見註冊表機碼 - Widows boot-up - Logon prompt - Start-up folder ##### 自動啟動相關聯的API > 未針對程式觀察時可以改以觀察關聯的 API 是否有惡意行為 - RegCloseey - RegCloseKeyEx - RegDeleteKey - RegDeleteValue #### Process&Thread ![image](https://hackmd.io/_uploads/B1IM80UjA.png) ##### 相關聯的API - CreateProcess - CreateRemoteThread - CreateThread - WinExec - TerminateThread - #### Windwos服務Process 1. Windows 服務是指 Windwos NT 作業系統中的一種執行於後台的電腦程式 2. Windows 服務必須符合服務控制管理(負責管理Windows服務的組件)的介面規則和協定 3. Windows 服務可以分為 - 作業系統啟動時執行,且持續在背景執行 - Example - Windows Service Controller 下的 service process 有可能也受到惡意應用 #### 相關聯API #### 記憶體注入 1. DLL injection 是一種涉及電腦資訊安全的特殊技術,可以強行使一個處理程序載入某個動態連結庫以在其私有記憶體未止空間內執行指定程式碼 2. DLL Injection<font color="red">並不是全部為惡意行為</font> - 資安公司使用DLL Injection去監控惡意行為 - 檢測工具使用Dll Injection達到系統提權 - 瀏覽器使用DLL injection去做DNS解析 ## 惡意程式偵測方法與工具 > 自己想要調查惡意程式 可以用哪些工具 - 靜態偵測 - 剖析數據,擷取模式、屬性和構件 - 適用於任何檔案 - 效率較高 - 動態偵測 - 惡意行為辨別 - 適用於正在執行或可執行之檔案 - hook API 後再觀察其是否有惡意行為,故效率較低 - 機器學習偵測 - 針對上述的內容做特徵分類,來斷定新檔案的叢集屬於哪一個區塊 - 訓練機器用於發現更多已知的威脅 - 成本較高 ### 靜態偵測 ### 動態偵測 2. API Hooking - 觀察檔案行為、記憶體行為、Process & Thread 行為 3. 在 buffer 當中 scan 4. 最後吐出 scan 結果 ### 動態偵測(沙箱) ### 機器學習偵測 1. 將靜態 & 動態資料餵入 ML Model 2. Model 會 output result ### 抓取惡意程式的工具組 > 未雨綢繆 V.S 見招拆招 事件來了再去調查 or 平常就在做追蹤(健康檢查) ### 自我電腦檢查 - 檢察系統程序 - 工具 - Process explore - 檢查系統排程資訊 - 找出目前有無可疑排程 - 工具 - taskschd.msc - Schtasks - 檢查系統網路資訊 - 找出目前有無可疑連線 - 工具 - tcpview - Netstat -an - 檢查系統記憶體資訊 - 找出目前有無可疑程是碼在記憶體中 - 工具 - Process exploore - vmmap - 觀察 private data 當中是否有被注入可疑行為(shell code 之類的) - 檢查系統帳戶資訊 - 找出目前有無可疑的帳戶 - 工具 - Net user - 檢查系統機碼(Autorun)資訊 - 不一定是做惡意驅動,可能是惡意 loader 透過機碼進記憶體 - 機碼資訊極多,通常會建議檢察系統啟動資訊 - 工具 - Regedit - 檢查系統啟動資訊 - 檢測 - 工具 - Autoruns - 檢查系統簽章資訊 - 觀察是否每一個簽章都有被驗證過 - 確認檢測的檔案都有經過第三方的公正簽章 - 工具 - Signtools - Autoruns https://github.com/joeychen22/IR_Tool ### 偵測工具比較 - 花錢的產品 - 優點:大部分的問題都可以解決 - 缺點:被廠商綁死,彈性不高 - Open source engine - 優點:客製化程度高、方便針對自家環境與特定駭客族群做防護 - 缺點:需要科研人員維護跟研究 ### 防毒軟體的策略邏輯 - Subject - 可以指定為某程序或檔案 - Object - 跟某項物件有關 - 程序 - 檔案 - 機碼 - API - Operation - 跟某項動作相關 - 開啟 - 關閉 - 寫入 - 清除 - Action - 後續採取的動作 - 略過 - 終止 - 清除 - 隔離 ### 範例-有人在翻牆 ![image](https://hackmd.io/_uploads/BkoljC8iR.png) - Subject:判定人是主目標 - Object:圍牆 - Operation:進行翻越動作 - Ation:偵測翻牆行為並警告 ### 從資料蒐集到跳出警告 ### 推薦偵測工具 1. Windows - YARA - 特偵碼掃描工具 - DeepBlueCLI - 針對 event log 的 powershell 工具 - BinaryAlert - 針對惡意軟體樣本和可執行文件的自動化偵測和分析系統 - 工作原理 - YARA 規則匹配:使用 YARA 規則來掃描和分析可疑的二進制文件 - 自動化分析:系統會定期掃描儲存在 AWS S3 存儲桶中的文件,並且可以配置來檢測新的文件上傳。每個檔案都會被 BinaryAlert 進行掃描和匹配 YARA 規則,以判斷是否存在潛在的威脅。 - 即時告警:一旦發現與 YARA 規則匹配的惡意樣本,BinaryAlert 會自動發送告警通知,幫助安全團隊及時應對。 - hollows_hunter - 一款專注於檢測 process 內隱藏或替換的可執行模塊的工具 2. Linux - Sysmon for Linux - 程序監控器,方便監控所有在該台Linux機器的syscall - Sysdig - 監測該台機器所有的system call跟OS事件 想要自己研究、學習步驟: 1. 研究open-source project 2. 整合工具做sandbox 3. 產出一套客製化的防毒偵測工具 ※ 不需要重灌電腦、只要清除惡意程式即可) ## 惡意程式預警與應變 1. 乙方-資安廠商 - EPP - EDR - XDR - DLP - UEM - SWG - NAC - CASB - ZTNA - SEG 2. 資安聯防與情資分享平台 - TWCERT - N-ISAC - F-ISAC - T-ISAC - SP-ISAC - CERT 3. 自主調查啟動 - 找到惡意程式的Process - 找到惡意程式檔案位置 - dump process/thread 記憶體 - 找出那些系統設定被惡意程式更改 - 找出惡意程式連線的中繼站 - 確保是否有其他受害電腦、駭客是否還在傳送指令(如有,馬上斷網) - 複製出惡意程式樣本並加密 - 留下惡意程式樣本,避免用另一台電腦分析時被防毒軟體砍掉 - 停止及刪除惡意程式 - 還原受感染主機遭受修改的系統設定 ### 惡意程式的自主調查 1. 是否為真的惡意程式? - 惡意程式行為有甚麼? - 惡意程式是否有關聯的資安事件? - 惡意程式造成什麼損害? #### 惡意程式檢驗 - 找出可疑程式 - 找出可疑區段 - 找出可疑字串 2. 惡意程式有實體檔案?無實體檔案?? - 如何留存樣本? - 複製樣本的方式 - 更改副檔名使其不可執行 - 加密+壓縮 - 受感染主機是否留存於其他形式 - 輩分映像檔(DD) - 複製成VM - Full memory dump - 優點:方便還原當時情況,提供調查人員更多資訊及動態分析 - 缺點:備份非常耗時、機敏資料須先抹除、需準備較大的儲存空間、複製給其他人員或單位也很耗時。 3. 有相關文章或報告可以佐證? - 有資安廠商針對惡意程式的分析報告? - 檢測VirusTotal偵測率 - 提供給資安廠商更好 - 針對惡意程式檔案名稱、路徑及檔案內部字串做搜尋 - 有資安廠商針對惡意程式做偵測? ![image](https://hackmd.io/_uploads/SJGnAA8oR.png) #####VM zip file password:hitcon #### Practice1 1. CI0p Ransomware 2. Investigation with Tools 3. Create pattern to detect malware #### Practice2 1. PlugX ### 發生資安事件,該怎麼通報? 1. 民間企業 - TWNIC 2. 政府機關 - 國家資通安全會

    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

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    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