Skip to content

OWASP Standard Classification: Back to Basics: Looking for subtle bugs in beginne...

Cole Cornford

AppSecOWASP Foundation13 minIntermediateOpen on YouTube ↗

Cole Cornford details OWASP Standard Classification: Back to Basics: Looking for subtle bugs in beginne....

Summary

### Overview In this presentation, Cole Cornford steps away from advanced topics such as AI and complex flagship technologies to focus on core programming fundamentals. Emphasizing that mastering basics leads directly to more secure software, Cole illustrates how simple programming structures—such as basic control flow, variable initialization, and naming—often harbor subtle, high-impact security vulnerabilities.

### Key Topics - **Code Clarity and Scrutiny**: Inscrutable or overly convoluted code prevents engineers and security reviewers from properly assessing its security posture. Automated tools can miss issues that are evident when code is clean and human-readable. Complex regular expressions pulled from third-party sources without understanding are common examples of unmaintainable, risky code. - **Iteration and Resource Exhaustion**: Unbounded loops, deep recursion (such as the billion laughs attack in XML parsing), and missing rate limits allow applications to run indefinitely or consume excessive memory, leading directly to denial of service. - **Selection Constructs and Logic Flaws**: Common control flow keywords like `if`, `else`, `switch`, and `try/catch` frequently hide business logic flaws. Seemingly simple linear logic can conceal unexpected paths or fail-open conditions.

### Technical Details - **Fail-Open Logic**: Reviewing an example from Corsair source code, Cole demonstrates how having multiple authentication checks combined with an `else` branch resulted in a fail-open condition that static analysis tools failed to catch due to a lack of context. - **Variable Default Initialization (OMIGOD Vulnerability)**: Examining code associated with the "OMIGOD" vulnerability affecting Azure management interfaces, Cole details how control flow combined with default variable initialization created a bypass. Specifically, an authentication handler checked whether an `auth_failed` variable was set; because the constructor initialized `auth_failed` to `false` by default, missing authorization headers bypassed the check and flowed directly into `process_authorized_message`. - **Guard Clauses and Front-Loading Errors**: To eliminate these structural bugs, Cole advocates front-loading error handling at the beginning of methods. Structuring methods to explicitly validate input, authentication, and authorization requirements upfront prevents dangerous fall-through execution paths.

### Takeaways - Write clear, readable code: readable code is easier to understand, safer to change, and far simpler to scrutinize during security reviews. - Do not overlook basic building blocks: fundamental constructs like variables, boolean evaluations, loops, and conditional statements are primary locations where business logic vulnerabilities hide. - Avoid deliberate or accidental obfuscation, as reviewing convoluted code consumes excessive time and increases the risk of missed flaws.

Related talks