cybersecurity · intermediate · ~15 min · safe pentest lab

Identify firmware container

Branch on multiple magic numbers.

Challenge

Implement const char *firmware_kind(const unsigned char *b) returning "gzip" for 1F 8B, "uimage" for the U-Boot magic 27 05 19 56 (big-endian), else "unknown".

Starter code

const char *firmware_kind(const unsigned char *b) {
    /* TODO */
    return "unknown";
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.