# 情境 使用社交工程,對人資發送具有惡意程式附件的釣魚郵件,當人資點開 word 後,便會連接到 C2 病毒會使用一系列手法如下載檔案、DLL injection等。 病毒為 徐牧遠 aka red aka 高中就有OSCP的男人 aka OSCE³ ,所提供 如果需要更多情境可參考此架構自行架設,如完整企業場域(AD、Mail Server等) Sysmon 已經可以記錄連線狀況,但僅能取得 IP 以及 PORT,若需要更詳細的網路流量資料,可使用 packetbeat。 若需要其他資料或 log,可使用 filebeat 來傳送所需資料 # 環境架設 ## Server 參考此篇教學 https://snappyjack.github.io/articles/2020-10/helk%E5%AE%89%E8%A3%85%E5%92%8C%E8%AF%95%E7%94%A8 ### 1. HELK 架設 需安裝docker ```shell! git clone https://github.com/Cyb3rWard0g/HELK.git cd HELK/docker sudo ./helk_install.sh ``` 基本上預設就可以,若沒特殊要求選 1 即可 ``` ***************************************************** * HELK - Docker Compose Build Choices * ***************************************************** 1. KAFKA + KSQL + ELK + NGINX 2. KAFKA + KSQL + ELK + NGINX + ELASTALERT 3. KAFKA + KSQL + ELK + NGINX + SPARK + JUPYTER 4. KAFKA + KSQL + ELK + NGINX + SPARK + JUPYTER + ELASTALERT Enter build choice [ 1 - 4]: 1 ``` <!--## 2. DNS server https://github.com/guan4tou2/my-dns.git 修改 /etc/resolv.conf nameserver 127.0.0.1 ## mail server https://docker-mailserver.github.io/docker-mailserver/latest/usage/#preliminary-steps ```shell DMS_GITHUB_URL="https://raw.githubusercontent.com/docker-mailserver/docker-mailserver/master" wget "${DMS_GITHUB_URL}/compose.yaml" wget "${DMS_GITHUB_URL}/mailserver.env" ``` 1. edit compose.yaml - Substitute mail.example.com according to your FQDN. 3. docker compose up 4. docker exec -ti mailserver setup email add user@example.com - On first start, you will need to add at least one email account (unless you're using LDAP). You have two minutes to do so, ### gophish ``` sudo apt install golang-go -y git clone https://github.com/gophish/gophish.git cd gophish go build sudo ./gophish ``` 進入 admin page https://127.0.0.1:3333 1. Sending Profiles - name: hr - SMTP From: hr@example.com - Host: smtp.gmail.com:587 - Username: - Password: 主旨: 求職申請 ``` 親愛的人資主管您好, 您好!我是[你的姓名],對貴公司開放的資安實習生職位非常感興趣,特此向貴公司提交我的履歷。我相信我的經歷與能力能為貴公司帶來價值,並希望能有機會參與面試,進一步與您討論我的背景與如何為貴公司貢獻。 附件中為我的履歷,敬請查收。如有任何問題,或需要進一步的資料,請隨時聯繫我。 感謝您的寶貴時間與考慮,期待您的回覆。 祝 好 ``` --> ## Client 開始 Windows Event Log,並透過 winlogbeat 將 log 傳送到 HELK 這裡使用 Sysmon 來蒐集 log ### 1. Sysmon 使用powershell admin 輸入 ```shell reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ModuleLogging" /v EnableModuleLogging /t REG_DWORD /d 1 /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ModuleLogging\ModuleNames" /v "*" /t REG_SZ /d "" /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v EnableScriptBlockLogging /t REG_DWORD /d 1 /f reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v EnableScriptBlockInvocationLogging /t REG_DWORD /d 1 /f AuditPol /set /subcategory:"Process Creation" /success:enable /failure:enable Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" -Name "SCENoApplyLegacyAuditPolicy" -Value 1 New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "Audit" -Force Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit" -Name "ProcessCreationIncludeCmdLine_Enabled" -Value 1 gpupdate /force Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process ``` ```shell git clone https://github.com/guan4tou2/diy-cyberrange.git cd diy-cyberrange ./sysmon64.exe -accepteula -i sysmonconfig.xml ``` ### 2. winlogbeat `Invoke-WebRequest -Uri "https://raw.githubusercontent.com/guan4tou2/diy-cyberrange/refs/heads/main/set-winlogbeat.ps1" -OutFile "set-winlogbeat.ps1"; PowerShell -ExecutionPolicy Bypass -File "set-winlogbeat.ps1" `