If you are concerned about a 2nd-hand phone being compromised, the best way to assure it's safe would be to reflash the stock firmware. If the seller has ever rooted or modified the phone, or you suspect malware, it may not possible to remove it, even if a scanner detects it.