The Foundations of Vulnerability Theory