某單位 git 洩漏 + 任意檔案上傳導致 RCE - HITCON ZeroDay

Vulnerability Detail Report

Vulnerability Overview

  • ZDID: ZD-2023-01058
  •  發信 Vendor: 中華民國電腦稽核協會
  • Title: 某單位 git 洩漏 + 任意檔案上傳導致 RCE
  • Introduction: git 洩漏 + 任意檔案上傳導致 RCE

處理狀態

目前狀態

公開
Last Update : 2024/03/11
  • 新提交
  • 已審核
  • 已通報
  • 未回報修補狀況
  • 未複測
  • 公開

處理歷程

  • 2023/12/26 16:03:19 : 新提交 (由 pwn2ooown 更新此狀態)
  • 2023/12/26 17:31:37 : 新提交 (由 pwn2ooown 更新此狀態)
  • 2023/12/26 17:32:45 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2024/01/18 16:16:09 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2024/01/18 16:16:09 : 通報未回應 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2024/01/18 16:16:10 : 通報未回應 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2024/03/11 03:00:01 : 公開 (由 HITCON ZeroDay 平台自動更新)

詳細資料

  • ZDID:ZD-2023-01058
  • 通報者:pwn2ooown (pwn2ooown)
  • 風險:嚴重
  • 類型:遠端命令執行 (Remote Code Execution)

參考資料

攻擊者可經由該漏洞取得主機完整權限、任意寫入檔案及取得大量內網資訊。

漏洞說明: OWASP - Code Injection
https://www.owasp.org/index.php/Code_Injection

漏洞說明: OWASP - Command Injection
https://www.owasp.org/index.php/Command_Injection

漏洞說明: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
http://cwe.mitre.org/data/definitions/77.html

漏洞說明: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
http://cwe.mitre.org/data/definitions/78.html
(本欄位資訊由系統根據漏洞類別自動產生,做為漏洞參考資料。)

相關網址

https://www.caa.org.tw

https://www.caa.org.tw/images/member/ooo.php?1=id

敘述

  1. 使用 curl https://www.caa.org.tw/.git/config 可發現有 git 洩漏,使用現成工具如 GitHack 即可 dump 出網站原始碼。

  2. 快速審計代碼後,發現學生帳號的上傳學生證的功能有漏洞。並且有一段檢查副檔名的代碼在前端的 PJSFunc.js 內,直接在瀏覽器做 patch 即可繞過

  3. 上傳 webshell 即 RCE。我的 webshell 在 https://www.caa.org.tw/images/member/ooo.php?1=id,如圖

圖片

修補建議

1. git 相關檔案不應暴露在外網

2. 上傳功能檢查須放在後端且需更嚴謹過濾。

擷圖

留言討論

聯絡組織

 發送私人訊息
您也可以透過私人訊息的方式與組織聯繫,討論有關於這個漏洞的相關資訊。
;