原文地址:https://alphahinex.github.io/2020/11/01/this-is-unsafe/
description: "進來是個壞主意,但我還是要進去"
date: 2020.11.01 10:26
categories:
- Chrome
tags: [Chrome]
keywords: Chrome, thisisunsafe, badidea, danger, NET::ERR_CERT_INVALID, Chromium, HTTPS

使用 Chrome 訪問某些網(wǎng)站時可能會遇到上面的情況。
點擊 高級 按鈕,有些場景下會有繼續(xù)訪問該網(wǎng)站的鏈接,點擊后即可繼續(xù)訪問;但有些時候會出現(xiàn)如下界面,無法繼續(xù)訪問:

安全提示
除非你知道自己要訪問的網(wǎng)站里面都包含什么,也清楚進去之后會產(chǎn)生什么后果,否則請立刻關(guān)閉此頁面。
除非你知道自己要訪問的網(wǎng)站里面都包含什么,也清楚進去之后會產(chǎn)生什么后果,否則請立刻關(guān)閉此頁面。
除非你知道自己要訪問的網(wǎng)站里面都包含什么,也清楚進去之后會產(chǎn)生什么后果,否則請立刻關(guān)閉此頁面。
如何繞過
當出現(xiàn)如上圖所示情況時,可在此頁面中(點擊頁面空白處),錄入 thisisunsafe,過程中不會有任何反饋,輸入完畢,頁面即可跳過 Chrome 的警告頁,訪問到網(wǎng)站頁面。
怎么不好用
因為這是一個危險的行為,隨時都有可能被廢棄掉。
此行為包含在當前 Chromium master 分支的 interstitial_large.js 文件中:
/**
* This allows errors to be skippped by typing a secret phrase into the page.
* @param {string} e The key that was just pressed.
*/
function handleKeypress(e) {
// HTTPS errors are serious and should not be ignored. For testing purposes,
// other approaches are both safer and have fewer side-effects.
// See https://goo.gl/ZcZixP for more details.
const BYPASS_SEQUENCE = window.atob('dGhpc2lzdW5zYWZl');
if (BYPASS_SEQUENCE.charCodeAt(keyPressState) === e.keyCode) {
keyPressState++;
if (keyPressState === BYPASS_SEQUENCE.length) {
sendCommand(SecurityInterstitialCommandId.CMD_PROCEED);
keyPressState = 0;
}
} else {
keyPressState = 0;
}
}
BYPASS_SEQUENCE 即注釋中提到的 secret phrase,從 console 中直接執(zhí)行 window.atob('dGhpc2lzdW5zYWZl') 即可看到 Base64 解碼后的明文:
> window.atob('dGhpc2lzdW5zYWZl')
< "thisisunsafe"
從 Chromium 的提交記錄中,我們也可以看到開發(fā)人員對此方式被濫用而感到的擔憂:
2014 年這個 BYPASS_SEQUENCE 第一次被 提交 時:
var BYPASS_SEQUENCE = 'danger';
2015 年專門針對此關(guān)鍵字進行了一次修改 Change the interstitial bypass keyword:
- var BYPASS_SEQUENCE = 'danger';
+ var BYPASS_SEQUENCE = 'badidea';
2018 年 1 月 3 日 Change the interstitial bypass keyword:
- var BYPASS_SEQUENCE = 'badidea';
+ var BYPASS_SEQUENCE = 'thisisnotsafe';
并在提交說明中描述了這么做的意義:
The security interstitial bypass keyword hasn't changed in two years and
awareness of the bypass has been increased in blogs and social media.
Rotate the keyword to help prevent misuse.
在 8 天之后再次 調(diào)整 此部分代碼,將這個 keyword 進行了 Base64 編碼以增加干擾:
- var BYPASS_SEQUENCE = 'thisisnotsafe';
+ // HTTPS errors are serious and should not be ignored. For testing purposes,
+ // other approaches are both safer and have fewer side-effects.
+ // See https://goo.gl/ZcZixP for more details.
+ var BYPASS_SEQUENCE = window.atob('dGhpc2lzdW5zYWZl');
隨著時間的流逝,再次修改這個關(guān)鍵字也是很有可能的,所以當你看到這段文字時,上面的方法很有可能已經(jīng)失效了。
如果你有不得已的苦衷,一定要繞過這個安全提示,可以嘗試在安全提示頁面,打開 console 直接輸入:
> sendCommand(SecurityInterstitialCommandId.CMD_PROCEED)
如何恢復(fù)
通過上述方式繞過安全提示之后,以后再次訪問此網(wǎng)站時即可直接訪問了。如果想恢復(fù)安全提示界面,可點擊地址欄前面的 不安全 圖標,并點擊 重新啟用警告功能,如下圖:
