Fake Functions

以下が簡潔な、document.write用のFake関数である。

document.write=(str)=>{ console.log("Override `document.write`"); console.log(str); };
HObfusは、これがFake関数であることを検出するために、document.write.toString() を用いて、関数のコードを取得し、それが native code であるか調査を行う。 ハッカーは、この調査を迂回するために、document.write.toString に 以下のようなFake関数を指定する。
document.write.toString=()=>{ console.log("Override `document.write.toString`"); return `function write() { [native code] }`; };
HObfusは、これがFake関数であることを検出するために、document.write.toString.toString() を用いて、関数のコードを取得してそれが native code であるか調査を行う。 ハッカーは、この調査を迂回するために、document.write.toString.toString に 以下のようなFake関数を指定する。
document.write.toString.toString=()=>{ console.log("Override `document.write.toString.toString`"); return `function toString() { [native code] }`; };