This question already has an answer here:
Say you buy a used hard drive, or a computer (wondering about both cases, something that is just a drive for storage, and something that is an actual running chip). I am not interested in whether or not it's a good idea to buy used stuff, I am purely wondering as an intellectual exercise to better understand security.
I am a programmer with a bit of experience but I can't imagine how you can guarantee that there is nothing installed on the computer or hard drive. If you buy something with an operating system already installed on it, then I imagine that you could have something hiding behind the operating system, so that is potentially insecure. If you instead "start from scratch" with a baremetal machine somehow (by "deleting everything from memory and data bus or whatever"), that would require you using BIOS or something to install, then it seems even then (assuming you knew everything about the BIOS / initialization software), that there could still be something lingering on the drive or computer that, after you get something fresh installed on it, it will leap back into action. I don't know how this would work, which is why I'm asking the question. It's as if the electrons or magnets would spring back into action, even after memory (and anything potentially else) was "cleared". I wonder how to check that stuff.
The question is, if you start from "bare metal" drives or chips or computers, with nothing installed on it, how you actually guarantee that, in fact, nothing is "installed" after you think you've uninstalled everything. I wonder what you can/should check, like perhaps you need to check the memory manually with some debugger or something, or check the databus somehow. I have no idea how this would work.