This is the general premise behind Ken Thompson’s “Reflections on Trusting Trust” and I highly recommend you read it if this is something that interests you.