Are you somehow connecting the two iPhones to each other via a cable? If so, that is not a supported configuration, and I doubt there's any malware out there that could make that jump. It would be pointless to even write such malware, since I've never before heard of anyone connecting iPhones in this manner.
If you are connecting one iPhone to another, that's a quite poor way to charge your iPhone. You'd end up, at the very best, depleting one full iPhone to half charge while only raising the other iPhone to half charge, assuming this even works in the first place. I do not believe it's supported, and it could void your warranty.
If you're not connecting the iPhones to each other, you're going to need to give us more details about your concerns, as I cannot think of any other possibility that hasn't already been answered.