js-confuser icon indicating copy to clipboard operation
js-confuser copied to clipboard

Better way of counter measures

Open doctor8296 opened this issue 1 year ago • 4 comments

In your current implementation, you're using an infinite loop, such as while (true) or for(;;)0, to halt script execution. While this approach works, it quickly reveals the source of the blockage when using standard debugging tools or breakpoints and for an experienced developer it will be pretty easy to prevent or cancel this.

Screenshot 2024-10-10 at 19 07 12

However, I've discovered a more advanced and less detectable method by leveraging an immediately invoked asynchronous function, like this:

(async function f() { f(), f() });
Screenshot 2024-10-10 at 19 08 00 (just stucks)

What's remarkable is that, when using this method, it becomes extremely difficult to trace where the execution is getting stuck, as debugging tools—at least in Chromium and Firefox—fail to provide any clear indication. Additionally, by embedding a redirect inside this function, such as: window.location.href = "https://example.com/script-is-blocked"; the behavior becomes even harder to track or bypass.

It's important to note that the function must be asynchronous for this technique to work effectively.

doctor8296 avatar Oct 10 '24 16:10 doctor8296