8. Errors and Exceptions

What could possible go wrong?

–ANONYMOUS

Security problems often begin with an attacker finding a way to violate a programmer’s expectations. In general, programmers give less thought to error conditions and abnormal situations than they do to the expected case, which makes errors and exceptions a natural path for attackers to follow. In this chapter, we consider the security implications of common error and exception handling scenarios. Most of the mistakes discussed in this chapter do not lead directly to exploitable vulnerabilities the way buffer overflow or SQL injection does. Instead, they provide the conditions necessary for a later security failure.

More often than not, the language a program is written in dictates ...

Get Secure Programming with Static Analysis now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.