2025年2月18日 星期二

[研究 bootstrap 3.4.1安全性弱點(CVE-2024-6485)之檢測

[研究 bootstrap 3.4.1安全性弱點(CVE-2024-6485)之檢測

2025-02-05x

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

********************************************************************************

CVE-2024-6485 Detail

https://nvd.nist.gov/vuln/detail/CVE-2024-6485

在引導程式中發現了一個安全漏洞,可能引發跨站點腳本 (XSS) 攻擊。該漏洞與按鈕插件內的 data-loading-text 屬性有關。可以透過將惡意 JavaScript 程式碼注入屬性來利用此漏洞,該程式碼將在按鈕的載入狀態被觸發時執行。

********************************************************************************

白箱工具 Fortify SCA 或 checkmarx、黑箱 Web 弱點掃描工具 可以掃描 bootstrap 3.4.1版本存在安全性弱點(CVE-2024-6485)嗎 ?

ChatGPT 說:

Fortify Static Code Analyzer(SCA)和 Checkmarx 等白箱測試工具主要針對原始碼進行分析,以發現潛在的安全漏洞。然而,Bootstrap 是一個前端框架,通常以編譯後的 CSS 和 JavaScript 文件形式包含在專案中。由於這些工具主要針對原始碼,可能無法有效掃描已編譯或壓縮的第三方庫,如 Bootstrap。

針對 CVE-2024-6485 這類已知的第三方庫漏洞,建議使用專門的組件分析工具(如 OWASP Dependency-Check 或 Snyk)來檢測專案中使用的第三方庫是否存在已知漏洞。這些工具可以掃描專案的依賴項,並與已知漏洞資料庫進行比對,以識別並提醒您更新或替換存在漏洞的組件。

至於黑箱 Web 弱點掃描工具,它們通常模擬外部攻擊者的視角,透過分析 Web 應用程式的運行情況來發現安全漏洞。這些工具可能無法直接識別特定版本的第三方庫漏洞,但可以發現由這些漏洞引發的潛在安全問題。

因此,為了全面保障您的應用程式安全,建議結合使用白箱測試、黑箱測試和組件分析工具,以確保及時發現並修復各類安全漏洞。

********************************************************************************

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="bootstrap" version="3.4.1" targetFramework="net48" />
  <package id="jQuery" version="3.7.1" targetFramework="net48" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
</packages>

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" 
    Inherits="WebApplication1.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="Content/bootstrap.css" rel="stylesheet" />
    <script src="Scripts/jquery-3.7.1.js"></script>
    <script src="Scripts/bootstrap.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
        </div>
    </form>
</body>
</html>



Default.aspx.cs

using System;

namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}


********************************************************************************

Fortify SCA 掃描結果,無法發現 CVE-2024-6485 問題



********************************************************************************

另一份 CODE

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net48" />
</packages>

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="WebApplication1.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
    <%--參考: https://www.runoob.com/bootstrap/bootstrap-button-plugin.html --%>

    <form id="form1" runat="server">
        <h4>演示 .button('loading') 方法</h4>
        <div id="myButtons2" class="bs-example">
            <button type="button" class="btn btn-primary"
                data-loading-text="Loading...">
                原始
            </button>
        </div>
    </form>
    <script>
        $(function () {
            $("#myButtons2 .btn").click(function () {
                $(this).button('loading').delay(1000).queue(function () {
                });
            });
        });
    </script>
</body>
</html>

Default.aspx.cs

using System;


namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            
        }
    }
}


********************************************************************************

掃描結果



********************************************************************************

(完)

相關

沒有留言:

張貼留言