A deep dive into why relying on file extensions is a security flaw, and how I built a custom magic number identifier from scratch.