Yes indeed, to err is human. Malfunctions are glitches, bugs, breakdowns, natural disasters, and the like. They are Nature's way of letting us know we can't control everything. The three main areas of security activity are prevention, detection, and recovery. Activity must be balanced among all three areas to be effective.
Prevention is the main defense.
Alas, there is no panacea, no wall high enough, no moat deep enough. Your defenses may be finagled, end-run, or overcome by brute force. You will study and apply defenses step by step, based on your resources and analysis of risk, for all eternity. Detection is the essential partner of defense. No defense is perfect, even for a limited purpose.