Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Timing Attack

Timing Attack

Lightning Talk about how to securely compare two strings, using Rails.

Rubens Stulzer

January 19, 2017
Tweet

More Decks by Rubens Stulzer

Other Decks in Technology

Transcript

  1. ~/awesome/project master= ∴ git show f19c712702c9fced2461eabd2443c1009baffebb commit f19c712702c9fced2461eabd2443c1009baffebb Author: Rubens

    Stulzer <[email protected]> Date: Wed Apr 13 17:27:40 2016 -0300 Improves security when comparing password diff --git a/app/models/session.rb b/app/models/session.rb index 7041c8a..685c247 100644 --- a/app/models/session.rb +++ b/app/models/session.rb @@ -89,7 +89,7 @@ private def password_match? - salted_user_password == salted_db_password + ActiveSupport::SecurityUtils.secure_compare(salted_user_password, salted_db_password) end
  2. P A S S W O R D P A

    S S W O R D
  3. P A S S W O R D P A

    S S W O R D
  4. P A S S W O R D P A

    S S W O R D
  5. P A S S W O R D P A

    S S W O R D
  6. P A S S W O R D P A

    S S W O R D
  7. P A S S W O R D P A

    S S W O R D
  8. P A S S W O R D P A

    S S W O R D
  9. P A S S W O R D P A

    S S W O R D
  10. P A S S W O R D P A

    S S W O R D
  11. P A S S W O R D P A

    S S W O R D
  12. P A S S W O R D P A

    S S W O R D
  13. P A S S W O R D P A

    S S W O R D
  14. P A S S W O R D P A

    S S W O R D
  15. P A S S W O R D P A

    S S W O R D
  16. P A S S W O R D P A

    S S W O R D
  17. P A S S W O R D P A

    S S W O R D
  18. P A S S W O R D P A

    S S W O R D
  19. P A S S W O R D P A

    S S W O R D
  20. P A S S W O R D P A

    S S W O R D true
  21. Time taken - μ20 true P A S S W

    O R D P A S S W O R D
  22. P I D S I N G T P A

    S S W O R D
  23. P I D S I N G T P A

    S S W O R D
  24. P I D S I N G T P A

    S S W O R D
  25. P I D S I N G T P A

    S S W O R D
  26. P I D S I N G T P A

    S S W O R D
  27. P I D S I N G T P A

    S S W O R D
  28. P I D S I N G T P A

    S S W O R D false
  29. P I D S I N G T P A

    S S W O R D Time taken - μ1 false
  30. We

  31. We

  32. The problem is the time taken μ1 - For the

    wrong one μ20 - For the right one
  33. P A S S W O R D P A

    S S I N G T
  34. P A S S I N G T P A

    S S W O R D
  35. P A S S I N G T P A

    S S W O R D
  36. P A S S W O R D P A

    S S I N G T
  37. P A S S I N G T P A

    S S W O R D
  38. P A S S I N G T P A

    S S W O R D
  39. P A S S I N G T P A

    S S W O R D
  40. P A S S I N G T P A

    S S W O R D
  41. P A S S I N G T P A

    S S W O R D
  42. P A S S I N G T P A

    S S W O R D
  43. P A S S I N G T P A

    S S W O R D
  44. P A S S I N G T P A

    S S W O R D
  45. P A S S I N G T P A

    S S W O R D false
  46. P A S S I N G T P A

    S S W O R D Time taken - μ14 false
  47. P A S S W O R D P A

    S S I N G T
  48. P A S S I N G T P A

    S S W O R D
  49. P A S S I N G T P A

    S S W O R D
  50. P A S S W O R D P A

    S S I N G T
  51. P A S S I N G T P A

    S S W O R D
  52. P A S S I N G T P A

    S S W O R D
  53. P A S S I N G T P A

    S S W O R D
  54. P A S S I N G T P A

    S S W O R D
  55. P A S S I N G T P A

    S S W O R D
  56. P A S S I N G T P A

    S S W O R D
  57. P A S S I N G T P A

    S S W O R D
  58. P A S S I N G T P A

    S S W O R D
  59. P A S S I N G T P A

    S S W O R D
  60. P A S S I N G T P A

    S S W O R D
  61. P A S S I N G T P A

    S S W O R D
  62. P A S S I N G T P A

    S S W O R D
  63. P A S S I N G T P A

    S S W O R D
  64. P A S S I N G T P A

    S S W O R D
  65. P A S S I N G T P A

    S S W O R D false
  66. P A S S I N G T P A

    S S W O R D Time taken - μ20 false
  67. We

  68. We