COMP3006 Secure Software Development Week5
COMP3006 Secure Software Development Week5
Spring 2024-2025
1 / 43
Outline
6 Resource Management
7 Summary
2 / 43
What is Secure Data Processing?
3 / 43
Why It Matters
4 / 43
Goals of Secure Data Processing
5 / 43
Defining Untrusted Data
6 / 43
Principle 1: Assume Malicious Intent
7 / 43
Principle 2: Sanitize Before Use
8 / 43
Principle 3: Limit Scope
9 / 43
Case Study: Untrusted Data Mishandling
10 / 43
What is Memory Safety?
11 / 43
Buffer Overflows Explained
12 / 43
Buffer Overflow Example 1
13 / 43
Buffer Overflow Example 2
14 / 43
Mitigation: Safe Functions
15 / 43
Mitigation: Bounds Checking
16 / 43
Modern Tools
17 / 43
What is Integer Overflow?
18 / 43
What is Integer Underflow?
19 / 43
Integer Overflow Example
Expected: 4,000,000,000.
Actual: Wraps around due to 32-bit limit.
20 / 43
Security Implications
Buffer Allocation:
int len = n + 100; // Overflow possible
char * buf = malloc ( len ) ;
21 / 43
Mitigation: Bounds Checking
22 / 43
Mitigation: Larger Types
23 / 43
Library Support
24 / 43
Why Secure Error Handling?
25 / 43
Common Mistake: Info Leakage
try {
processFile ( filename ) ;
} catch ( Exception e ) {
System . out . println ( e . getStackTrace () ) ; // Leaks
details
}
26 / 43
Best Practice: Generic Messages
try {
processFile ( filename ) ;
} catch ( Exception e ) {
logError ( e ) ; // Secure logging
System . out . println (" An error occurred . Contact
support .") ;
}
27 / 43
Best Practice: Handle All Cases
28 / 43
Secure Logging
29 / 43
Graceful Degradation
30 / 43
What Are Resources?
31 / 43
Risk: Resource Leaks
32 / 43
Risk: Denial-of-Service
33 / 43
Best Practice: Always Free Resources
34 / 43
RAII in C++
35 / 43
Timeouts and Quotas
36 / 43
Monitoring Resource Usage
37 / 43
Key Takeaways: Processing Untrusted Data
38 / 43
Key Takeaways: Memory Safety
39 / 43
Key Takeaways: Integer Issues
40 / 43
Key Takeaways: Error Handling
41 / 43
Key Takeaways: Resource Management
42 / 43
Next Steps
43 / 43