If masturbation was wrong, it wouldn't be so conveniently located.
From a biblical perspective, keep in mind that the story of Onan is usually misinterpreted, it has nothing to do with masturbation. Onan's sin was to fail to live up to his obligation to impregnate his sister-in-law.