<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by wh0arey0u on Medium]]></title>
        <description><![CDATA[Stories by wh0arey0u on Medium]]></description>
        <link>https://medium.com/@wh0arey0u987?source=rss-f104a8cfa6ff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*o4HyRtnMoLR4trw5aVyHqA.png</url>
            <title>Stories by wh0arey0u on Medium</title>
            <link>https://medium.com/@wh0arey0u987?source=rss-f104a8cfa6ff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 10:55:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wh0arey0u987/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[由Azure Sentinel＋Logic App＋AI砌一套自動化 SOC Playbook — 第二篇: phishing email response playbook]]></title>
            <link>https://medium.com/@wh0arey0u987/%E7%94%B1azure-sentinel-logic-app-ai%E7%A0%8C%E4%B8%80%E5%A5%97%E8%87%AA%E5%8B%95%E5%8C%96-soc-playbook-%E7%AC%AC%E4%BA%8C%E7%AF%87-phishing-email-response-playbook-ef67792760de?source=rss-f104a8cfa6ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef67792760de</guid>
            <category><![CDATA[ai-soc]]></category>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[soc]]></category>
            <dc:creator><![CDATA[wh0arey0u]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 16:02:35 GMT</pubDate>
            <atom:updated>2026-11-05T03:36:10.981Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BPkd_OTT9lTe_a4kQkUvIg.jpeg" /></figure><p>上一篇我哋講完成個架構，由 Sentinel、Logic App、Defender API 到 Managed Identity 嘅關係，同埋 Standard vs Consumption tier 點揀。今篇我哋落手砌 — 由零開始寫一個真係 work 嘅 phishing email response playbook。</p><p>場景係咁嘅：有人收到 phishing email，Sentinel 偵測到，開咗個 incident。你個 playbook 自動 trigger，由 incident 度抆返封 email 嘅 network message ID 同埋個收件人，然後經 Microsoft Graph 嘅 Defender API 將封 email soft-delete，最後 send 封 notification email 俾個 user 話佢知發生咩事。</p><p>全自動。</p><blockquote>成個 Flow 嘅 Overview</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tdP0JNstgu6jU3AWS_kRpA.jpeg" /></figure><p>成個 Logic App workflow 有五個核心 step：</p><ol><li>Trigger — Sentinel incident 觸發 playbook</li><li>Initialize Variables — 準備兩個 variable 去 hold network message ID 同 recipient email address</li><li>Parse Entities — 由 incident payload 嘅 relatedEntities 抆出 kind = MailMessage 嘅實體，再抽 properties.networkMessageId 同 properties.recipient</li><li>Call Remediate API — 將 networkMessageId + recipient 組成 analyzedEmails array，經 Managed Identity POST 去 Microsoft Graph 嘅 remediate endpoint 做 soft-delete</li><li>Send Notification &amp; Update Incident — 通知 user + 返 Sentinel 留 comment 記錄</li></ol><p>下面遂步拆解。</p><blockquote>Step 0 — 開工前一定要搞好嘅授權</blockquote><p>1. 開 Managed Identity Consumption 版要手動去 Logic App → Identity → System assigned → On。Standard 版預設已開。</p><p>2. 俾 Managed Identity 一個 Microsoft Graph app role 要 SecurityAnalyzedMessage.ReadWrite.All。注意幾點：</p><ul><li>呢個係 application 權限，呢條 API 唔支援 delegated，所以一定要用 MI／service principal，唔可以用「登入某個 user」嘅方式。</li><li>要 admin consent。</li><li>呢個係 Entra ID 嘅 app role assignment，唔係 Azure RBAC，喺 resource 嘅 IAM 頁面係搵唔到嘅。要去 Entra ID → Enterprise applications → 揀同 Logic App 同名嘅 service principal → App role assignments，或者用 PowerShell New-MgServicePrincipalAppRoleAssignment。</li></ul><blockquote>Step 1：個 Trigger — Sentinel Incident 點觸發 Playbook</blockquote><p>首先你要喺 Sentinel 度 create 一個 automation rule。當 incident 被 create 嘅時候（或者 update 嘅時候，視乎你嘅設定），automation rule 會 call 你個 Logic App。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*SfnHqjgBZYcghWlgFeGyqQ.jpeg" /></figure><p>Logic App 嘅 trigger 用嘅係 Sentinel connector 嘅 built-in trigger：「When Azure Sentinel incident creation rule was triggered」（如果你係用緊舊版）或者係新版嘅「Microsoft Sentinel incident」trigger。兩個都係 HTTP webhook trigger，背後都係 Sentinel 經 public internet POST 個 incident payload 去你個 Logic App 嘅 workflow URL。</p><p>有一點好重要，我喺第一篇都提過：唔理你用邊條 detection rule trigger 呢個 incident 都好，只要你個 incident 入面有 MailMessage entity，呢個 playbook 就 work。 你可以係 phishing detection rule、係 Defender for Office 365 alert、甚至係你自己嘅 custom analytics rule — 總之個 incident 入面有 email-related entity（MailMessage），後面嘅 parsing logic 就一樣。</p><p>換言之，呢個 playbook 係 <strong>detection-rule-agnostic</strong> 嘅。你可以寫一個 playbook，然後 map 到幾十條不同嘅 detection rule 度，只要佢哋都係處理 email security 就得。呢個 modularity 係成個設計嘅精髓。</p><blockquote>Step 2：Initialize Variables — 準備裝 Data 嘅容器</blockquote><p>Logic Apps 入面，variable 嘅作用同任何 programming language 一樣：store data 然後俾後面嘅 step 用。我哋 initialize 兩個 variable：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AjI5S2eQbWctUIzVD7THiw.png" /></figure><p>點解要 initialize 做 empty string 而唔係直接 assign？因為 Sentinel incident 嘅 entity data 係 nested JSON，你需要先 parse 先拎到個 value。所以 variable 嘅 initial value 係空嘅，等後面嘅 step 去 set。</p><p>呢個 pair — networkMessageId + recipientEmail — 係成個 playbook 嘅 core data。一封 email 可以用 network message ID 去 unique identify，Defender API 嘅 remediate endpoint 可以直接 accept networkMessageId 做 identifier，唔需要額外做 lookup。而 recipient email 就係通知返嗰個人嘅 contact point。兩樣嘢加埋就夠做晒後面嘅 remediation 同 notification。</p><blockquote>Step 3：Parse Entities — 由 Incident Body 抆返你要嘅 Parameters</blockquote><p>當 Sentinel trigger 你個 Logic App 嘅時候，個 POST body 係 incident 物件。實體唔係喺頂層 entities，而係收埋喺 object.properties.relatedEntities：</p><pre><br>{<br>  &quot;object&quot;: {<br>    &quot;properties&quot;: {<br>      &quot;title&quot;: &quot;Phishing email delivered to user&quot;,<br>      &quot;relatedEntities&quot;: [<br>        {<br>          &quot;id&quot;: &quot;/subscriptions/&lt;subId&gt;/resourceGroups/&lt;rg&gt;/providers/Microsoft.OperationalInsights/workspaces/&lt;workspace&gt;/providers/Microsoft.SecurityInsights/Entities/&lt;entityId&gt;&quot;,<br>          &quot;name&quot;: &quot;&lt;entityId&gt;&quot;,<br>          &quot;type&quot;: &quot;Microsoft.SecurityInsights/Entities&quot;,<br>          &quot;kind&quot;: &quot;MailMessage&quot;,<br>          &quot;properties&quot;: {<br>            &quot;networkMessageId&quot;: &quot;73ca4154-58d8-43d0-a890-08dc18c52e6d&quot;,<br>            &quot;internetMessageId&quot;: &quot;&lt;d9683b4c-127b-413a-ae2e-fa7dfb32c69d@DM3NAM06BG401.Eop-nam06.prod.protection.outlook.com&gt;&quot;,<br>            &quot;recipient&quot;: &quot;victim@contoso.com&quot;,<br>            &quot;subject&quot;: &quot;Urgent: Your password will expire today&quot;,<br>            &quot;p1Sender&quot;: &quot;phisher@evil-domain.com&quot;,<br>            &quot;deliveryLocation&quot;: &quot;Inbox&quot;,<br>            &quot;threats&quot;: [&quot;Phish&quot;],<br>            &quot;fileEntityIds&quot;: [],<br>            &quot;friendlyName&quot;: &quot;7274aa12-824d-40e8-2b36-08def11d8461&quot;<br>          }<br>        }<br>      ]<br>    }<br>  }<br>}</pre><p>留意幾樣嘢：</p><ul><li>kind 係細楷 camelCase，值係 MailMessage（唔係 Type，亦唔係 mail-message）。</li><li>所有欄位都收喺 properties 之下，而且係 camelCase：properties.networkMessageId、properties.recipient、properties.internetMessageId。</li><li>networkMessageId 同 internetMessageId 係兩樣唔同嘅嘢，remediate 用前者。</li><li>一個 incident 可以有好多 entity（Account、Host、MailMessage 混住），所以要 filter。</li></ul><p>實際點砌</p><ol><li>Filter array（名：Filter_MailMessage_Entities）</li></ol><ul><li>From：@triggerBody()?[&#39;object&#39;]?[&#39;properties&#39;]?[&#39;relatedEntities&#39;]</li><li>條件：@equals(item()?[&#39;kind&#39;], &#39;MailMessage&#39;)</li></ul><p>2. 加一個 guard</p><p>Condition：@empty(body(&#39;Filter_MailMessage_Entities&#39;))</p><ul><li>True → Add comment to incident（「Incident 冇 MailMessage entity，playbook 略過」）→ Terminate（Succeeded）。唔好任由佢行落去，否則之後會用空值 call API。</li></ul><p>3. Set variable</p><pre>networkMessageId = @first(body(&#39;Filter_MailMessage_Entities&#39;))?[&#39;properties&#39;]?[&#39;networkMessageId&#39;]<br>recipientEmail    = @first(body(&#39;Filter_MailMessage_Entities&#39;))?[&#39;properties&#39;]?[&#39;recipient&#39;]</pre><p>注意 first(...) 之後仲要落 ?[&#39;properties&#39;]，因為 first() 俾你嘅係成個 entity 物件。</p><h3>如果一個 incident 有多個 MailMessage</h3><p>同一封 phishing 寄俾 5 個人，Exchange 會 fork 成 5 個 copy，每個 copy 一個 MailMessage entity、一個 recipient。上面 first() 嘅寫法只會處理第一個，其餘全部漏。</p><p>要處理晒，就將 Step 3 之後嘅流程改成 For each（For each 嘅 input 用 body(&#39;Filter_MailMessage_Entities&#39;)），然後喺 loop 入面直接 call remediate API（見 Step 4 嘅「多收件人版本」），唔使用 variable。</p><blockquote>Step 4：Call the Remediate API — 直接用 NetworkMessageId 剷 Email</blockquote><p>嚟到最 critical 嘅一步：call Defender API 去 soft-delete 封 email。</p><p>Defender 嘅 analyzedEmail remediate endpoint 係可以直接用 NetworkMessageId 嘅。即係話你唔需要先做一次 lookup call 去 resolve 個 internal ID — 由 Sentinel entity 抆到個 networkMessageId 之後，直接塞入 remediate endpoint 就 work。</p><p>呢個 design 幫你慳咗一步 API call，成個 flow 簡單好多，亦快好多。</p><pre><br>POST https://graph.microsoft.com/v1.0/security/collaboration/analyzedEmails/remediate<br><br>{<br>  &quot;displayName&quot;: &quot;Sentinel phishing auto-remediation&quot;,<br>  &quot;description&quot;: &quot;Soft delete via Sentinel playbook&quot;,<br>  &quot;severity&quot;: &quot;high&quot;,<br>  &quot;action&quot;: &quot;softDelete&quot;,<br>  &quot;remediateSendersCopy&quot;: false,<br>  &quot;analyzedEmails&quot;: [<br>    {<br>      &quot;networkMessageId&quot;: &quot;73ca4154-58d8-43d0-a890-08dc18c52e6d&quot;,<br>      &quot;recipientEmailAddress&quot;: &quot;victim@contoso.com&quot;<br>    }<br>  ]<br>}<br>```</pre><p>就係咁。networkMessageId 就係 step 3 由 Sentinel incident entity 度抆出嚟嗰個 value。</p><blockquote>Available 嘅 action values：</blockquote><ul><li>moveToJunk — 搬去 Junk Email folder</li><li>moveToInbox — 搬返 Inbox（false positive rollback 用）</li><li>moveToDeletedItems — 搬去用戶嘅 Deleted Items（用戶自己就見到、救得返）</li><li>softDelete — 由 Deleted Items 移去 Recoverable Items\Deletions（Deleted Items 見唔到，用戶要經 Outlook／OWA 嘅「Recover deleted items」先救得返）</li><li>hardDelete — purge；用戶救唔返，admin 仍可用 single-item recovery</li></ul><p>想「用戶自己喺 Deleted Items 執返」就揀 moveToDeletedItems，唔係 softDelete。如果揀 softDelete，通知信要教用戶用「Recover deleted items」，唔係叫佢去 Deleted Items。</p><p>大部分 automated phishing response 用 softDelete 係合理 default；detection 好有把握（例如 phish confidence 高）可以考慮 hardDelete，但要接受用戶救唔返。</p><h3>HTTP action 嘅設定</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ze1bDMI9wIXPRW-LcS9sdg.png" /></figure><p>Audience 一定要改。Managed Identity 嘅 Audience 預設係 <a href="https://management.azure.com/">https://management.azure.com/</a>，唔改就會攞到 ARM token，打 Graph 直接 401。至於 token 點嚟 — — 係由 Logic Apps 平台代你攞同 renew，你唔需要（亦唔應該）自己處理。</p><p>成功嘅 response 會係 HTTP 302 ，你之後可以用一個 condition action 去 check response status code — 如果唔係 302，可以 fallback 做 manual notification 或者 log 返個 error 落 Sentinel incident comment。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*BjYattFNnQ7akGqP5E7ZBQ.png" /></figure><blockquote>Step 5：Notification 同 Close the Loop</blockquote><p>API call 成功之後，要做返兩樣 housekeeping 嘢。</p><blockquote>Send Email Notification</blockquote><p>用 Logic Apps 嘅 Office 365 Outlook connector（或者其他 email connector），send 一封簡潔嘅 notification 俾個受影響嘅 user。Subject line 可以係 Security notice: A suspicious email has been removed from your mailbox，Body 就簡單解釋封 email 嘅 sender 同 subject，話佢知已經自動被 purge，如果佢覺得係 false positive 可以自己去 Deleted Items recover。</p><blockquote>Update Sentinel Incident</blockquote><p>最後一步，用 Sentinel connector 嘅 “Add comment to incident” action（或者 “Update incident” action），留一段 summary comment 記錄返個 playbook 做過乜嘢。例如：</p><pre>&gt; Automated remediation executed: soft-deleted email with NetworkMessageId 4a5b6c7d-… from mailbox victim@yourcompany.com. Sender: phisher@evil-domain.com. Subject: &quot;Urgent: Your password will expire today&quot;</pre><p>呢個 comment 對 audit trail 好重要 — 幾個月之後有人問「呢單 incident 點解自己 close 咗」，你就可以 trace 返。</p><blockquote>一啲實戰 Tips</blockquote><p><strong>留意 network message ID 嘅 format</strong></p><p>networkMessageId 係 Microsoft 365／Exchange Online 產生嘅 128-bit 識別碼，官方文件會見到兩種寫法，但佢哋係同一個值：</p><ul><li>有 dash（GUID）：73ca4154-58d8-43d0-a890-08dc18c52e6d</li><li>冇 dash（32 位十六進位）：1341ac7b13fb42ab4d4408cf7f55890f ＝ 1341ac7b-13fb-42ab-4d44-08cf7f55890f</li></ul><p><strong>Handle API error gracefully</strong></p><ul><li>202／302 = 已受理；實際結果去 Action Center 睇 bulkId 底下每封 email 嘅 Success／Failed／Already in destination。</li><li>「Already in destination」通常代表之前已經 remediate 過，唔算 error。</li><li>Logic Apps HTTP action 對 4xx／5xx 同 3xx 都會 fail run，所以「加個 condition 睇 status code」係唔夠，要用 Configure run after 接住。</li><li>401 多數係 Audience 錯／MI 未開；403 多數係未派 SecurityAnalyzedMessage.ReadWrite.All 或未 admin consent；</li><li>automation rule 如果 create + update 都觸發，同一單 incident 會跑幾次；因為 API 係 async，重複 call 唔會即刻報錯。要自己做 idempotency（例如 incident 加 tag 或先檢查 comment）。</li></ul><blockquote>下回預告</blockquote><p>下一篇我哋會將個 AI agent 塞入呢個 workflow — 喺做 remediation 之前，AI 會自動分析、enrich 、然後 generate 一個 executive summary 俾 SOC analyst 睇。到時個 flow 會變成：detection → AI enrichment → decision → remediation → notification。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef67792760de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an Automated SOC Playbook with Azure Sentinel, Logic Apps, and Microsoft Defender — Part 1]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://infosecwriteups.com/building-an-automated-soc-playbook-with-azure-sentinel-logic-apps-and-microsoft-defender-part-1-35e385eceb6b?source=rss-f104a8cfa6ff------2"><img src="https://cdn-images-1.medium.com/max/600/1*-uPSa26qFZ8UntU6by6ruA.jpeg" width="600"></a></p><p class="medium-feed-snippet">This article is about building AI-assisted SOC on Azure environment, from building the infrastructure to building the workflow with AI. </p><p class="medium-feed-link"><a href="https://infosecwriteups.com/building-an-automated-soc-playbook-with-azure-sentinel-logic-apps-and-microsoft-defender-part-1-35e385eceb6b?source=rss-f104a8cfa6ff------2">Continue reading on InfoSec Write-ups »</a></p></div>]]></description>
            <link>https://infosecwriteups.com/building-an-automated-soc-playbook-with-azure-sentinel-logic-apps-and-microsoft-defender-part-1-35e385eceb6b?source=rss-f104a8cfa6ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/35e385eceb6b</guid>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[wh0arey0u]]></dc:creator>
            <pubDate>Tue, 22 Sep 2026 08:20:49 GMT</pubDate>
            <atom:updated>2026-09-22T08:20:49.797Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[由Azure Sentinel＋Logic App＋AI砌一套自動化 SOC Playbook — 第一篇：架構設計]]></title>
            <link>https://medium.com/@wh0arey0u987/%E7%94%B1azure-sentinel-logic-app-ai%E7%A0%8C%E4%B8%80%E5%A5%97%E8%87%AA%E5%8B%95%E5%8C%96-soc-playbook-%E7%AC%AC%E4%B8%80%E7%AF%87-%E6%9E%B6%E6%A7%8B%E8%A8%AD%E8%A8%88-fb7bac8cb69a?source=rss-f104a8cfa6ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb7bac8cb69a</guid>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[soar]]></category>
            <category><![CDATA[ai-soc]]></category>
            <dc:creator><![CDATA[wh0arey0u]]></dc:creator>
            <pubDate>Fri, 18 Sep 2026 12:42:15 GMT</pubDate>
            <atom:updated>2026-09-18T12:42:15.164Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-uPSa26qFZ8UntU6by6ruA.jpeg" /></figure><p>如果你做過 SOC，你一定明呢種節奏。一個 alert 彈出嚟，打開個 incident，碌下啲 entity，copy 幾個 field，paste 去第二個 tool，可能再 send 封 email 俾個 user，然後返去 close 返張 ticket。前後搞你十分鐘。一日幾十個 alert，成 team 人加加埋埋，你開始見到真正成本唔係錢，係注意力同人手。每一個手動步驟就係要個 analyst 做啲 script 都做到嘅嘢，而唔係去諗個 alert 究竟代表緊乜。</p><p>呢個就係我想解決嘅問題。我想砌個tool可以拎住個incident，自己判斷要做乜，自己去做，然後 close the loop — 全程唔使人掂 keyboard。呢個系列就係我砌嘢嘅過程，同埋更重要嘅係，你點樣可以自己砌返套。</p><p>我會分三篇去講：<br>1. 成個架構、啲 component 之間嘅關係，同埋一啲早期嘅設計決定（尤其係 Logic App 揀 tier 嗰下）。<br>2. 砌一個實際嘅 phishing response playbook，包括由 Sentinel incident body 度 extract parameter 出嚟。<br>3. 將 AI agent 塞入個 workflow 度，喺有人見到個 alert 之前幫手做 enrichment，甚至係response (如果你夠膽)。</p><p>廢話少講，即刻睇下個 big picture。</p><h3>我哋究竟砌緊乜？</h3><p>入去睇每個 service 之前，望咗成個系統先會易明好多。以下係砌好之後嘅樣：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QjtiA3WlkB0ud14FDICWWA.jpeg" /></figure><p>基本上個系統做三樣嘢：<br>- <strong>Ingest</strong>— Sentinel detect 到嘢，開個 incident。個 incident 會黐住啲 entities（user、device、email）同 raw event data。<br>- <strong>判斷同執行</strong> — Logic App 讀個 incident，抆返需要嘅 parameter 出嚟，call 啱個 remediation API，send 埋 notification。<br>- <strong>Auditable</strong>— Logic App 喺個 Sentinel incident 度留個 comment 話俾人知佢做咗乜，等個 analyst — 或者 auditor — 可以 trace 返成條鏈。</p><p>聽落好簡單。原則上，真係好簡單。但到你真係開始駁啲 service 嘅時候，就會撞埋一大堆 authentication model、permission scope、deployment choice，呢啲嘢你未踩入去之前係完全唔覺存在嘅。等我遂樣拆開嚟講。</p><h3>逐個 Component 拆</h3><h3>Azure Sentinel（Microsoft Sentinel）</h3><p>Sentinel 就係你個 cloud 版 SIEM — 佢會由你成個 environment 度接logs，run detection rules 去掃，有嘢中就開 incident。如果你睇到呢度，九成九你都係用緊 Sentinel。</p><p>對我哋嚟講最重要嘅一點係：當 Sentinel 開一個 incident 嘅時候，佢會附帶一個 payload。呢個 payload 係一個 JSON document，入面有齊 Sentinel 對呢個 alert 所知嘅嘢：相關嘅 entities、trigger 咗 detection 嘅 raw events、仲有 metadata 例如 incident ID、severity、title 咁。你嘅 Logic App 就係讀呢個 payload 然後決定做乜。呢 part 我會喺第二篇再講詳細啲。</p><h3>Logic Apps（Standard vs Consumption）</h3><p>呢度就係你個 playbook 真正行嘅地方。Logic Apps 係 Azure 嘅 low-code workflow engine — 你可以當佢係 IFTTT 或者 Zapier，不過係 native Azure 。</p><p>呢度你要做一個決定，我想花多少少時間講，因為我當初就係呢度中過伏。Logic Apps 有兩種 tier：</p><p><strong>Consumption tier </strong>係「用幾多俾幾多」嘅 model。逐個 action execution 計錢，個 app 喺 multi-tenant Azure resource度。如果你個 playbook 行得疏， 例如一日幾次，會平好多。但佢有限制：cold start 會加 latency、networking option 少好多、同埋更重要嘅係，某啲 connector 同 authentication model 係難 set 好多。Specifically，Managed Identity — 即係我哋想用嚟 auth 去 Defender API 嘅方法 — 喺 Consumption 上面以我嘅經驗嚟講係冇咁順。</p><p><strong>Standard tier</strong> 行喺 dedicated 嘅 Workflow Standard hosting plan（類似 App Service Plan，SKU 係 WS1/WS2/WS3）上面。你係俾緊個 underlay compute 嘅錢，唔理你個 workflow 行咗幾多次。喺，係低流量嘅時候係貴啲，但你得到嘅係 single-tenant runtime、VNet integration、enable 咗 Always On 就冇 cold start、同埋 — 對我哋嚟講最重要嘅 — 所有 connector type 都 first-class support Managed Identity。如果你個 playbook 要用 managed identity 去 call API（劇透：你係要嘅），Standard tier 幫你慳返一大堆 authentication 嘅麻煩。</p><p>簡單做個比較：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mKE5lNuj9wFEEG5SHVzBbw.png" /></figure><p>我最後揀咗 Standard tier。如果你個 playbook 要掂任何有 sensitive data 嘅嘢，或者你打算 scale 到 proof of concept 以上，我都會建議你揀 Standard。係，idle 嘅時候係貴啲，但 reliability 同 security 嘅 benefit 係值嘅。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Izmw2KJbLEOrCEhJoKvRg.png" /></figure><h3>Microsoft Defender API</h3><p>Microsoft Defender for Office 365、Defender for Endpoint、同埋成個 Microsoft 365 Defender suite 都有 expose REST API，俾你做啲平時 analyst 要喺 portal 度㩒嚟㩒去嘅嘢。對於我哋第二篇會講嘅 phishing playbook，我哋要關注嘅係一個特定嘅 endpoint：就係嗰個可以喺 user mailbox 度剷走 malicious email 嘅 API。</p><p>呢個 API 喺 Microsoft Graph 嘅 security namespace 下面（實際 endpoint 係 POST /security/collaboration/analyzedEmails/{id}/remediate）。你 send 一個 POST request，入面有嗰封 email 嘅 network message ID 同埋你想做嘅 action（例如 softDelete），Defender 就會自動去每一個受影響嘅 mailbox 度清走佢。唔使 PowerShell，唔使 Exchange admin UI，就咁一個 REST call 由你個 Logic App 打出嚟。</p><p>但係，最煩嘅位：authentication。API 唔會接受就咁一條 API key。佢要一個 OAuth 2.0 token，仲要係有啱嘅 delegated 或者 application permission。我哋要嘅係 application permission，因為根本冇 signed-in user — 個 Logic App 係自己行自己嘅。</p><h3>Managed Identity 同 App Registration</h3><p>呢個係將所有嘢綁埋一齊嗰 part。要俾你個 Logic App call 到 Defender API，你需要：</p><p>1. <strong>App Registration</strong>: 喺 Entra ID（以前叫 Azure AD），grant 咗啱嘅 API permission — 如果係 email purge，就要 SecurityAnalyzedMessage.ReadWrite.All（under Microsoft Graph）。呢個 permission 係 Microsoft 喺 2024 年推出嘅 analyzedEmail API 專用嘅，support soft delete、hard delete、move to junk 等 remediation action。記住要加埋 admin consent。<br>2. <strong>一個 Managed Identity</strong>: 喺 Logic App 上面。呢個 identity由 Azure 幫你管 ，唔使 rotate client secret，唔使 keep certificate。你只需要喺 Logic App 嘅 Identity blade 度開個 toggle 就得。<br>3. <strong>Logic App 嘅 Sentinel connector</strong>。</p><p>當你 set up App Registration 嘅時候，你需要嘅 API permission 係 depends on 你 call 緊邊個 Defender endpoint。Email purge 用嘅 `analyzedEmail/remediate` endpoint 要嘅 permission（`SecurityAnalyzedMessage.ReadWrite.All`），同 advanced hunting endpoint 要嗰啲（例如 `ThreatHunting.ReadWrite.All`）係唔同嘅。未 lock in permission 之前，記得 check 清楚 Microsoft 份 doc ， 因為揀錯 scope 要 redo admin consent 要搵人開permission係好煩嘅。</p><h3><strong>砌返埋一齊：成個架構</strong></h3><p>以下係完整嘅 data flow：</p><p>1. Sentinel 嘅 detection rule 中咗，開一個 incident。個 incident 包含 entities（user、email、device）同 raw event data。<br>2. 一個 playbook（Logic App）經 Sentinel 嘅 automation rule 自動 trigger，或者由 analyst 喺 incident page 手動 trigger。<br>3. Logic App 喺 HTTP trigger body 度收到個 incident payload，係一個 JSON object。<br>4. Logic App <strong>parse 個 JSON</strong>，抆返佢需要嘅 fields — 對於 phishing playbook 嚟講，就係封 email 嘅 network message ID、收件人 identity、同 threat type。<br>5. Logic App 用自己嘅 Managed Identity 去 authenticate，call <strong>Microsoft Graph Defender API</strong>，send 一個 remediation action（例如 soft-delete 封 phishing email）。<br>6. Logic App send 一封 <strong>email notification</strong> 俾受影響嘅 user，話俾佢知發生咗咩事、點解封 email 會消失咗。<br>7. Logic App<strong> update 返個 Sentinel incident</strong>，留個 comment 總結自己做過嘅嘢，有需要的話順手 close 埋個 incident。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vI0RHatDchOKYzoSOh4iQA.jpeg" /></figure><p>呢個架構係 modular 嘅。你可以隨時換走個 remediation step — 唔剷 email，可以改為 isolate 一部 device、block 一個 URL、或者 reset user password — 而唔使改動 trigger、parsing、或者 notification 嗰 part。呢種 extensibility 我會喺第三篇加 AI agent 嘅時候再講多少少。</p><h3>Private Endpoint 定係 Public Access + Access Restriction？</h3><p>Logic Apps Standard tier 嘅其中一個賣點係 VNet integration — 你可以將個 Logic App 駁入自己個 VNet，甚至用 Private Endpoint 將 inbound traffic 都 lock 埋入 private network 度。對於 security workload 嚟講，呢個聽落好合理：梗係咩都用 private endpoint 啦，對不對？</p><p>我就係咁諗。然後發現兩樣唔啱。</p><h3>問題一：Sentinel 嘅 Automation Rule trigger 唔到個 Playbook</h3><p>當你將 Logic App 嘅 inbound traffic 鎖到淨係接受 private endpoint 嘅時候（即係 block 晒所有 public access），Sentinel 嘅 automation rule 係 trigger 唔到你個 playbook 嘅。</p><p>個 root cause 係咁嘅：Sentinel 嘅 automation rule 係一個 multi-tenant Azure service。當 incident 被 create 嘅時候，Sentinel 嘅 backend 會經 public internet call 你個 Logic App 嘅 workflow trigger URL（即係嗰個 `https://&lt;your-logic-app&gt;.azurewebsites.net/api/…` 嘅 endpoint）。呢個 call 係由 Sentinel 嘅 service infrastructure 打出嚟嘅，唔會、亦冇可能經你個 private endpoint 入。如果你 block 咗所有 public inbound，Sentinel 連你個 Logic App 嘅門口都掂唔到。</p><p>換句話說：Sentinel playbook trigger 係唔 support pure private endpoint 嘅。呢個唔係 bug，而係 Sentinel automation rule 嘅 architecture 本身就係設計成由 Azure public infrastructure call 你個 playbook。即係話就算你 enable 咗 private endpoint，你都一定要留返條 public path 俾 Sentinel 入嚟。</p><p>Microsoft 嘅 official guidance都叫你用 access restriction policy（IP / service tag 白名單）而唔係 pure private endpoint 去做 inbound security。Official doc 嘅做法係 keep 住 public network access enabled，然後加一條 allow rule，只放 `AzureSentinel` 呢個 service tag 入嚟。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*esXGppWMUzPf0Ml9.png" /></figure><p>不過，呢個 official guidance 淨係解決咗「Sentinel trigger 到 playbook」呢個問題。如果你就咁跟足官方 doc 做（只放 `AzureSentinel`），你會撞到第二個問題 — 就係下面要講嘅 run history input/output 睇唔到。要解決呢個問題，你需要喺 access restriction 度額外 allow：</p><p>- 你公司／VPN 嘅 public IP range — 確保你個 browser 可以 reach 到 Logic App 嘅 management endpoint，否則 run history 嘅 input/output 係 load 唔到嘅</p><h3>問題二：Run History 嘅 Input/Output 睇唔到</h3><p>呢個係官方 doc 冇 cover 到嘅位。當你跟足 Microsoft 份 doc 淨係 allow AzureSentinel service tag 嘅時候，Sentinel 係 trigger 到你個 playbook，但你去 Azure portal 打開 run history，trigger 同 action 嘅 input/output 全部 loading 唔到，出 “Failed to fetch” 或者就咁 blank 咗。</p><p>點解會咁？因為 Azure portal 係一個 JavaScript web app，佢喺你個 browser 度行。當你 click 入 run history 睇某個 run 嘅 input/output 嘅時候，portal 嘅 JavaScript 係由 <strong>你部機個 browser </strong>直接 call Logic App 嘅 REST API 去拎 data（即係 `https://&lt;your-logic-app&gt;.azurewebsites.net` 下面嘅 management endpoint）。換言之，呢個 request 嘅 source IP 係你公司 network 個 public IP（或者你個 VPN IP），而唔係任何 Azure backend service tag 涵蓋到嘅 IP。</p><p>AzureSentinel service tag 只包含 Sentinel 嘅 infrastructure IP，唔包含你公司 network。所以你個 browser 嘅 request 就會俾 Logic App reject，run history 就自然乜都 load 唔到。</p><p>解決方法係要喺 access restriction 度 explicitly allow 你公司／VPN 嘅 public IP range，確保你個 browser 嘅 request 可以 reach 到 Logic App 嘅 management API。呢個係官方 doc 冇提嘅 practical step。</p><p><strong>結論：Inbound 用 Access Restriction</strong></p><p>搞咗一大輪，我得出嘅 practical architecture 係咁嘅：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PaCKC1eZlo4o_sARSTf2Vw.jpeg" /></figure><p>呢個方向的確冇 pure private endpoint 咁 “clean”，但呢個係 Sentinel + Logic App 嘅 architecture 現實。Inbound 方向你基本上避唔開 public endpoint，但你可以用 access restriction 去 minimize attack surface — 淨係俾必要嘅 service tag 同你公司 IP 入。 Outbound 方向就可以盡情用 private endpoint，確保你個 Logic App 同其他 Azure service 之間嘅 traffic 全部走 private network。</p><h3>一啲我撞過板先學到嘅嘢</h3><p>用真嘅 incident 去 trigger。去你個 Sentinel workspace 度拎一個真嘅 incident JSON，用佢做你嘅 test input。如果唔係，你會寫咗一套 parsing logic，喺 designer 度行得好順，一撞到真 alert — 有 nested entity object 同 missing optional field 嗰啲即時爆鑊。</p><p>Managed Identity token 係有 expiry 嘅，但 Logic App 會自動幫你 handle 晒。你唔使自己砌 token caching logic，唔使擔心 token 過期嘅問題。HTTP action 嘅 built-in authentication 喺背後自動幫你 acquire 同 refresh token，前提係個 Managed Identity enable 咗同有啱嘅 permission。</p><p>係 Sentinel 嘅 automation rule 決定你個 playbook 幾時 trigger，唔係 Logic App 自己決定。你可以 set 喺 incident creation、alert creation、或者 incident update 嘅時候 trigger。大部分 SOC 嘅 use case 嚟講，set 喺 incident creation 再加個 filter 睇 severity 或者 title keyword 就夠做。</p><p>Standard tier 嘅 Logic App 要一個 storage account 去放佢嘅 runtime state。如果你經 portal deploy，佢會自動幫你 create。但如果你用 Bicep 或者 ARM template，你要自己 explicit 咁 provision。</p><h3>下回預告</h3><p>第二篇我哋會真係砌個 phishing response playbook 出嚟。我會詳細拆解個 incident payload structure，話你知點樣抆啱啲 parameter，駁通個 Defender purge API call。睇完第二篇，你就會有一套 playbook，可以將一個 phishing alert 由 detection 去到 remediation 同 notification — 全自動化。</p><p>第三篇我哋會再進一步，將個 AI agent 塞入個 workflow 度。唔單止做 remediation，個 agent 會幫手做 enrichment、suggest 相關嘅 indicator、仲會喺 SOC analyst 打開張 ticket 之前幫佢 draft 埋個 executive summary。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb7bac8cb69a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From lock picking to Cyber Defense]]></title>
            <link>https://medium.com/@wh0arey0u987/from-lock-picking-to-cyber-defense-752678aaf6f7?source=rss-f104a8cfa6ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/752678aaf6f7</guid>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[incident-response]]></category>
            <dc:creator><![CDATA[wh0arey0u]]></dc:creator>
            <pubDate>Sun, 03 May 2026 09:37:16 GMT</pubDate>
            <atom:updated>2026-05-03T09:44:21.150Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7DcZcTxwOUOqJtDV7LZF8Q.png" /></figure><p>If you know me personally, you probably know that I recently enrolled in a locksmithing class. Two things I heard in class really enlightened me, proving that ancient wisdom remains applicable even in today’s cybersecurity landscape.</p><blockquote><strong>The ultimate value of a lock isn’t prevention; it’s <em>delay</em>.</strong></blockquote><blockquote><strong>A lock can be opened in four ways: the key, skill, force, or tricks.</strong></blockquote><p>These methods are analogous to cyberattacks — such as using leaked credentials, exploiting a vulnerability, brute-forcing, or exploiting a misconfiguration.</p><p>While simplified, the principles are remarkably similar. I wanted to share some insight into the relationship between these two fields to convey a bigger message: no matter how advanced the technology or how much the architecture changes, offense and defense remain fundamentally primitive concepts at their core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cGhHwMGK5g8j4B6Yoe5E3Q.jpeg" /><figcaption>Abloy padlock PL330 — a EN12320 Grade 3 lock, usable under severe weather</figcaption></figure><h3>We ask for 0 incident, but forget incident is inevitable.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ara2k0IUeOsaPpfw.jpg" /><figcaption>If security controls were silver bullets, movies like <em>Now You See Me</em> wouldn’t exist.</figcaption></figure><p>Recently, multiple cyber incidents have occurred in Hong Kong involving ransomware and confidential data leaks. No one wants their data exposed; I completely agree that defenders have a responsibility to safeguard the data entrusted to them by customers.</p><p>However, when we blame these companies, we must remember that cyber incidents are inevitable. As defenders, we can implement tons of controls and detection layers. But the truth is, there will always be zero-day vulnerabilities, careless users, and malicious insiders. Our responsibility is to <strong>minimize</strong> the chance of an incident, not necessarily to eliminate the possibility entirely.</p><p>This is exactly like a lock. A lock is never designed to permanently stop someone from reaching the “crown jewels”; it delays a thief from breaking into the safe. When a crown jewel is stolen, the strength of the lock is examined, but the root cause is rarely just the lock itself — it is usually a consequence of multiple factors (e.g., an insider or a lapse in safeguarding). If a lock is strong enough to withhold attacks for a day or two, it has provided the defender with enough time to detect the intrusion.</p><h3>Attack and defense remain the same, regardless of technology.</h3><p>The four ways of opening a lock (legally or illegally) map directly to cyberattacks:</p><ol><li><strong>Key</strong></li></ol><p>Obviously, if you possess the key, you can open the lock by design.</p><p>Due to the design nature, there is a limitation of key combination of every locks, the more combination it provides, the higher cost it occurs, and there are chanes that a lock cannot accomdate too many combination because of it physical size and material limitation. Key is essentially a combination of password, in a physical representation. Having the correct passcode, you then can create a key with raw material.</p><p>However, if you illegally clone a key to gain entry, you can then bypass this security layer. It is actually the same as <strong>credential leakage</strong>. Attackers seek authentic credentials to bypass security controls entirely. Attackers may observe leaked credential from dark web market, from exploting users with phishing emails, or malware backdooring your endpoint. These is very similar to traditional thieft who perform reconniance on your living areas, try to find your backup key under the carpet.</p><p><strong>2. Skill</strong></p><p>Here comes the funniest part, the typical impression of lock picking is like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*OwtswMdj_7pevqrB.jpg" /></figure><p>That’s right — we are picking this lock by understanding the internal mechanism, using correct tool to unlock. Sound familiar right? This is also how penetration testers doing their pentest day-to-day. We understand architecture of a lock, we study the mechanism, we identify a vulnerability in design, we then leverage the vulnerability to exploit and gain access. As penetration testers, this is the bread-and-butter, identifying flaws in codes and then identify the opportunity.</p><p><strong>3. Force</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LZMGNKzWkF4MfngooP6wkQ.png" /></figure><p>Not every lock is vulnerable by design, there are some well-built lock which maintain great quality that even experienced locksmiths has to spend hours to unlock. Using external force to break the lock is another way to achieve the purpose. Just like sign-in, sometimes the front door is properly configured, <a href="https://cloud.google.com/blog/topics/threat-intelligence/net-ntlmv1-deprecation-rainbow-tables/">you need to rely on brute-forcing with dictionary / rainbow table.</a></p><p><strong>4. Trick</strong></p><p>If the system itself is intact and not vulnerable, red teamers do not waste more time on the same host. Instead, red teamers would look for other opportunities from peer servers or within the enviornment, for example you may attempt to capture network flow to see if there is any servicce broadcasting NTLM request to hosts that you have control but does not have vaulable information within. Just like lock picking, sometimes the vulnerable component is not the lock itself, but the door or other things which form the whole system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/0*I3-dZikbEe-e14i0.png" /></figure><p>Like the above image, instead of targeting the lock itself, intruder targets the peep hole and leverage specific tools to bypass the lock. Lock is still doing its job — delaying intruders and making intruders to spend more effort, resources and time on breaking in.</p><h3><strong>Conclusion: There is no 100% Security, only 100% due diligence.</strong></h3><p>It is amazing how applicable ancient wisdom is in the digital era. As defenders, we must remember that despite new technologies and TTPs (Tactics, Techniques, and Procedures), the methodology remains constant: understand the system, harden it, adopt an adversary mindset, and evolve with the trends.</p><p>For senior management, asking for 100% security is a pipe dream. The real keys to success are understanding and prioritizing risk, allocating budgets to high-risk areas, and consistently lowering the attack surface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UKsp8T2p5yZHFP_SBlyZNg.jpeg" /><figcaption>Like Cybersecurity — Practice makes perfect!</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=752678aaf6f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[It is a blessing (Confidential data) in disguise (Part 2)]]></title>
            <link>https://medium.com/@wh0arey0u987/it-is-a-blessing-confidential-data-in-disguise-part-2-5a85b6d8cfa5?source=rss-f104a8cfa6ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a85b6d8cfa5</guid>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[data-exfiltration]]></category>
            <category><![CDATA[dfir]]></category>
            <dc:creator><![CDATA[wh0arey0u]]></dc:creator>
            <pubDate>Fri, 01 Aug 2025 08:56:58 GMT</pubDate>
            <atom:updated>2025-08-01T08:56:58.318Z</atom:updated>
            <content:encoded><![CDATA[<p>After studying the behaviour of the technique, it is time to dig deeper on the counter measure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XxS5vw7nPnHULtxp9fwp0g.png" /><figcaption>GOT you PDF!</figcaption></figure><p><strong>Data Classification for the win</strong></p><p>After being in a in-house position for over 2-year, one thing I learnt from the position is that detection and response does not always cover everything, there are always visibility gap, you either implement extra tool to monitor, or you restrict/harden the configuration. For detecting this tool, there is no trivial solution as the activity is rather trivial and legit. One thing we can rely on to detect is Data Loss Prevention (DLP), or maybe Cloud-Access Security Broker (CASB) with data classification capability. That way the tool would check, classify and implement relative controls. Of course, you will need a whole exercise to baseline your data inventory and user behaviour with business justification, which would not be covered in this blog post.</p><p><strong>Test:</strong></p><p>To begin with, I will leverage a Microsoft E5 (including Defender for O365, Defender for Cloud, and the other Defender suite) testing tenant to test the behaviour, ForcePoint, Zscaler, Trellix may have similar capability.</p><p>We first classify the dummy confidential data as the highest level of classification (whatever you want call this layer, the HIGHEST level).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*hwfzl3ht7Hhdgx7EvPMfKg.jpeg" /><figcaption>Highest level of confidentiality</figcaption></figure><p>Also labelling the covering PDF as public (Basically the lowest level)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEYJQzY8VQpJRhZ4u5Y9CQ.jpeg" /><figcaption>Lowest level of confidentiality</figcaption></figure><p>At the same time, we also have policy on Microsoft Purview that email with attachment with “Strictly Confidential” will be dropped by Defender for O365.</p><p>Let’s send out the blended one and the one without masking up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHPQpmFqRxJylF_MPKcrmA.png" /><figcaption>Delivery action on Defender Explorer</figcaption></figure><p>As the result indicates, an attachment with the highest level of confidentiality cannot be sent out directly. However, the one covered by a benign-looking file has been exfiltrated.</p><p>Luckily, Microsoft Purview Information Protection (MIP) to the resucre. By correctly implementing MIP control, we may implement file access control by the MIP policy. By selecting the appropriate level of data classification, whoever wants to access the file will be required to authenticate with Entra ID, and only if you have read access may you successfully read the file. Although the file still left the premises, file content remains intact and confidential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*KgW12PGSjgvKXE8PAfPSrA.png" /><figcaption>Failed access</figcaption></figure><p>Here, as you can see, Microsoft Word would automatically prompt an alert that your account does not have access right permission on the file.</p><p><strong>So, no detection?</strong></p><p><strong>Yes and no</strong>. By doing proper access control, data management and enough visibility, the SOC can monitor the access pattern of user and correlate it with their activities such as file copy, email, storage to identify potential misbehaviour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*WjIfMsiJYnPYP6_8gEMg1g.png" /><figcaption>Exfiltration blocked by DLP rule</figcaption></figure><p>Depends on your environment, I would suggest monitoring user accessing confidential information, cross check with email sending, and endpoint file activity as a pivot point. This may stop less-complex attack, but still there is no silver bullet in stopping the exfiltration all at once. Once the data is created, there are always chances it can be exfiltrated. Just like cyber incident, once you have computer systems, there are always ways to compromise, there is no bullet-proof system.</p><p><strong>Summary</strong></p><p>One thing I believed in the past was that there are always ways to detect and response to threat. However, after being in incident response fields for years, I learnt that if one conduct proper hardening, baselining and behaviour analysis, the SOC does not have to monitor every places andmi instead to spend their effort on high-risk areas instead (e.g. 1-day vulnerabilities, Insider Threat, emerging technology like AI, LLM, MCP). In this article, we shows that the even the technique can bypass email filter, proper data protection helps mitigate the risk of exfiltrating data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a85b6d8cfa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[It is a blessing (Confidential data) in disguise]]></title>
            <link>https://medium.com/@wh0arey0u987/it-is-a-blessing-confidential-data-in-disguise-benign-data-e7c652103a91?source=rss-f104a8cfa6ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7c652103a91</guid>
            <category><![CDATA[detection]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[data-exfiltration]]></category>
            <dc:creator><![CDATA[wh0arey0u]]></dc:creator>
            <pubDate>Mon, 28 Jul 2025 15:58:23 GMT</pubDate>
            <atom:updated>2025-07-28T16:00:38.734Z</atom:updated>
            <content:encoded><![CDATA[<p>I once handled a case that the suspect attempted to exfiltrate confidential files by appending the file itself into a benign file. I found this technique quite interesting and wonder if modern solution could detect such a technique. So I ran some tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-nPhwvaPLjq_VDLxjY1Uwg.png" /><figcaption>I am HIDING!</figcaption></figure><p><a href="https://github.com/wh0arey0u777/file_insert/tree/main">wh0arey0u777/file_insert: A sample python tool that appends a file into another file.</a></p><p>Of course, vibe coding is everywhere, the script is generated by GenAI and I tested it works as expected</p><pre>Can you write me a python script that it can insert a file after the end of another file, and also to extract the appended file out in the script? I suggest the script can add a hex string &quot;FF FF FF FF&quot; in between two files to separate two files as an indicator</pre><h3>#Experiment</h3><p>First, I created a folder with 3 things:<br>1. The python script file_insert.py <br>2. A benign PDF from SANS<br>3. A VERY CONFIDENTIAL Microsoft word file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*zdX6nX0x__wGWAC-d_VWkQ.png" /><figcaption>Folder itself</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*4xCKTPGWaKn02N-k9SbqGg.png" /><figcaption>A very benign pdf</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*ki8kw3c2PVevBF3vHqREWg.png" /><figcaption>Hex Editor shows the EOF of the file.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4KyKhhDtyAHsbsbh7ARJw.png" /><figcaption>A very confidential file.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EWPDGlsyQm2eAf7e6ofGJQ.png" /></figure><p>After executing the script, we obtained the file very_benign.pdf</p><p>Let’s look into the file itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LTcW6uTo947xKUBRo9ZNCA.png" /></figure><p>The end of the file does not show any content of the confidential docx file, no way SOC can tell from it apppearance that it contains sensitive data. Using file command on Linux also shows that the file is just a PDF document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*PdXe4vLaZtRsrJUKl7QoJQ.png" /></figure><p>But if we take closer look with hex editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*_jo0N6bvd7jVSFfpSPlnlA.png" /></figure><p>There is something after the EOF that we have just seen few seconds ago. It suggests that the file has been appended. The FF FF FF FF was appended by the script to separate two files. After the FF FF FF FF, 50 4b 03 04 is actually a file signature / header of zip file format, and you may know that Microsoft word file is actually a zip file contains serval items.</p><h3>#Testing in the field</h3><p>In order to valiadte, I sent the attachment with Outlook which subject to Defender for O365 monitoring. Turns out it is regarded as pdf instead of the docx file, which also indicate that this technique may also bypass attachment format checking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1LWThltP2UeT44rvlKubrg.jpeg" /><figcaption>it is regarded as pdf file.</figcaption></figure><h3>#Conclusion</h3><p>This technique offers a layer of obfuscation to bypass trivial security defend. However, there are more modern solutions in detecting data exfiltration (e.g. Data classification label.) In next chapter, I will run some test to see how likely this technique would bypass the controls.</p><p><strong>To be continued…</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7c652103a91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You may not want your lastlog in your Linux Forensics journey]]></title>
            <link>https://medium.com/@wh0arey0u987/you-may-not-want-your-lastlog-in-your-linux-forensics-journey-918db1203d65?source=rss-f104a8cfa6ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/918db1203d65</guid>
            <category><![CDATA[linux-forensics]]></category>
            <category><![CDATA[dfir]]></category>
            <dc:creator><![CDATA[wh0arey0u]]></dc:creator>
            <pubDate>Thu, 15 May 2025 16:12:28 GMT</pubDate>
            <atom:updated>2025-05-15T16:38:02.582Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Background</strong></h3><p>As a forensicators / Incident Responders, we always believe logs do not tell you the full story, but without the log, there is no story to tell. Then why don’t we need the lastlog?</p><p>TLDR: Lastlog is a sparse file in Linux file system which helps to store files with lots of zero, but it does not actually occupy disk space. Lastlog file size appears to vary based on the User ID of users, the longer user ID you use, the larger file size it is.</p><p>It is not a very obvious problems, as usually we incident responder test our tool in a testing environment, who bother integrating your Kali with Active Directory?</p><h3>Definition</h3><p>Lastlog, by definition:</p><blockquote>The lastlog file is a database which contains info on the last login of each user</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbjjD6na9hglqAogBbKB9Q.png" /><figcaption>Run, lastlog, Run!</figcaption></figure><p>So what is the problem? Let me walk you through:</p><p>Here is the testing:</p><ol><li>Before creating dummy account on my SIFT Linux, the lastlog file size is showing 0 (too small to be shown)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*-aHQhGe6w5AgrcXNtcycYg.png" /><figcaption>The original lastlog</figcaption></figure><p>2. Then, I created a dummy account, with an User ID 123123123</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zsUWvvbscUoiyFXLijjiCw.png" /><figcaption>Creating dummy account lastlog_test</figcaption></figure><p>3. Wala! a 34GB lastlog, am I experiencing brute force attack whcih left a very large logon record?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BQf2UGAUb55YU1Mi2kTldg.png" /><figcaption>34GB Lastlog</figcaption></figure><p>So, this is self-explanatory. There was not brute force attack. Instead, the lastlog file size varies depends on the User ID. You may now probably ask: Who the hell in the world create a User ID 123123123? Do you need 1 billion user account on your Linux?</p><h3><strong>The real world problem:</strong></h3><p>If you integrate your Linux with Active Directory, the user ID will be linked to your Active Directory User Account ID.</p><blockquote>S-1–5–21–1004336348–1177238915–682003330–512</blockquote><p>It is definitely larger than 123123123 a lot from the view of Linux.</p><h3><strong>The way out</strong></h3><p>There are always solutions to the problem:</p><ol><li>Forget about the Linux AD integration (Just kidding I know)</li><li>Most of the modern Linux tools can handle sparse file like gzip or rsync , however if you are doing Forensics on Windows workstation… not really the case.</li><li>Instead of copying the /var/log/lastlog , try alternatively using lastlog &gt; /tmp/lastlogcommand to get the actual content. It is possibly to be achieved by <a href="https://github.com/tclahr/uac">Unix-like Artifacts Collector</a>.</li></ol><p>On UAC artifact, either you collect the whole /var/log</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8yg0e333FHhkRS9ONha5Rw.png" /><figcaption>UAC Artifact to collect whole /var/log folder</figcaption></figure><p>Or, you can task the UAC to execute command directly</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YMNxUJ3EAv9xyJAyuVLXJg.png" /><figcaption>UAC Artifact to collect lastlog via lastlog command</figcaption></figure><h3><strong>Summary</strong></h3><p>DO NOT FORGET to investigate lastlog , it is a valuable forensics artifact. Just keep in mind that if you see a very large lastlog file next time, most likely your Linux is integrated with Active Directory via LDAP, so far, I have never seen any Linux hosts with over 1000 user accounts. (If you have seen that, you are a cool Incident Responder but having a hard like…)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=918db1203d65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are you doing under your WSL?]]></title>
            <link>https://medium.com/@wh0arey0u987/what-are-you-doing-under-your-wsl-86f385d55a3b?source=rss-f104a8cfa6ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/86f385d55a3b</guid>
            <dc:creator><![CDATA[wh0arey0u]]></dc:creator>
            <pubDate>Fri, 09 May 2025 07:53:32 GMT</pubDate>
            <atom:updated>2025-05-09T07:53:32.256Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are you doing in your WSL?</h3><p><strong>Background</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gEzWw04F_6XuOml6L3i5Ug.png" /><figcaption>Bad guys under WSL</figcaption></figure><p>There was a question that how do we investigate the Windows Subsystem for Linux (WSL2) if I am interested to check the bash_histoy of the user? The common practice is to get your hands on keyboard, logon to the targeted user profile and look into the WSL, or you may copy the whole ext4.vhdx (The virtual drive storing the Linux subsystem). However, those would be impractical if you do not have immediate access to the device, also extracting multiple GB images may also be unstable and not desirable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aSB7BMgpZav7R6VKxWz76w.png" /><figcaption>3.5 GB for a non-busy WSL virtual drive</figcaption></figure><p>Microsoft Defender for Endpoint (DfE) has a plug-in called <a href="https://learn.microsoft.com/en-us/defender-endpoint/mde-plugin-wsl">Microsoft Defender for Endpoint plug-in for Windows Subsystem for Linux (WSL) — Microsoft Defender for Endpoint | Microsoft Learn</a>, which provides additional insight within the WSL. However, this plug-in gives only visibility on certain items, and there is no interactive features such as Live Response or even malware scanning. We need some workaround when it comes to WSL incident.</p><p>After taking the FOR577 Linux Incident Response and Threat Hunting, I was inspired by the course that <a href="https://github.com/sleuthkit/sleuthkit">The Sleuth Kit (TSK)</a> is a great Command Line toolkit to read different drive on the fly.</p><p>Of course, we can download TSK directly on the disk and use CMD to extract the content directly, but it is not desirable. I then attempted to create a Velociraptor plug-in to automate the process and to create less footprint when triaging the data on the targeted host.</p><p><a href="https://github.com/wh0arey0u777/wh0arey0u_VQL/blob/main/WSLBash_History.yaml">wh0arey0u_VQL/WSLBash_History.yaml at main · wh0arey0u777/wh0arey0u_VQL</a></p><pre>name: Windows.Forensics.WSLBash_History<br>description: |<br>  This plug-in aims to provide a way for Velociraptor to extract artifact from WSL2 Linux without cloning the whole ext4.vhdx file from the target host.<br>  It integrates and leverage The Sleuth Kit (TSL) to read the ext4.vhdx file.<br><br>author: Jason Yung | wh0arey0u<br><br>parameters:<br>  - name: UserProfile<br>    type: string<br><br>tools:<br>  - name: TSK<br>    url: https://github.com/sleuthkit/sleuthkit/releases/download/sleuthkit-4.14.0/sleuthkit-4.14.0-win32.zip<br><br>type: Client<br><br>precondition: SELECT OS From info() where OS = &#39;windows&#39;<br><br>sources:<br>  - query: |<br>        LET Toolzip &lt;= SELECT FullPath FROM Artifact.Generic.Utils.FetchBinary(ToolName=&quot;TSK&quot;, IsExecutable=FALSE)<br>        <br>        LET TmpDir &lt;= tempdir()<br>        <br>        LET _ &lt;= SELECT * FROM unzip(filename=Toolzip.FullPath, output_directory=TmpDir)<br><br>        LET FcatLocation &lt;= path_join(<br>           components=[TmpDir, &#39;sleuthkit-4.14.0-win32&#39;, &#39;bin&#39;, &#39;fcat.exe&#39;],<br>           path_type=&#39;windows&#39;)<br>           <br>        LET Packages_path = path_join(components=[&#39;C:&#39;, &#39;Users&#39;, &#39;*&#39;, &#39;AppData&#39;, &#39;Local&#39;, &#39;Packages&#39;, &#39;*&#39;, &#39;LocalState&#39;, &#39;ext4.vhdx&#39;], path_type=&#39;windows&#39;)<br>        LET ext4 = &quot;ext4.vhdx&quot;<br>        SELECT * FROM foreach(<br>            row={<br>                SELECT FullPath AS vhdx FROM glob(globs=Packages_path)<br>                WHERE Name =~ &quot;ext4.vhdx&quot; <br>        },<br>        query={<br>                SELECT * FROM execve(<br>                                    argv=[FcatLocation, path_join(components=[&#39;home&#39;, UserProfile, &#39;.bash_history&#39;], path_type=&#39;linux&#39;),vhdx])<br>        }<br>        )</pre><p>This plugin reuquires you to provide the user name profile, and then it will downloaded TSK from the official Github repository. Then, it will search all the user profile under the Windows User directory, identify all the “ext4.vhdx”, create an array and check the .bash_history file of the interested user account one by one.</p><p>The plug-in can still be improved and surely there are more and more possibility to be accomplished (e.g. extracting any targeted file provide by user). It will be further improved but this is already good enough to be used by now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86f385d55a3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extract Defender Quarantined malwares and decode with Velociraptor]]></title>
            <link>https://medium.com/@wh0arey0u987/extract-defender-quarantined-malwares-and-decode-with-velociraptor-b5503f2e9946?source=rss-f104a8cfa6ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5503f2e9946</guid>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[wh0arey0u]]></dc:creator>
            <pubDate>Wed, 13 Nov 2024 16:06:16 GMT</pubDate>
            <atom:updated>2024-11-13T16:06:16.227Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Background</strong></p><p>If you are using Microsoft Defender for Endpoint, when its AV component quarantine a suspicious file, theoretically you can extract the file via DfE portal. However, it is not always reliable and working. You may need alternatives to extract the file in question, for example using Live Response to extract the file from the host.</p><p>FOX-IT has a great blog post about Defender Quarantined malware and its mechanism. <a href="https://blog.fox-it.com/2023/12/14/reverse-reveal-recover-windows-defender-quarantine-forensics/">Reverse, Reveal, Recover: Windows Defender Quarantine Forensics — Fox-IT International blog</a>.</p><blockquote>TLDR: It stores the malware under the path <strong>/ProgramData/Microsoft/Windows Defender/Quarantine/Resource </strong><em>encoded with a hard-coded RC4 key.</em></blockquote><p>Let’s say we are lucky enough to extract the encoded malware out of the box, what is next? <a href="https://github.com/zam89/Windows-Defender-Quarantine-File-Decryptor">zam89/Windows-Defender-Quarantine-File-Decryptor: Extract quarantine files from Windows Defender</a> is a tool I found on GitHub, it worked for a few times for me. However, recently I personally encountered a file that this executable could not decode, I have to find another way out.</p><p><strong>Velociraptor for the win</strong></p><p>After some initial research, I found that there is an<a href="https://docs.velociraptor.app/exchange/artifacts/pages/defenderquarantineextract/"> interesting plugin for Velociraptor</a> developed by Eduardo Mattos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*acOUT8GL9OESjd0Q_thaHw.png" /><figcaption>Windows.Applcations.DefenderQuarantineExtract plugin</figcaption></figure><p>To leverage this plugin, below are the necessary steps to get the plugin running.</p><ol><li>Setup a Velociraptor server</li></ol><p>a nice and simple<strong><em> ./velociraptor.exe gui</em></strong> with a elevated PowerShell would do the trick.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pMbV_AJ690u5ZiF-vzbBHQ.png" /><figcaption>Initiating Velociraptor</figcaption></figure><p>2. View Artifact and add custom artifact</p><p>Click the <strong>+</strong> button, paste the custom artifact copied from Velociraptor website and save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*A5AG3MNC2KL39SGo0nJO3Q.png" /><figcaption>Import custom artifact</figcaption></figure><p>3. Create a new hunt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JyBxkRW-Kb976U70tZJNyw.png" /><figcaption>Create new hunt</figcaption></figure><p>4. Modify the configuration, point the path to the file you extracted from the infected host. Remember to select “<strong>Select to upload decoded quarantined files.”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sQ8_JU6tu_eiTGlQjIgXpw.png" /><figcaption>Configuration</figcaption></figure><p>5. Save and run the hunt; after running the hunt, you can download the decoded file from “<strong>Results</strong>”, select “<strong>Full Download</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cGPA2tOhihEp317VyIoS_Q.png" /><figcaption>Download the result</figcaption></figure><p><strong>Remark:</strong> for some file format, you may not get the exact file format after decoding, you may want to try CyberChef “<strong>Extract Files” </strong>Recipe. If the file of interest appears, you may calculate the hash to see if it matches with the detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TM1He4syVQ7cl8CsIxF0tA.png" /><figcaption>CyberChef — Extract Files</figcaption></figure><p><strong>Summary</strong></p><p>It aims to provide an alternative when your EDR/AV disappoint you during malware extraction. There are plenty of reasons the extraction fails, I have seen Defender could not react fast enough to quarantine the file before it was deleted (usually .log, cache file, page file, etc).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5503f2e9946" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>