endianness
Description: Know of little and big endian? Source (nc titan.picoctf.net 54133) Author: Nana Ama Atombo-Sackey Tags: Easy, General Skills, picoCTF 2024, browser_webshell_solvable Hints: 1. You might want to check the ASCII table to first find the hexadecimal representation of characters before finding the endianness. 2. Read more about how endianness here Files: flag.c
Theory
According to the description, to get the flag we have to find the little endian and big endian of a string or word that will be given to us by the NetCat after inputting it correctly (from the Source file, aka the code of the nc). So a quick explanation of this endian thing, it's basically taking a string of text or whatever, then converting it to ASCII with the table—or maybe you know the values from memory idk—, finally after all that conversion, you delete the spaces between the ASCII values to form the Big Endian. Then the Little Endian, is just where we convert the string into ASCII values, but now put the values in reverse order, for example, if you have 7B 18, big endian would be 7B18 and little endian would be 187B. So with that, I think we're good to start with the level.
Solution
Firstly, enter with the NetCat they give us in the description:
shukularuni-picoctf@webshell:~$ nc titan.picoctf.net 54133 Welcome to the Endian CTF! You need to find both the little endian and big endian representations of a word. If you get both correct, you will receive the flag. Word: sbofj Enter the Little Endian representation: 6A666F6273 Correct Little Endian representation! Enter the Big Endian representation: 73626F666A Correct Big Endian representation! Congratulations! You found both endian representations correctly! Your Flag is: picoCTF{3ndi4n_sw4p_su33ess_cfe38ef0} ^C
You can see that I got the string "sbofj", so now we can know its ASCII values are "73 62 6F 66 6A", then we join them to get "73626F666A" for the Big Endian. For the Little Endian, we'll reverse the order of the ASCII values, so basically go from "73 62 6F 66 6A" to "6A 66 6F 62 73", which if we join gets us "6A666F6273".
s -> 73, b -> 62, o -> 6F, f -> 66, j -> 6A
And there we go! That's the flag.
https://play.picoctf.org/practice/challenge/414