Hacked and left with messed up internal file system
Burn the hardware. If it's dug itself in deeply enough to survive a factory reset and installing a new OS from scratch, then there's no way you can trust this hardware again.