/ CTF / HackTheBox Labs / Entity.md
Entity.md
 1  Category: #pwn 
 2  Rated Difficulty: #VeryEasy 
 3  Personal Difficulty: #Easy 
 4  
 5  The *C* file for the program is included in the challenge
 6  
 7  Here we can see that there is a `union` that takes either a long long unsigned int or 8 char string
 8  
 9  Upon inspecting the code we know we can't write 13371337 that is needed to get the flag in this challenge.
10  
11  Then we realise that there is no restriction on writing strings
12  
13  We know that strings are processed differently from integer as '4' as a string is stored as 0x34 while as 4 as an integer will be stored as 0x4 
14  
15  Knowing this we pass the hex representation of 13371337 for the string. Onced processed it will look like an integer with value of 13371337
16  
17  We then get the flag
18  
19  ---
20  
21  Important thing to note in the challenge is that knowing that union stores variable in the same location and that string and int are processed differently