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
    • 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 Versions and GitHub Sync Note Insights 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Skrull Like A King:從重兵看守的天眼防線殺出重圍 - 馬聖豪 {%hackmd @HITCON/rkYm1whdY %} > 從這開始 :::info [TOC] ::: ## Background 現有惡意程式分析相關技術: - 雲端樣本分析 - Malware Detection(Traditional) - 特徵碼 Signature-Patterns Scanning e.g. YARA - 基於異常行為的機器學習:ML: Heurustuc-Detection e.g. SVM(線性分析) - 丟沙箱做動態驗證 VM - 非已知樣本: - 防毒軟體必要三大點: 攻擊者頭病的地方 - 掃毒引擎<!--引擎的名字是什麼呀--> - 何時掃瞄?(定期掃瞄吃資源耗校能) 但在金融事件上反應定期掃瞄並無法正常防禦 - Regular Schedule Service - Minifilter & [PsSetCreateProcessNotifyRoutine](https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-pssetcreateprocessnotifyroutine) - 執行時觸發 從網路上下載時檢測、落地檢測、執行觸發阻擋 - 預設如果樣本是惡意程式回傳:開 - 繞過的機會: - 如果從頭到底都不落地,不在硬碟中,或是樣本會自行刪除就偵測不到。 早期以 MD5、SHA1 比對特徵碼,樣本回傳時是活著的; * [千面人病毒](https://www.trendmicro.com/vinfo/us/security/definition/Polymorphic-virus) 只能在指定的環境或主機掃,搬移就會無效或損毀。 ## The Treasure left since Windows XP .Black Hate 2017 技術分享: .無落地惡意程式: .合併總合技 --- ``` when a .exe was clicked~~ kernel32CreateProcess --> kernel32CreateProcessInternalW-->filePtr= fopen("file.exe")-->ntdll!ZwCreateProcessEx(section) ``` :::info https://github.com/aaaddress1/PR0CESS ::: CreatPrcoess: 執行程序時,將 PEB 結構手動更新;程式路徑、參數、目錄等等。 RTL 去執行相關的 ### [PsSetCreateThreadNotifyRoutingEx function](https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-pssetcreatethreadnotifyroutine) ### [PsSetCreateProcessNotifyRoutingEx function](https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-pssetcreateprocessnotifyroutineex) 可以去監控所有的 Process 及進行掃瞄,或把它關掉。 都是系統底層在使用的;(Hard to Unhook) Parent assign to child process: struct _FILE_OBJECT *FileObject ImageFileName CommandLine [PS_CREATE_NOTIFY_INFO structure (ntddk.h)](https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_ps_create_notify_info) ```cpp= typedef struct _PS_CREATE_NOTIFY_INFO { SIZE_T Size; union { ULONG Flags; struct { ULONG FileOpenNameAvailable : 1; ULONG IsSubsystemProcess : 1; ULONG Reserved : 30; }; }; HANDLE ParentProcessId; CLIENT_ID CreatingThreadId; struct _FILE_OBJECT *FileObject; PCUNICODE_STRING ImageFileName; //! PCUNICODE_STRING CommandLine; //! NTSTATUS CreationStatus; //! } PS_CREATE_NOTIFY_INFO, *PPS_CREATE_NOTIFY_INFO; ``` ==Anti Virus Scan at First when Child Process Created== Bypass: create a dummy.txt -> ntdll!ZwCreateProcessEx -> 夾 mimikatz 的 Payload,由於將其做攻擊;將 Kernel 層的觸發掃瞄的時間點不同,以來躲避防毒軟體的問題。 :::info ![](https://hackmd.io/_uploads/rkQJCf1tF.png =200x) Process Doppelgänging https://www.blackhat.com/docs/eu-17/materials/eu-17-Liberman-Lost-In-Transaction-Process-Doppelganging.pdf ::: More Variety following by this attack vector - Lost in Transaction - Osiris Banking Trojan ### Fileless > 太屌了吧XD > 由於我們要創建一個 Process;但不想進到磁碟呢? 有;有無文件的Process,存到cache Windows Update 每次都會產生出很多 log ,只要重新開機就會被刪除 所以用 SetFileInformationByHandle 設置成暫存文件 只要設定 FileDispositionInfo.deleteFile = TRUE;暫存文件之後就會刪除; 但如果用 ZwCreatedThreadEx 注入後,防毒軟體就會認為這個文件不存在了。 #### Demo 1:Process Ghosting - Defenfender 開啟 - .\mimiGhosting.exe - 執行後可以成功繞過,屬性沒有名字,沒有路徑 (因為已刪除,所以Process在跑,但文件不存在的。) 銀行業後門及勒索軟體常用的方式;會遇到這個問題:但是還是要有載體去執行… ### Force Unlink NTFS Streams - Mark of the Web 當檔案下載時,會有開:Zone.Identifier:$DATA 去保存當下載的資料。 內容是 ini 格式的記錄文件 用於隱藏後門 所以我們會將惡意程式寫入串流中;而且是可以刪除的。 那我們就可以將意程式從主程式寫入其他垃圾串流($DATA)中,之後將其程式刪掉。 就可以為無檔案執行。 * [SetFileInformationByHandle](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfileinformationbyhandle) 將主程式其設定其他串流底下。 > 那如果下次開機是不是就無法執行了? 我 >> 待會QA問問看~XD謝謝解答, 快問! >>我在slido上面發問了QAQ (OK,您不自己問嗎,可以媽我在這裡噢!!!!)XD >>> 媽我上電視了!!! >>dir 結果:picaball.exe:dummy:$DATA 講師很Nice,私下問囉 XD #### Demo 2:Skrull.exe 老舊程式沒有數位簽名,執行皮卡丘。 執行.\Skrull.exe;之後皮卡丘就會被注入其他程式的憑證。 (以其他程式的微軟簽章蓋過) :::info https://github.com/aaaddress1/Skrull ::: ==Skrull: Malware Anti-Copy DRM== {%youtube pRjRwl9tjXs %} 因為 Launch 可能在執行的時候,可能因為 Ghosting 的關係,所以刪除當下檔案且被注入或執行其他程式。 Skrull.exe -> Decrypt後寫入Payload -> ??? ### Conlusion >想繼續聽 >內容好豐富XD >天菜講師~~~ >台下高潮了(誤 >直接一個目標放錯 :laughing: ###### tags: `HITCON2021`,`HITCON`

    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