A smart grid is verging on a promising technology for reforming global electrical grids. Currently, attackers compromise security and privacy by maliciously modifying the memory of smart grid devices. To thwart such attacks, software-based attestation protocols ensure the absence of malicious changes. A verifier and a target device locally generate their own checksums by memory traversal, and the verifier attests the target device by comparing the checksums. For smart grids, however, two challenges are arise in practically deploying the attestation protocol: verification overhead for large-scale networks and evasion of attestation by memory replication. To address these challenges, we propose a novel software-based attestation technique, termed SMATT (Smart Meter ATTestation), to address the aforementioned two challenges by leveraging multiple target selection and copy-proof memory. A verifier randomly selects multiple smart meters, and receives checksums. The verifier only compares the checksums instead of performing memory traversal, thereby remarkably reducing the computational overhead. To prevent memory replication, we design a customized copy-proof memory mechanism. The smart meter outputs garbage values when copy-proof memory sections are being accessed, and thus, attackers cannot replicate the memory. Furthermore, we define an SI epidemic model considering two attestation parameters, the number of infectious smart meters and the number of selected smart meters by a verifier, to enhance the malware detection accuracy of SMATT. In our experimental environments, SMATT takes only 20 s for a verifier to attest millions of smart meters. In addition, SMATT detects malware with over 90 % probability, when the malware tampers with 5 % of the memory.