Skip to content

Instantly share code, notes, and snippets.

@mendes5
Last active September 10, 2025 21:56
Show Gist options
  • Select an option

  • Save mendes5/557d100d172825444b29d28cf5a8539c to your computer and use it in GitHub Desktop.

Select an option

Save mendes5/557d100d172825444b29d28cf5a8539c to your computer and use it in GitHub Desktop.
Zero width space decoder. beware!

​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌‌​​‌‌‌​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​​​‌‌​​‌​‌​​‌​‌‌‌​​‌‌​‌‌​​​‌‌​‌‌‌‌​‌‌​​‌‌‌​​‌​‌​​​​‌‌​‌‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌​​​​‌​‌‌​‌‌​​​‌​‌​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​‌‌‌​​‌​​‌‌​​​​‌​‌‌​​‌‌‌​‌‌​​‌​‌​​‌​‌​​‌

​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌‌​​‌‌‌​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​​​‌‌​​‌​‌​​‌​‌‌‌​​‌‌​‌‌​​​‌‌​‌‌‌‌​‌‌​​‌‌‌​​‌​‌​​​​‌‌​‌‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌​​​​‌​‌‌​‌‌​​​‌​‌​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​‌‌‌​​‌​​‌‌​​​​‌​‌‌​​‌‌‌​‌‌​​‌​‌​​‌​‌​​‌
const chunk = (arr, len) => {
var chunks = [],i = 0,n = arr.length;
while (i < n) {
chunks.push(arr.slice(i, i += len));
}
return chunks;
}
const encode = x => [...x].map(x => x.charCodeAt(0)).map((x,i) => { if (x >= 255) { throw new Error('Found non ascii character at position: ' + i) } return [...x.toString(2).padStart(8, 0)].map(x => x === '0' ? String.fromCharCode(8203) : String.fromCharCode(8204) ).join('') }).join('');
const decode = x => chunk(x.split(''), 8).map(x => parseInt(x.map(x => x === String.fromCharCode(8203) ? 0 : 1 ).join(''), 2) ).map(x => String.fromCharCode(x)).join('');
var data = encode('console.log(localStorage)')
console.log(data)
eval(decode(data))
var data = '​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌‌​​‌‌‌​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​​​‌‌​​‌​‌​​‌​‌‌‌​​‌‌​‌‌​​​‌‌​‌‌‌‌​‌‌​​‌‌‌​​‌​‌​​​​‌‌​‌‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌​​​​‌​‌‌​‌‌​​​‌​‌​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​‌‌‌​​‌​​‌‌​​​​‌​‌‌​​‌‌‌​‌‌​​‌​‌​​‌​‌​​‌';
eval(decode(data));
0.0.constructor.constructor(decode(data))()
// Soooo you need to be able to control two property access, and the argument passed to a function, with user input.
// Or you hide and obfuscate that on a large codebase with tons of layers of indirection, and done!
// But you also need the encoder/decoder implementation, so its kinda pointless
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment