Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Man in the Middle? - No, thank you!

2,849 views

Published on

Published in: Technology, Business
  • Be the first to comment

Man in the Middle? - No, thank you!

  1. 1. No,$thank$you! MAN$IN$THE$MIDDLE$? Daniel$Schneller$–$CenterDevice$GmbH
  2. 2. SSL$–$and$you’re$done™
  3. 3. SSL$–$and$you’re$done™
  4. 4. SSL$–$and$you’re$done™ …are$you?
  5. 5. Mac$App$Store
  6. 6. Mac$App$Store
  7. 7. Mac$App$Store
  8. 8. Outbank
  9. 9. What$happened$to$SSL?
  10. 10. SSL$–$Chain$of$Trust
  11. 11. SSL$–$Chain$of$Trust Root$CA$Cer)ficate
  12. 12. SSL$–$Chain$of$Trust Root$CA$Cer)ficate $Intermediate$CA$Cer)ficate(s)issues
  13. 13. SSL$–$Chain$of$Trust Root$CA$Cer)ficate $Intermediate$CA$Cer)ficate(s) Leaf$Cer)ficate issues issues
  14. 14. SSL$–$Chain$of$Trust
  15. 15. SSL$–$Chain$of$Trust
  16. 16. SSL$–$Chain$of$Trust
  17. 17. SSL$–$Chain$of$Trust
  18. 18. SSL$–$Chain$of$Trust
  19. 19. SSL$–$Chain$of$Trust
  20. 20. Just$how$many$Root$CAs$ are$there?
  21. 21. System$Roots
  22. 22. System$Roots
  23. 23. System$Roots Windows$8:$~350 Mozilla:$~160 iOS$6:$~220
  24. 24. Man$In$The$Middle?
  25. 25. Man$In$The$Middle [Corporate]$Proxy Client
  26. 26. Man$In$The$Middle [Corporate]$Proxy Client
  27. 27. Man$In$The$Middle [Corporate]$Proxy Client
  28. 28. Man$In$The$Middle Website [Corporate]$Proxy Client
  29. 29. Man$In$The$Middle Website [Corporate]$Proxy Client
  30. 30. Man$In$The$Middle Website [Corporate]$Proxy Client
  31. 31. Man$In$The$Middle Website [Corporate]$Proxy Client
  32. 32. Man$In$The$Middle
  33. 33. Man$In$The$Middle
  34. 34. Man$In$The$Middle
  35. 35. Man$In$The$Middle
  36. 36. Man$In$The$Middle
  37. 37. Man$In$The$Middle
  38. 38. Consequences •Monitoring •ManipulaZon •Sent$and$received$data$affected •ChainOfTrust$formally$verified
  39. 39. Good$and$evil •Debugging •Reverse$Engineering •Security$Audits •Learning$and$Understanding
  40. 40. ReST$Debugging
  41. 41. Good$and$evil •Phishing •IdenZty$The` •Industrial$Espionage •…
  42. 42. Mac$App$Store
  43. 43. Mac$App$Store
  44. 44. Mac$App$Store
  45. 45. iTunes
  46. 46. iTunes
  47. 47. iTunes
  48. 48. Demo$1 Video$1 Video$2
  49. 49. Countermeasures
  50. 50. Reference$CerZficates
  51. 51. Reference$CerZficates •Client$bundles$server$cerZficate$as$a$ reference •Compare$reference$and$cerZficate$sent$by$ the$server$ •Connect$only$when$there’s$a$perfect$match
  52. 52. Reference$CerZficates $Client$App$Server
  53. 53. Reference$CerZficates $Client$App$Server ==
  54. 54. Reference$CerZficates SecTrustResultType evaluationResult; OSStatus status = SecTrustEvaluate(srvTrust, &evaluationResult); if (status == errSecSuccess) { if (evaluationResult == kSecTrustResultUnspecified) { // ... } } •Step$1:$$Validate$ChainofTrust
  55. 55. Reference$CerZficates SecTrustResultType evaluationResult; OSStatus status = SecTrustEvaluate(srvTrust, &evaluationResult); if (status == errSecSuccess) { if (evaluationResult == kSecTrustResultUnspecified) { // ... } } •Step$1:$$Validate$ChainofTrust
  56. 56. Reference$CerZficates •Step$1:$$Validate$ChainofTrust SecTrustResultType evaluationResult; OSStatus status = SecTrustEvaluate(srvTrust, &evaluationResult); if (status == errSecSuccess) { if (evaluationResult == kSecTrustResultUnspecified) { // ... } }
  57. 57. Reference$CerZficates •Step$1:$$Validate$ChainofTrust SecTrustResultType evaluationResult; OSStatus status = SecTrustEvaluate(srvTrust, &evaluationResult); if (status == errSecSuccess) { if (evaluationResult == kSecTrustResultUnspecified) { // ... } }
  58. 58. Reference$CerZficates •Step$1:$$Validate$ChainofTrust SecTrustResultType evaluationResult; OSStatus status = SecTrustEvaluate(srvTrust, &evaluationResult); if (status == errSecSuccess) { if (evaluationResult == kSecTrustResultUnspecified) { // ... } }
  59. 59. Reference$CerZficates •Step$1:$$Validate$ChainofTrust SecTrustResultType evaluationResult; OSStatus status = SecTrustEvaluate(srvTrust, &evaluationResult); if (status == errSecSuccess) { if (evaluationResult == kSecTrustResultUnspecified) { // ... } }
  60. 60. NSString *refPath = [[NSBundle mainBundle] pathForResource:@"reference" ofType:@"der"]; NSData *refCertData = [[NSData alloc] initWithContentsOfFile:refPath]; Reference$CerZficates •Step$2:$Load$Reference$CerZficate
  61. 61. NSString *refPath = [[NSBundle mainBundle] pathForResource:@"reference" ofType:@"der"]; NSData *refCertData = [[NSData alloc] initWithContentsOfFile:refPath]; Reference$CerZficates •Step$2:$Load$Reference$CerZficate
  62. 62. Reference$CerZficates •Step$2:$Load$Reference$CerZficate NSString *refPath = [[NSBundle mainBundle] pathForResource:@"reference" ofType:@"der"]; NSData *refCertData = [[NSData alloc] initWithContentsOfFile:refPath];
  63. 63. Reference$CerZficates BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); found = [refCertData isEqualToData:certData]; } •Step$3:$Compare$cerZficates
  64. 64. Reference$CerZficates BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); found = [refCertData isEqualToData:certData]; } •Step$3:$Compare$cerZficates
  65. 65. Reference$CerZficates •Step$3:$Compare$cerZficates BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); found = [refCertData isEqualToData:certData]; }
  66. 66. Reference$CerZficates •Step$3:$Compare$cerZficates BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); found = [refCertData isEqualToData:certData]; }
  67. 67. Reference$CerZficates •Step$3:$Compare$cerZficates BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); found = [refCertData isEqualToData:certData]; }
  68. 68. Reference$CerZficates •Step$3:$Compare$cerZficates BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); found = [refCertData isEqualToData:certData]; }
  69. 69. Reference$CerZficates •Step$3:$Compare$cerZficates BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); found = [refCertData isEqualToData:certData]; }
  70. 70. Demo$2 Video
  71. 71. FingerprinZng
  72. 72. FingerprinZng •Similar$to$Reference$CerZficate$approach •Compares$CerZficate$Fingerprint$against$ reference$value •Server$CerZficate$not$needed$in$the$client •Example:$$Apple$So`ware$Update
  73. 73. FingerprinZng$ $Client$App$Server 1122 3344 5566 7788 9900 AABB CCDD EEFF 9988 7766 SHA-1 Hash
  74. 74. FingerprinZng$ $Client$App$Server 1122 3344 5566 7788 9900 AABB CCDD EEFF 9988 7766 SHA-1 Hash
  75. 75. FingerprinZng$ $Client$App$Server == 1122 3344 5566 7788 9900 AABB CCDD EEFF 9988 7766 SHA-1 Hash 1122 3344 5566 7788 9900 AABB CCDD EEFF 9988 7766
  76. 76. FingerprinZng •Schrie$1:$ChainofTrust$validieren SecTrustResultType evaluationResult; OSStatus status = SecTrustEvaluate(srvTrust, &evaluationResult); if (status == errSecSuccess) { if (evaluationResult == kSecTrustResultUnspecified) { // ... } }
  77. 77. FingerprinZng static NSString* const kReferenceFP = @"AC .... DC"; BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); NSString* fingerprint = [self sha1:certData]; found = [kReferenceFP isEqualToString:fingerprint] } •Schrie$2:$Fingerprint$berechnen
  78. 78. FingerprinZng static NSString* const kReferenceFP = @"AC .... DC"; BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); NSString* fingerprint = [self sha1:certData]; found = [kReferenceFP isEqualToString:fingerprint] } •Schrie$2:$Fingerprint$berechnen
  79. 79. FingerprinZng •Schrie$2:$Fingerprint$berechnen static NSString* const kReferenceFP = @"AC .... DC"; BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); NSString* fingerprint = [self sha1:certData]; found = [kReferenceFP isEqualToString:fingerprint] }
  80. 80. FingerprinZng •Schrie$2:$Fingerprint$berechnen static NSString* const kReferenceFP = @"AC .... DC"; BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); NSString* fingerprint = [self sha1:certData]; found = [kReferenceFP isEqualToString:fingerprint] }
  81. 81. FingerprinZng •Schrie$2:$Fingerprint$berechnen static NSString* const kReferenceFP = @"AC .... DC"; BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); NSString* fingerprint = [self sha1:certData]; found = [kReferenceFP isEqualToString:fingerprint] }
  82. 82. FingerprinZng •Schrie$2:$Fingerprint$berechnen static NSString* const kReferenceFP = @"AC .... DC"; BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); NSString* fingerprint = [self sha1:certData]; found = [kReferenceFP isEqualToString:fingerprint] }
  83. 83. FingerprinZng •Schrie$2:$Fingerprint$berechnen static NSString* const kReferenceFP = @"AC .... DC"; BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); NSString* fingerprint = [self sha1:certData]; found = [kReferenceFP isEqualToString:fingerprint] }
  84. 84. FingerprinZng •Schrie$2:$Fingerprint$berechnen static NSString* const kReferenceFP = @"AC .... DC"; BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); NSString* fingerprint = [self sha1:certData]; found = [kReferenceFP isEqualToString:fingerprint] }
  85. 85. FingerprinZng •Schrie$2:$Fingerprint$berechnen static NSString* const kReferenceFP = @"AC .... DC"; BOOL found = NO; CFIndex crtCount = SecTrustGetCertificateCount(srvTrust); for (CFIndex j = 0; j < crtCount && !found; j++) { SecCertificateRef cert = SecTrustGetCertificateAtIndex(srvTrust, j); NSData* certData = CFBridgingRelease(SecCertificateCopyData(cert)); NSString* fingerprint = [self sha1:certData]; found = [kReferenceFP isEqualToString:fingerprint] }
  86. 86. Demo$3 Video
  87. 87. Caveats
  88. 88. Caveats •Change$of$CerZficate •Expired •Compromised •Update$app$with$plenty$of$lead$Zme •Temporarily$accept$old$and$new$ cerZficates
  89. 89. VariaZon
  90. 90. VariaZon •Check$RootCerZficate$against$reference •TradeOff:$Flexibility$vs.$Security •Updates$only$required$when$changing$ RootCA
  91. 91. Conclusions
  92. 92. Conclusions •SSL$provides •ConfidenZality$(encrypted) •AuthenZcity •CA$system$(usually)$suffiecient •More$Security$=$More$Work
  93. 93. Make$informed$ decisions!
  94. 94. Links Sample,Code •github.com/dschneller/mitmnothankyou Tools •github.com/ADVTOOLS/ADVcerZficator •github.com/ADVTOOLS/ADVTrustStore •www.apple.com/support/iphone/enterprise •technet.microso`.com/enus/library/ cc754841.aspx
  95. 95. Links TLS,Session,Cache •developer.apple.com/library/ios/#qa/qa1727 Root6CA,Lists •support.apple.com/kb/HT5012 •www.mozilla.org/projects/security/certs/ included/ •social.technet.microso`.com/wiki/contents/ arZcles/14215.windowsandwindowsphone8 sslrootcerZficateprogrammembercas.aspx •Android:$Sepngs–Security–Trusted$CredenZals
  96. 96. Thank$you!
  97. 97. QuesZons$? daniel.schneller@centerdevice.de $$$$$@dschneller
  98. 98. That’s$all.$Really.$:)
  99. 99. Demo$1 Standard$SSL,$ MITM$RootCA$ not$installiert zurück

×