Contents

Crafting Suricata Rules: - A Deep Dive into CVE-2020-10189 Zoho ManageEngine


A Deep Dive into CVE-2020-10189 Zoho ManageEngine

以 CVE-2020-10189 為例, 透過分析 PCAP 寫些 IDS rules 來偵測此事件, 這個 RCE exploit 剛好可以寫很多個不一樣的偵測方式 , IDS rule 驗證方式一樣用之前介紹過的 Suricata 來實作

ENV

  • MAC M1
  • OrbStack Container
  • Image: jasonish/suricata
  • PCAP: The pcap file is a self-recorded capture of the traffic from Metasploit to Zoho in a self-hosted VM environment.

CVE-2020-10189

這邊就不討論這個 CVE 的攻擊方式, 網路上有很多相關的資源和介紹, 純粹以寫 IDS rule 方式切入如何偵測到此次事件

  1. 首先找到攻擊的觸發點 /images/zoho/1.png
  2. 我們很快的看出來攻擊點可能會是 POST /mdm/client/v1/mdmLogUploader?udid=\..\..\..\webapps\DesktopCentral\_chart&filename=logger.zip
  3. 就可以寫我們的第一條規則來偵測它
    alert http any any -> any any (msg:"ZOHO exploit attempt to CVE-2020-10189 V1"; sid:10004; flow:to_server,established; content:"POST"; content:"/mdm/client/v1/mdmLogUploader?udid=\\..\\..\\..\\webapps\\DesktopCentral\\_chart&filename=logger.zip"; nocase;)
    
    /images/zoho/2.png
  4. 但這樣會出現一個問題我們很清楚可以看到他前面是一段 path traversal, 如果攻擊者改成下面的方式我們剛剛寫的那條規則可能就會偵測不到了 POST /mdm/client/v1/mdmLogUploader?udid=blue\..\..\..\webapps\DesktopCentral\_chart&filename=logger.zip
  5. 試著修改下成更通用一點的規則
    alert http any any -> any any (msg:"ZOHO exploit attempt to CVE-2020-10189 V2"; sid:10004; flow:to_server,established; content:"POST"; content:"/mdm/client/v1/mdmLogUploader"; http_uri; content:"udid="; http_uri; content:"..\\webapps\\DesktopCentral"; nocase;)
    

範例就到這邊, 之後還有更多的衍生, 如果攻擊者用 %5c %2f 試圖繞過規則要如何偵測的到 (?)

Extra Rules

當然除了客製化的規則, 我們其實也可以用很多通用的規則抓到這個

例如:

- Path Traversal /images/zoho/4.png - Java Object Deserialization /images/zoho/5.png

這些規則僅用來測試和教學, 不是嚴謹的撰寫, 很容易誤抓其他不相關的東西 QQ