Dear 各位先進,
近期某家金融客戶,由 third-party 資安設備偵測到某台 Web server 一直遭到 Hydra Webshell 攻擊, 如下面 report
![Hydra_report.jpg Hydra_report.jpg](https://community.checkpoint.com/t5/image/serverpage/image-id/1316i067036FDA5F8B47C/image-size/large?v=v2&px=999)
這問題我們有開 Ticket , IPS database 更新到最新版本, 也 import 最新的 Snort rules, 並把所有有關 Hydra Signature 都設為 Prevent, 但還是偵測不到這個攻擊
最後我們是用 Snort rules 來阻擋含有 "public/hydra.php?xcmd=cmd.exe" 這個關鍵字的流量, 步驟如下:
1. 準備 Snort rules
Snort rules 檔案請參考附件
或是將以下語法存成 file-name.rules
alert tcp any any -> any any (content: "public/hydra.php?xcmd=cmd.exe"; msg: "HYDRA Attack-jacky_test";)
至於語法的說明, 在 Google 大神上都可以查的到,這邊就不加說明
2. 將 Snort rule 檔案滙入 Check Point
![ScreenShot01090.jpg ScreenShot01090.jpg](https://community.checkpoint.com/t5/image/serverpage/image-id/1317i4231A38BD3918501/image-size/large?v=v2&px=999)
詳細的滙入說明可參考松倫大大分享的文章
https://community.checkpoint.com/t5/Taiwan%E8%AB%96%E5%A3%87/New-Exploits-for-Unsecure-SAP-Systems-H...
若是 R77.30 的版本, 可參考
https://sc1.checkpoint.com/documents/R77/CP_R77_IPS_WebAdminGuide/12857.htm
3. 滙入完成後, 將滙入的 Snort rules Action 設為Prevent, 並且勾選Capture Packets
![ScreenShot01091.jpg ScreenShot01091.jpg](https://community.checkpoint.com/t5/image/serverpage/image-id/1318i621393EA2C44FCF2/image-size/large?v=v2&px=999)
4. Install Threat Prevention policy, 然後產生一些 http://IP/public/hydra.php?xcmd=cmd.exe%20/c%20 測試流量
例如用 pchome 來做測試, 會看到連線被 reset 掉
![ScreenShot01098.jpg ScreenShot01098.jpg](https://community.checkpoint.com/t5/image/serverpage/image-id/1319i02D66C57CAA8CAE0/image-size/large?v=v2&px=999)
5. 查看 IPS log 是否有相關 log![ScreenShot01093.jpg ScreenShot01093.jpg](https://community.checkpoint.com/t5/image/serverpage/image-id/1320i1D57668E933E116C/image-size/large?v=v2&px=999)
![ScreenShot01094.jpg ScreenShot01094.jpg](https://community.checkpoint.com/t5/image/serverpage/image-id/1321iEFAADD2503C19FCD/image-size/large?v=v2&px=999)
點選 Packet Captures 可看到阻擋的封包內容
![ScreenShot01097.jpg ScreenShot01097.jpg](https://community.checkpoint.com/t5/image/serverpage/image-id/1322iB17AA64A429379AE/image-size/large?v=v2&px=999)
所以透過 Snort Rules, 只要簡單修改一些內容, 就可以達到阻檔 keyword 的目的, 很簡單
PS. 若是 HTTPS 的流量, 當然是要開 HTTPS Inspection 才看的到囉
Regards,
Jacky