漏洞類別 - header
以下漏洞通常可以透過設定 http header 完成漏洞修補
設定:Content Security Policy (CSP)
學長姐跟你說,在網站的資安設定裡,CSP 絕對是個狠角色,也是保護使用者非常重要的一道防線。雖然設定起來有點複雜,但學會了超有成就感!
為什麼需要 CSP? (它解決什麼問題?)
想像一下,你的網頁就像一個舞台,上面會跑各種腳本 (JavaScript)、載入各種樣式 (CSS)、圖片等等。如果壞人(駭客)想辦法在這個舞台上偷偷塞進惡意的腳本,就可能偷走使用者的資料、綁架使用者的瀏覽器等等。
CSP 的主要目的,就是要限制你的網頁只能從「你允許」的地方載入或執行資源,就像是請了一個嚴格的保鑣,不是經過你同意的,一律擋掉!這樣就算網頁不小心有漏洞,駭客也很難成功注入惡意程式碼。
CSP 是什麼? (基本觀念)
CSP 其實就是一個列表,你告訴瀏覽器:
- 「這個網頁的 JavaScript 只能從 A 網站和 B 網站載入和執行。」 (
script-src
) - 「CSS 樣式表只能從 C 網站和我的網站本身載入。」 (
style-src
) - 「圖片只能從我的網站、某個圖床網站、和 Google Analytics 載入。」 (
img-src
) - … 以及各種不同類型的資源 (字體、框架、連線位址等等)。
它遵從一個「預設拒絕 (Default Deny)」的原則:只要你沒有明確允許的來源,瀏覽器一律封鎖。
這也是它困難的地方,因為你必須把網站「所有會用到」的外部資源來源都加到這個允許清單裡,不然一不小心就會把你網站正常的腳本、樣式、圖片給擋掉,導致網頁顯示或功能異常。
如何設計 CSP 政策? (觀念與步驟)
設計 CSP 是一個「疊代」的過程,也就是要慢慢測試、調整,而不是一次到位。
- 了解你的網站用了哪些資源: 你的網站載入了哪些外部的 JavaScript (例如 GA 追蹤碼、jQuery CDN、廣告腳本)?用了哪些外部字體?載入了哪些外部圖片?這些都要先盤點。
- 從「報告模式 (Report-Only)」開始: 非常重要! 千萬不要一開始就設定強制執行 (
Content-Security-Policy
)。請先使用Content-Security-Policy-Report-Only
這個 Header。- 設定
report-uri
或report-to
指令,告訴瀏覽器如果發現有資源被 CSP 擋到(即使在 Report-Only 模式下只是「模擬」阻擋),要把違規的報告送到哪裡。 - 為什麼要這樣做? 在 Report-Only 模式下,瀏覽器只會記錄並發送違規報告,但不會真的阻止任何資源載入或執行。這樣你可以在不影響使用者正常瀏覽網站的情況下,收集哪些合法的資源會被你設計的 CSP 擋到。
- 設定
- 分析報告並調整政策: 收集一段時間的違規報告後,分析報告內容,看看是哪些你網站正常需要的資源被擋到了。根據這些報告,逐步修改你的 CSP 政策,把這些遺漏的合法來源加到你的允許清單裡。
- 重複步驟 2 & 3: 持續在 Report-Only 模式下收集報告、分析、調整政策,直到報告中不再出現你網站正常功能所需的資源被擋的狀況。
- 切換到強制執行模式: 當你對 CSP 政策非常有信心,確定它不會誤擋正常資源後,就可以把
Content-Security-Policy-Report-Only
Header 換成Content-Security-Policy
Header,正式啟用 CSP 的保護功能了!
設計與檢測的好幫手 (工具)
在上面這個過程中,工具有非常重要的角色:
-
檢測設計工具:CSP Evaluator (https://csp-evaluator.withgoogle.com/)
- 功用: 這工具就像你的「政策草稿檢測器」。在你還沒實際部署到網站上之前,你可以把你腦中或寫好的 CSP 政策字串丟進去。
- 它會幫你: 檢查你的 CSP 語法有沒有寫錯?你設定的哪些規則是比較弱的、可能有風險?(它會給一些安全建議)。
- 使用時機: 在你設計或修改政策草稿時,先用它來檢查語法和初步的安全性,減少部署後才發現語法錯誤或根本沒達到保護效果的機會。
-
實際網站 CSP 檢測工具:Chrome Extension CSP Evaluator (https://chromewebstore.google.com/detail/csp-evaluator/fjohamlofnakbnbfjkohkbdigoodcejf?hl=en-US)
- 功用: 這是一個瀏覽器擴充功能,當你瀏覽一個網頁時,它會自動偵測這個網站的 HTTP Header 中有沒有設定 CSP。
- 它會幫你: 直接抓取當前網站「正在使用」的 CSP 政策,並進行分析,告訴你這個網站的 CSP 設定長什麼樣子、有哪些規則、安全強度如何等等。
- 使用時機: 當你想查看別的網站用了什麼 CSP 政策參考一下,或是當你已經把 CSP 部署到你的測試或正式環境後,用它來確認你的 CSP Header 有沒有正確送出、政策內容是不是對的。同時,配合瀏覽器的開發者工具 (Developer Console) 來看 CSP 的 Violation 錯誤訊息,也是排查問題時非常重要的步驟!開發者工具會明確告訴你「哪個資源因為違反了哪條 CSP 規則而被擋下來」。
大挑戰
CSP 強大歸強大,但設定起來確實是個挑戰,特別是對於老舊或引用資源複雜的網站:
- 容易誤擋: 如果你的允許清單沒列完整,正常的網站功能可能就會壞掉。
- 需要熟悉網站結構: 你必須很清楚你的網站到底從哪裡載入了什麼東西。
- 維護成本: 網站改版、加入新的第三方服務時,常常需要回頭更新 CSP 政策。
總結:
設計 CSP 的核心觀念是「預設拒絕,只允許信任的來源」。設定時請務必從「Report-Only 模式」開始,收集報告、逐步調整政策,最後再切換成強制執行。搭配 CSP Evaluator (線上的) 來檢查政策草稿的語法和基本安全,以及 Chrome Extension CSP Evaluator (瀏覽器內的) 和開發者工具來檢查實際部署的狀況和排查問題,這樣就能一步一步搞定這個「大魔王」囉!
剛開始學 CSP 會覺得規則很多很亂是正常的,不用太緊張,多查資料、多練習設定和看違規報告,慢慢就會越來越熟悉了!
弱點名稱: 應用程式中找到不必要的 HTTP 回應標頭
處理前自我檢測
curl -IsL https://example.com/example/assets/front-c4f19b086c52c5bccc6b14a04de0f367.js | grep -i server
user01@example:~$ curl -IsL https://example.com/example/assets/front-c4f19b086c52c5bccc6b14a04de0f367.js | grep -i server
Server: Apache-Coyote/1.1
處理方式
- 設定 覆載平衡 移除 http headers 裡的 server info
curl -IsLk https://127.0.0.1/example/ | grep -i -E "Cache-Control|Pragma"
http-response set-header Cache-Control no-store
http-response set-header Pragma no-cache
弱點名稱: 已啟用不安全的 “OPTIONS” HTTP 方法
- 修補方式: 設定負載平衡
if ($request_method ~* OPTIONS) {
return 403;
}
- 檢測方式
http stats code 不應該為 200
curl -IsLk -w "%{http_code}\n" -X OPTIONS -o /dev/null https://<domain-name>/
修補方式可參考: https://www.cnblogs.com/miracle-luna/p/14274395.html
弱點名稱: 主機標頭注入
- 修補方式: 設定負載平衡
- 檢測方式
http stats code 不應該為 200
curl -IsLk -w "%{http_code}\n" -o /dev/null https://example.com/ --header 'Host: wwww.google.com'
弱點名稱: 遺漏「Content-Security-Policy」標頭
-
修補方式: 設定負載平衡
-
檢測方式
結果應該為 1 以上
curl -IsLk https://example.com/ | grep -i Content-Security-Policy | wc -l
弱點名稱:「Content-Security-Policy」中遺漏或包含不安全的「Style-src」或「Default-src」原則
處理前自我檢測
curl -IsL https://example.com/ | grep -i -E "Content-Security-Policy"
user01@example:~$ curl -IsL https://example.com/ | grep -i -E "Content-Security-Policy"
Content-Security-Policy: script-src 'unsafe-inline' 'strict-dynamic' 'nonce-15d6c15b0f00a08' https://example.com https://example.com https://www.google-analytics.com ;object-src 'none';base-uri 'none';
處理方式
- Content-Security-Policy 新增 style-src, default-src
修補說明
- 設定 conf.d/* Content-Security-Policy 值 新增 style-src, default-src
[root@example nginx]# grep Content-Security-Policy conf.d/*
conf.d/ssl.conf: add_header Content-Security-Policy "script-src 'unsafe-inline' 'strict-dynamic' 'nonce-15d6c15b0f00a08' https://example.com https://example.com https://www.google-analytics.com ;object-src 'none';base-uri 'none'; frame-ancestors 'none'; default-src 'unsafe-inline' 'self' https://example.com https://example.com https://www.google-analytics.com; style-src 'unsafe-inline' 'self'; ";
;
- 修補後自行檢測結果
[root@example nginx]# curl -IsL https://example.com/ | grep -i -E "Content-Security-Policy"
Content-Security-Policy: script-src 'unsafe-inline' 'strict-dynamic' 'nonce-15d6c15b0f00a08' https://example.com https://example.com https://www.google-analytics.com ;object-src 'none';base-uri 'none'; frame-ancestors 'none'; default-src 'unsafe-inline' 'self' https://example.com https://example.com https://www.google-analytics.com; style-src 'unsafe-inline' 'self';
弱點名稱: 「Content-Security-Policy」標頭中遺漏或包含不安全的「Frame-Ancestors」原則
處理前自我檢測
curl -IsL https://example.com/ | grep -i -E "Content-Security-Policy"
user01@example:~$ curl -IsL https://example.com/ | grep -i -E "Content-Security-Policy"
Content-Security-Policy: script-src 'unsafe-inline' 'strict-dynamic' 'nonce-15d6c15b0f00a08' https://example.com https://example.com https://www.google-analytics.com ;object-src 'none';base-uri 'none';
處理方式
- Content-Security-Policy 新增 frame-ancestors
修補說明
- 設定 conf.d/* Content-Security-Policy 值 新增 frame-ancestors
[root@example nginx]# grep Content-Security-Policy conf.d/*
conf.d/ssl.conf: add_header Content-Security-Policy "script-src 'unsafe-inline' 'strict-dynamic' 'nonce-15d6c15b0f00a08' https://example.com https://example.com https://www.google-analytics.com ;object-src 'none';base-uri 'none'; frame-ancestors 'none';";
- 修補後自行檢測結果
[root@example nginx]# curl -IsL https://example.com/ | grep -i -E "Content-Security-Policy"
Content-Security-Policy: script-src 'unsafe-inline' 'strict-dynamic' 'nonce-15d6c15b0f00a08' https://example.com https://example.com https://www.google-analytics.com ;object-src 'none';base-uri 'none'; frame-ancestors 'none';
弱點名稱: 遺漏或不安全的 HTTP Strict-Transport-Security 標頭
處理前自我檢測
curl -IsL https://example.com/example/ | grep -i -E "Strict-Transport-Security"
user01@example:~/Downloads$ curl -IsL https://example.com/example/ | grep -i -E "Strict-Transport-Security"
處理方式
- http header 設定 Strict-Transport-Security 值為 max-age=63072000 。
修補說明
設定 Strict-Transport-Security
conf.d/* 設定 add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
,結果如下
[root@example nginx]# grep Strict-Transport-Security conf.d/*
conf.d/default.conf: add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
conf.d/ssl.conf: add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
conf.d/ssl.conf: add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
設定完成後檢視
conf.d/ssl.conf: add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
[root@example nginx]# curl -IsLk https://127.0.0.1/example/ | grep -i -E "Strict-Transport-Security"
Strict-Transport-Security: max-age=63072000; includeSubdomains; preload
弱點名稱: 遺漏或不安全的 “X-Content-Type-Options” 標頭
處理前自我檢測
curl -IsL https://example.com/ | grep -i -E "X-Content-Type-Options"
user01@example:~$ curl -IsL https://example.com/ | grep -i -E "X-Content-Type-Options"
X-Content-Type-Options: nosniff
處理方式
https://example.com/ http header 有設定 X-Content-Type-Options 值為 nosniff 。
弱點名稱: 找到可快取的 SSL 頁面
- 修補方式: 設定負載平衡
- 檢測方式
SSL 頁面標頭中使用 “Cache-Control: no-store” 及 “Pragma: no-cache”
for i in {https://example.com/example/auth/login,https://example.com/example/js/sweetalert2/sweetalert2.min.js,https://example.com/example/js/sweetalert2/promise.min.js,https://example.com/example/assets/WebSpeech-ef1e4f573656f6f33bd00370453ffd6c.js,https://example.com/example/simpleCaptcha/getSolution2}; do echo -n "${i} - " && curl -IsL "${i}" | grep -i -E "Cache-Control|Pragma"; done
處理前自我檢測
for i in {https://example.com/example/assets/application-a53c36b9cbeef95a995660603cf2ef83.js,https://example.com/example/example/newsPaperFilter,https://example.com/example/example/familyFilter,https://example.com/example/example/activityFilter}; do echo -n "${i} - " && curl -IsL "${i}" | grep -i -E "Cache-Control|Pragma"; done
user01@example:~$ for i in {https://example.com/example/assets/application-a53c36b9cbeef95a995660603cf2ef83.js,https://example.com/example/example/newsPaperFilter,https://example.com/example/example/familyFilter,https://example.com/example/example/activityFilter}; do echo -n "${i} - " && curl -IsL "${i}" | grep -i -E "Cache-Control"; done
https://example.com/example/assets/application-a53c36b9cbeef95a995660603cf2ef83.js - Cache-Control: public, max-age=31536000
https://example.com/example/example/newsPaperFilter -
https://example.com/example/example/familyFilter -
https://example.com/example/example/activityFilter -
處理方式
- http header 設定 “Cache-Control:no-store” 及 “Pragma:no-cache”
修補說明
- 設定 conf.d/* “Cache-Control:no-store” 及 “Pragma:no-cache”
[root@example nginx]# grep -E "Cache-Control|Pragma" conf.d/*
conf.d/ssl.conf: add_header Cache-Control no-store;
conf.d/ssl.conf: add_header Pragma no-cache;
弱點名稱: 查詢中接受了 Body 參數
GET 與 POST 回傳資料應 一樣
- 修補方式: 修改程式
- 檢測方式
GET 與 POST 回傳資料應 要不一樣
curl -s -X GET https://example.com/example/simpleCaptcha/playVoice?date=1717646496161 | wc -l
curl -s -X POST -F 'date=1717646496161' https://example.com/example/simpleCaptcha/playVoice | wc -l
弱點名稱: 應用程式中找到不必要的 HTTP 回應標頭
處理前自我檢測
curl -IsL https://example.com/ | grep -i server
user01@example:~$ curl -IsL https://example.com/ | grep -i server
Server: nginx/1.21.4
Server: nginx/1.21.4
處理方式
- nginx 設定 server_tokens off;
修補說明
- 設定 nginx 禁止 niginx 顯示版本號
[root@example nginx]# grep server_tokens conf.d/*
conf.d/default.conf: server_tokens off;
conf.d/ssl.conf: server_tokens off;
[root@example nginx]#
[root@example nginx]# curl -IsL https://example.com/example/amcharts/amcharts.js | grep nginx
Server: nginx
相關資訊
漏洞類別 - Cookie
以下漏洞通常可以透過設定 Cookie 屬性 完成漏洞修補
弱點名稱: 在階段作業 Cookie 中遺漏 HttpOnly 屬性
- 修補方式:
- 設定負載平衡
- 修改程式,Cookie name 移除關鍵字: session
- 檢測方式
結果應該為 0
curl -IsLk https://example.com/ | grep -i -E "session" | grep -v -e "HttpOnly" | wc -l
弱點名稱: SameSite 屬性不安全、不適當或遺漏的 Cookie
-
修補方式: 設定負載平衡
-
檢測方式
最終結果是要空白
curl -IsL https://example.com/ | grep -i -E "JSESSIONID|route|u_labor|sessionExpiry_labor|kick_labor|clientTimeOffset_labor" | grep -v -e "SameSite=Lax" | wc -l
漏洞類別 - 加密演算法
弱點名稱: 加密的階段作業 (SSL) Cookie 中遺漏安全屬性
-
修補方式: 設定負載平衡
-
/etc/nginx/conf.d/*
set_cookie_flag * secure;
- 檢測方式
curl -IsL https://<domain-name>/ | grep -i -E "<cookie name>" | grep -v -e "secure"
常見的漏洞-SSL 加密演算法
以下漏洞通常可以透過設定 系統傳輸加密 完成漏洞修補
設定中的大魔王: SSL 加密演算法
去年最安全
的演算加密方式,今年最危險
的演算加密方式。這個弱點每年都會遇到
- 檢查 SSL 當前網站加密方是安全難以破解的網站 Ciphersuite Info
- 通用安全的配置 - Cipherlist.eu Strong Ciphers for Apache, nginx and Lighttpd
- 依據系統架構配置最合適的SSL - moz://a SSL Configuration Generator
- 沒辦法中的辦法: 研究 SSL 加密演算法
弱點名稱: 低強度密碼組合 - ROBOT 攻擊:伺服器支援有漏洞的密碼組合
-
修補方式: 設定負載平衡
-
設定文件: /etc/nginx/nginx.conf
ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
- check
nmap -script ssl-cert,ssl-enum-ciphers -p 443 203.65.98.200
❯ cat check-list.txt | while read line; do echo -n "${line}:" && curl -s "https://ciphersuite.info/api/cs/${line}/" | jq ".${line}.security" ; done
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:"secure"
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:"weak"
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256:"weak"
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:"secure"
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:"weak"
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384:"weak"
TLS_RSA_WITH_AES_128_GCM_SHA256:"weak"
TLS_RSA_WITH_AES_128_CBC_SHA:"weak"
TLS_RSA_WITH_AES_128_CBC_SHA256:"weak"
TLS_RSA_WITH_AES_256_GCM_SHA384:"weak"
TLS_RSA_WITH_AES_256_CBC_SHA:"weak"
TLS_RSA_WITH_AES_256_CBC_SHA256:"weak"
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA:"weak"
TLS_RSA_WITH_CAMELLIA_256_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256:"weak"
TLS_DHE_RSA_WITH_AES_128_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256:"weak"
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384:"weak"
TLS_DHE_RSA_WITH_AES_256_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256:"weak"
TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA:"weak"
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:"weak"
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:"weak"
TLS_RSA_WITH_AES_128_CBC_SHA:"weak"
TLS_RSA_WITH_AES_256_CBC_SHA:"weak"
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA:"weak"
TLS_RSA_WITH_CAMELLIA_256_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_AES_128_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_AES_256_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA:"weak"
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA:"weak"
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA:"weak"
TLS_RSA_WITH_AES_128_CBC_SHA:"weak"
TLS_RSA_WITH_AES_256_CBC_SHA:"weak"
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA:"weak"
TLS_RSA_WITH_CAMELLIA_256_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_AES_128_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_AES_256_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA:"weak"
TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA:"weak"
處理方式
- 設定 nginx TLS 加密演算法,需要特別注意介接功能,例如: 信用卡網頁完成後要回call 的功能
弱點名稱: 支援較早的 TLS 版本
發現伺服器支援較早版本的 TLS (TLSv1.0 或 TLSv1.1),改用TLSv1.2
- 修補方式: 移除 TLSv1.0 或 TLSv1.1,移除需要特別注意介接功能,例如: 信用卡網頁完成後要回call 的功能
弱點名稱: 偵測到 SHA-1 密碼組合
- 修補方式: 移除 SHA-1 加密方式,移除需要特別注意介接功能,例如: 信用卡網頁完成後要回call 的功能
漏洞類別 - 網頁內文
以下漏洞通常可以透過 網頁內容修改 完成漏洞修補
弱點名稱: SQL Injection
弱點名稱: XSS (Cross-Site Scripting)
Cross Site Scripting (XSS): 所謂XSS泛指惡意攻擊者在Web網頁上插入惡意html代碼,以達到特殊目的(控制網站元素、取走cookies)。
- 修補方式: 設定 修改程式 、建置WAF
- 檢測方式
弱點名稱: 不安全的第三方鏈結 (target="_blank")
- 修補方式: 修改程式
- 檢測方式
最終目標是 0
for i in {https://url1, https://url2 , ... , https://urlN } ; do echo -n "${i} had " && curl -s ${i} | grep -e "target=\"_blank\"" | grep -v -e "noopener" | grep -v -e "noreferrer" | wc -l ; done
處理方式
- 針對「target="_blank"」新增元素「rel=“noopener noreferrer”」
弱點名稱: 檢查是否有 SRI(子資源完整性)支援
- 修補方式: 修改程式,部份頁面可能需要進資料庫修改內容
- 針對有讀取外部js資源 新增 integrity 屬性
- 需要請維護的承辦修改網站內容
- 檢測方式
最終目標是 0
for i in {https://url1, https://url2 , ... , https://urlN } ; do echo -n "${i} had " && curl -s ${i} | grep "<script" | grep "http" | grep -v -E "crossorigin" | wc -l ; done
弱點名稱: 未停用密碼欄位的自動完成 HTML 屬性
- 修補方式: 修改程式
密碼欄位新增屬性: autocomplete=“off”
- 檢測方式
curl -s https://example.com/example/home/register | grep "type=\"password\"" | grep -v "autocomplete=\"off\""
以下為檢測出的結果
user01@example:~/Downloads$ curl -s https://example.com/example/home/register | grep "type=\"password\"" | grep -v "autocomplete=\"off\""
<input class="form-control" name="user.password" id="user.password" type="password" placeholder="密碼(需含英數,長度6碼以上)" required>
<input class="form-control" name="user.repeatPassword" id="user.repeatPassword" type="password" placeholder="確認密碼(需含英數,長度6碼以上)" required
弱點名稱: 有漏洞的元件
相關資訊
漏洞類別 - OpenSSH
OpenSSH CVE
- CVE-2023-48795: SSH Terrapin Prefix Truncation Weakness
- CVE-2025-26465
- CVE-2025-26466
弱點名稱: OpenSSH CVE-2023-48795
- SSH Terrapin Prefix Truncation Weakness (CVE-2023-48795)
修補說明
- 更新 ssh-server
dnf update openssh-server
新增文件內容 /etc/crypto-policies/policies/modules/CVE-2023-48795.pmod
cipher@SSH = -CHACHA20-POLY1305
ssh_etm = 0
執行更新
sudo cat -v /etc/crypto-policies/policies/modules/CVE-2023-48795.pmod
sudo update-crypto-policies --set $(update-crypto-policies --show):CVE-2023-48795
- 處理結果
[root@example ~]# cat -v /etc/crypto-policies/policies/modules/CVE-2023-48795.pmod
cipher@SSH = -CHACHA20-POLY1305
ssh_etm = 0
[root@example ~]# sudo update-crypto-policies --set $(update-crypto-policies --show):CVE-2023-48795
Setting system policy to DEFAULT:CVE-2023-48795
Note: System-wide crypto policies are applied on application start-up.
It is recommended to restart the system for the change of policies
to fully take place.
弱點名稱 OpenSSH < 7.2p2 X11Forwarding xauth 命令插入
修補說明
- 關閉 X11 forwarding
grep X11Forwarding /etc/ssh/sshd_config
處理結果
[root@example ~]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@example ~]# grep X11Forwarding /etc/ssh/sshd_config
X11Forwarding no
# X11Forwarding no