Tutorial: analyzing a file

← All information

Tutorial: analyzing a challenge file

Some challenges provide an archive, image, text file or capture. Before looking for an answer, identify what you have received.

Download and keep a copy

Download files from the challenge details. Keep an original copy and work on another copy if you need to transform the data.

A file may remain inaccessible until the challenge is available or its prerequisites have been solved.

Identify the actual file type

A filename extension is a clue, not a guarantee.

On Linux or macOS, if the tool is installed:

file 'challenge.bin'

To inspect the beginning of the file in hexadecimal:

xxd -l 128 'challenge.bin'

These commands read the file; they do not execute it.

Look for readable text

strings -n 6 'challenge.bin'

strings extracts sequences of printable characters. A result may be a clue, ordinary data or a coincidence.

The absence of readable text does not mean a file is empty or unusable. Its data may be compressed, encoded or binary.

Distinguish encoding from encryption

Encoding changes how data is represented. Its purpose is not to keep the data secret.

Encryption protects data using a key. An unusual sequence of characters alone does not tell you which situation applies.

Two local examples using Python 3:

import base64

print(base64.b64decode("Q0RO").decode("utf-8"))
print(bytes.fromhex("43444e").decode("utf-8"))

Both print CDN. These are not flags.

Before decoding, form a hypothesis about the format. Keep the original value and record each transformation: random chains of decoding operations can produce misleading results.

Explore an archive without executing its contents

Start by listing its files in your archive tool. If you extract it, use a dedicated working directory and an up-to-date tool.

  • Do not run a program or script just because it is supplied.
  • Do not enable document macros.
  • Do not run commands with administrator privileges without justification.
  • If execution is genuinely necessary, follow the admins' instructions for the testing environment.

Protect challenge data

Do not upload files to an external analysis tool without authorization. They may contain information restricted to the event.

If a download fails, an archive appears incomplete or a file does not match the instructions, contact the admins.