I found that the Shelly has an OTA upgrade script for the original firmware:
I downloaded the firmware: http://repo.shelly.cloud/firmware/test/SHSW-21_build.zip
and it contains a binary as well as a manifest file. They seem to use some sort of a checksum/hash to check if the firmware is original.
Can we not fake this somehow? The shelly 2.5 has extremely small pinheaders that make it really hard to flash esphome.