---
description: >-
  I made a simple webpage that checks whether the flag is correct... Wait, where
  are the flag-checking functions?
---

# Void (rev)

As the name suggests, this challenge requires us to reverse engineer some front-end javascript code. However, upon viewing the code via inspector, the script appears to have many blank lines and ends with a weird function.

<figure><img src="https://243380073-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBIa0PcXGYuP6chd3J1Ry%2Fuploads%2FQFH0GnPtF8pCYBj9i9gc%2Fimage.png?alt=media&#x26;token=cb965396-f244-4e9f-9159-738437f1ec62" alt="" width="375"><figcaption></figcaption></figure>

As you can see, there are approximately 800 lines of seemingly invisible javascript. On copy-pasting into Visual Studio Code, however, we are warned that there are invisible unicode characters.&#x20;

Following the URL linked in the code, we see aemkei's post on `invisible.js`, which is a method of encoding used to make javascript scripts invisible.&#x20;

<figure><img src="https://243380073-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBIa0PcXGYuP6chd3J1Ry%2Fuploads%2FVoaQ7pieGkKBxCoorv4i%2Fimage.png?alt=media&#x26;token=ecaf7fe1-e455-4512-ac37-d40ace848da6" alt=""><figcaption></figcaption></figure>

On closer inspection of the script, it first accumulates all the human-readable code inside a variable `f`, then when the code is ready it does `eval(f)`.&#x20;

To reverse engineer and obtain the human-readable code, we can simply add `console.log` into the javascript function to make it print the code before running it. Below is my modified `\u3164` function:

```javascript
function \u3164(){
    return f="",p=[],new Proxy({},{
        has:(t,n)=>(p.push(n.length-1),2==p.length&&(p[0]||p[1]||
            (console.log(f) && eval(f)),
            f+=String.fromCharCode(p[0]<<4|p[1]),p=[]),!0)})}
```

This prints the javascript code just before it is executed (I ran the code on `programiz.com`)

<figure><img src="https://243380073-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBIa0PcXGYuP6chd3J1Ry%2Fuploads%2FEdeGzNIM3Y1jLuEKVEDL%2Fimage.png?alt=media&#x26;token=9554121f-e4d4-4ab0-830c-2b6e3896b7f3" alt=""><figcaption></figcaption></figure>

Which gives us the flag!
