security testing
play

Security Testing Checking for what shouldnt happen Azqa Nadeem PhD - PowerPoint PPT Presentation

Security Testing Checking for what shouldnt happen Azqa Nadeem PhD Student @ Cyber Security Group The Cyber Security lecture series 1 Agenda for today Part I Latest security news Security vulnerabilities in Java


  1. Black vs. White box Testing • Black box – Unknown internal structure – Study Input → Output correlation – Generic technique – Requires end-to-end system – May miss components • White box – Known internal structure – Analysis of internal structure – GUI not necessarily required – Thorough testing and debugging – Time consuming 57

  2. Classes of Security Testing • Manual vs. Automated Testing • Static vs. Dynamic Testing • Black vs. White box Testing Manual Automated Static Dynamic Blackbox Whitebox Reverse Risk Code Engineering Analysis checking Dynamic Penetration Tainting Fuzzing validation testing 58

  3. Static Application Security Testing • Reverse engineering (System level) – Disassemble application to extract internal structure – Black box to White box – Useful for gaining information 59

  4. Static Application Security Testing • Reverse engineering (System level) • Risk-based testing (Business level) – Model worst case scenarios – Threat modelling for test case generation 60

  5. Static Application Security Testing • Reverse engineering (System level) • Risk-based testing (Business level) • Static code checker (Unit level) – Checks for rule violations via code structure – Parsers, Control Flow graphs, Data flow analysis – Identifies bad coding practices, potential security issues, etc. 61

  6. Classes of Security Testing • Manual vs. Automated Testing • Static vs. Dynamic Testing • Black vs. White box Testing Manual Automated Static Dynamic Blackbox Whitebox Reverse Risk Code Engineering Analysis checking Dynamic Penetration Tainting Fuzzing validation testing 62

  7. Dynamic Application Security Testing • Taint analysis – Tracking variable values controlled by user • Fuzzing – Bombard with garbage data to cause crashes • Dynamic validation – Functional testing based on requirements • Penetration testing – End-to-end black box testing Topic for next lecture 63

  8. Summary Part I • Java vulnerabilities have large attack surfaces • Crucial to adapt Secure SDLC • Threat modelling can drive test case generation • Static analysis checks code without executing it • Dynamic analysis executes code and observes behavior 64

  9. Quiz Time! Which type of testing aims to convert a black box system to white box? Reverse Engineering 65

  10. Quiz Time! Which vulnerability allows a remote attacker to change which instruction will be executed next? Remote Code Execution 66

  11. Quiz Time! Why is Java safe from buffer overflows? It’s not! 67

  12. Agenda for today • Part I – Latest security news – Security vulnerabilities in Java – Types of Security testing • SAST vs. DAST • Part II – SAST under the hood • Pattern Matching • Control Flow Analysis • Data Flow Analysis – SAST Tools performance 68

  13. Why doesn’t the perfect static analysis tool exist? 69

  14. Static Analysis • Soundness • Completeness 70

  15. Static Analysis • Soundness – No missed vulnerability (0 FNs) – No alarm → no vulnerability exists • Completeness 71

  16. Static Analysis • Soundness – No missed vulnerability (0 FNs) – No alarm → no vulnerability exists • Completeness – No false alarms (0 FPs) – Raises an alarm → vulnerability found 72

  17. Static Analysis • Soundness – No missed vulnerability (0 FNs) – No alarm → no vulnerability exists • Completeness – No false alarms (0 FPs) – Raises an alarm → vulnerability found • Ideally: ↑ Soundness + ↑ Completeness • Reality: Compromise on FPs or FNs 73

  18. Usable SAST Tools • ↓ FPs vs. ↓ FNs • ↑ Interpretability • ↑ Scalability 74

  19. SAST under the hood Pattern matching Regular expressions 75

  20. SAST under the hood Pattern matching Syntax analysis Abstract Syntax Tree Regular Control flow Data flow expressions graph analysis 76

  21. Pattern Matching • Look for predefined patterns in code – Regular Expressions – Finite State Automata 77

  22. Pattern Matching • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g !b 78

  23. Pattern Matching • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bug !b 79

  24. Pattern Matching • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bug !b 80

  25. Pattern Matching • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bug !b 81

  26. Pattern Matching • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bug !b 82

  27. Pattern Matching • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bug !b 83

  28. Pattern Matching • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u Match! !g bug !b 84

  29. Pattern Matching via Regex • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bag !b 85

  30. Pattern Matching via Regex • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bag !b 86

  31. Pattern Matching via Regex • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bag !b 87

  32. Pattern Matching via Regex • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bag !b 88

  33. Pattern Matching via Regex • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “bug” g u b !u !g bag !b No Match! 89

  34. Pattern Matching via Regex • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “.*bug” g u b !u !g !b 90

  35. Pattern Matching via Regex • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “.*bug” g u b !b !u !g 91

  36. Pattern Matching via Regex • Look for predefined patterns in code – Regular Expressions – Finite State Automata • Find all instances of “.*bug.*” g u b anything !b !u !g 92

  37. Pattern Matching via Regex • Finds low hanging fruit – Misconfigurations (port 22 open for everyone) – Bad imports (System.io.*) – Call to dangerous functions (strcpy, memcpy) 93

  38. Pattern Matching via Regex • Finds low hanging fruit – Misconfigurations (port 22 open for everyone) – Bad imports (System.io.*) – Call to dangerous functions (strcpy, memcpy) • Shortcomings – Lots of FPs – Limited support 94

  39. Pattern Matching via Regex • Finds low hanging fruit – Misconfigurations (port 22 open for everyone) – Bad imports (System.io.*) – Call to dangerous functions (strcpy, memcpy) • Shortcomings – Lots of FPs – Limited support 95

  40. Pattern Matching via Regex • Finds low hanging fruit – Misconfigurations (port 22 open for everyone) – Bad imports (System.io.*) – Call to dangerous functions (strcpy, memcpy) • Shortcomings – Lots of FPs – Limited support 96

  41. Syntactic Analysis • Performed via Parsers Parse Tree Stream Tokens Lexer Parser • Tokens → Hierarchal data structures – Parse Tree – Concrete representation – Abstract Syntax Tree – Abstract representation 97

  42. Abstract Syntax Tree (AST) 98

  43. Abstract Syntax Tree (AST) 99

  44. Abstract Syntax Tree (AST) SUB 5 1 100

Recommend


More recommend