$30 off During Our Annual Pro Sale. View Details »

Security Horror stories in Payments

Nemo
January 25, 2017

Security Horror stories in Payments

My talk at 50p Conference by HasGeek.

Talk Proposal: https://50p.talkfunnel.com/2017/22-security-horror-stories-in-payments

Conference Details: https://50p.in/2017/

Nemo

January 25, 2017
Tweet

More Decks by Nemo

Other Decks in Technology

Transcript

  1. Security Horror
    Stories in
    Payments
    '); DROP TABLE payments; --
    Nemo
    Razorpay

    View Slide

  2. Nemo

    View Slide

  3. Security ∩ Payments

    View Slide

  4. Useless Security

    View Slide

  5. Over Engineering Security

    View Slide

  6. Over Engineering Security

    View Slide

  7. Over Engineering Security

    View Slide

  8. Over Engineering Security

    View Slide

  9. Over Engineering Security

    View Slide

  10. Confidentiality

    View Slide

  11. Confidentiality

    View Slide

  12. Confidentiality

    View Slide

  13. Replay Attacks

    View Slide

  14. Replay Attacks

    View Slide

  15. Confidentiality

    View Slide

  16. Confidentiality

    View Slide

  17. Don’t do it!

    View Slide

  18. Message Integrity

    View Slide

  19. Request

    View Slide

  20. Request

    View Slide

  21. Request
    http://ndna-website.com/makeRequest

    View Slide

  22. Sign all the things!
    LETTER
    NUMBER
    568

    View Slide

  23. Should have gotten it reviewed

    View Slide

  24. HMAC?
    Hmac is a mandatory field which should be prepared following the steps below:
    1. Concatenate App Id, Mobile number and Device Id with the separator “|”.
    2. Create a hash of the concatenated string using SHA-256 algorithm.
    3. Encrypt the hash with the token as key using AES-256 algorithm.
    4. Populate HMAC with the encrypted string.

    View Slide

  25. HMAC?
    Hmac is a mandatory field which should be prepared following the steps below:
    1. Concatenate App Id, Mobile number and Device Id with the separator “|”.
    2. Create a hash of the concatenated string using SHA-256 algorithm.
    3. Encrypt the hash with the token as key using AES-256 algorithm.
    4. Populate HMAC with the encrypted string.

    View Slide

  26. HMAC?
    Hmac is a mandatory field which should be prepared following the steps below:
    1. Concatenate App Id, Mobile number and Device Id with the separator “|”.
    2. Create a hash of the concatenated string using SHA-256 algorithm.
    3. Encrypt the hash with the token as key using AES-256 algorithm.
    4. Populate HMAC with the encrypted string.

    View Slide

  27. Set it to fire and try again

    View Slide

  28. PCI-DSS 101
    3.2 Do not store sensitive authentication data after authorization (even if
    encrypted). If sensitive authentication data is received, render all data
    unrecoverable upon completion of the authorization process.

    View Slide

  29. Any guesses what this does?

    View Slide

  30. Any guesses what this does?

    View Slide

  31. Any guesses what this does?

    View Slide

  32. Any guesses what this does?

    View Slide

  33. git commit -m “Adds feature to iOS”

    View Slide

  34. Learnings
    1. Don’t roll your own Crypto.
    2. Don’t overengineer security
    a. Rely on TLS / PGP / Bcrypt / HMAC
    3. Use standard authentication
    i. JWT (Json Web Tokens)
    ii. Token Auth
    iii. Use “standard” HMAC for signatures
    4. Use NaCl for encryption

    View Slide

  35. if you have to type the letters “A-E-S”
    into your source code, you’re doing it
    wrong.
    - Thomas Ptacek
    goo.gl/DEl4bC

    View Slide

  36. Good vs Bad Security
    - Authentication
    - Authorization
    - Confidentiality
    - Integrity

    View Slide

  37. Good vs Bad Security
    - Authentication
    - Authorization
    - Confidentiality
    - Integrity

    View Slide