Skip to main content

endianness picoCTF 2024 Solution

A general skills challenge testing your knowledge of how bytes are ordered in computer memory.

Published: April 3, 2024Updated: August 25, 2026

Description

Know of little and big endian?

Download the source code to understand the challenge.

Connect to the remote service and have a hex converter ready (CyberChef, python, etc.).

bash
nc titan.picoctf.net <PORT_FROM_INSTANCE>

Solution

Want to try it yourself first?

The guided walkthrough reveals hints one step at a time.

Walk me through it
This is a warm-up endianness challenge. Once you understand basic little-endian conversion here, advance to endianness-v2 for a more complex forensics application involving image file recovery.
  1. Step 1Capture the word and convert to hex
    Observation
    The server sends a plaintext word and wants raw hex digits back. Map each character to its ASCII byte value first; the endianness question comes after that.
    The server prints a word (e.g., ffoxf). Convert each character to its ASCII hex value to get 66 66 6f 78 66.
    Learn more

    Each character maps to its ASCII hex value. ASCII is a 7-bit encoding where printable characters start at 0x20 (space) and run through 0x7E (~). You can look them up with man ascii or use Python: hex(ord('f')) returns 0x66.

    Worked example for ffoxf: ord('f') = 0x66, ord('o') = 0x6f, ord('x') = 0x78. So the byte array is [0x66, 0x66, 0x6f, 0x78, 0x66].

    The server is essentially asking: if you stored this 5-character string in memory as a series of bytes, what bytes would you see, and in what order? To answer, you first need the ASCII byte values.

  2. Step 2Submit little-endian representation
    Observation
    Little-endian comes first. x86 puts the least significant byte at the lowest address, so reverse the byte order of the ASCII hex before submitting.
    Reverse the byte order: 66 66 6f 78 66 becomes 66 78 6f 66 66. Submit without spaces or 0x prefix.
    bash
    66786f6666
    What didn't work first

    Tried: Submit the bytes in their original left-to-right order (66666f7866) for the little-endian answer

    That is big-endian order, not little-endian. Little-endian reverses the byte sequence so the last byte comes first. Submitting the natural order here will be accepted only for the big-endian prompt that comes next, not the little-endian one.

    Tried: Include spaces or 0x prefixes in the submission (e.g., 66 78 6f 66 66 or 0x66786f6666)

    The server does an exact string match against the raw hex digits. Spaces and 0x prefixes cause the match to fail and the server reports a wrong answer. Strip all formatting and submit only the lowercase hex digits in one continuous string.

    Learn more

    Little endian means the least significant byte is stored first (at the lowest memory address). x86 and ARM (in most modes) use little-endian. So 0x12345678 is stored as 78 56 34 12. Reversing the byte array of the ASCII characters gives the little-endian representation.

  3. Step 3Submit big-endian representation
    Observation
    Big-endian comes next, and it stores the most significant byte first. That is the plain left-to-right ASCII order already computed in step one.
    The big-endian representation is the bytes in their original left-to-right order: 66 66 6f 78 66. Submit without spaces or 0x prefix.
    bash
    66666f7866
    What didn't work first

    Tried: Reuse the reversed (little-endian) byte sequence (66786f6666) for the big-endian prompt as well

    The server prompts for big-endian separately after accepting the little-endian answer. Big-endian is the original left-to-right byte order, not the reversed one. Submitting the reversed bytes again produces a wrong-answer response on the second prompt.

    Tried: Convert the word using UTF-16 or Unicode code points instead of ASCII byte values

    UTF-16 encodes most ASCII characters as two bytes (e.g., 'f' becomes 0x0066 in UTF-16BE), which doubles the byte count and changes the hex string entirely. The server expects single-byte ASCII values, so a UTF-16 submission will never match the expected hex string.

    Learn more

    Big endian means the most significant byte comes first, which matches the natural left-to-right reading order of a number. Network protocols (TCP/IP) use big endian, which is why it is also called network byte order. For the ASCII bytes of a word, big endian is simply the characters in their original order.

    The server asks for both representations in sequence. After getting both correct it prints the flag. Use an ASCII table or Python to convert each character, then submit the bytes reversed (little-endian) and in order (big-endian).

    See the CTF encodings guide for ASCII-to-hex flows and the hex dumps guide for spotting byte order in raw output.

Interactive tools
  • Number Base ConverterConvert numbers between binary, octal, decimal, and hexadecimal instantly. Enter any value and see all four bases update in real time.

Flag

Reveal flag

picoCTF{3ndi4n_sw4p_su33ess_d58...}

After a handful of conversions the service prints the flag.

Key takeaway

Endianness is a hardware convention about which byte of a multi-byte integer sits at the lowest address. Little-endian machines such as x86 and ARM put the least significant byte first; big-endian, used by network protocols and some RISC designs, puts the most significant first. Inside one system the distinction never shows, but it becomes a correctness problem the moment binary data crosses architectures: protocol parsing, portable file formats, embedded integration. htonl and ntohl exist for exactly this, and every binary format spec has to state its byte order.

Related reading

Tools used in this challenge

Where to go next