NoiSec: Harnessing Noise for Security against Adversarial and Backdoor Attacks