The blog.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

102 lines
5.3 KiB

  1. ---
  2. title: Adventures in Autobahn/WAMP Security
  3. description: >
  4. Adventures in Autobahn/WAMP Security
  5. posted: !!timestamp '2017-09-17'
  6. created: !!timestamp '2017-09-17'
  7. time: 12:21 PM
  8. tags:
  9. - web
  10. - WAMP
  11. - security
  12. ---
  13. ## Or how security continues to suck because: It's Hard and Someone Else's Problemâ„¢
  14. For a personal project, I've decided to use WAMP to move some events and
  15. messages around between different components. I decided on the AutoBahn
  16. libraries and Crossbar.io as the router. I was already somewhat familiar
  17. w/ AutoBahn from previous work, and the Crossbar.io router seems to just
  18. work. As a security person, I decided to evaluate how to make things as
  19. secure as possible.
  20. First off,
  21. [my projects must be both authenticated and encrypted](https://twitter.com/encthenet/status/881596129573347328).
  22. WAMP does not appear to have it's own encryption layer, but it does have
  23. it's own authentication layer. You really don't want to have to trust
  24. two different authentication layers<label for="sn-encauth"
  25. class="margin-toggle sidenote-number"></label><input type="checkbox"
  26. id="sn-encauth" class="margin-toggle"/><span class="sidenote">The
  27. encryption layer must be authenticated, otherwise
  28. any attacker could MiTM the connection. Most uses of TLS make use of
  29. the CA system for authentication (which has serious issues in trust),
  30. and most web apps add their own authentication layer on top of it (not
  31. using Basic Auth, or other scheme). The issues w/ this is that if there
  32. is no binding between the two layers, the lower layer (application
  33. layer) cannot be sure that the upper layer has not been compromised.</span>,
  34. so being able to use
  35. [TLS Channel Bindings](https://tools.ietf.org/html/rfc5929) would be an
  36. improvement. This would ensure that a strong authentication method in
  37. WAMP would ensure that the channel is properly encrypted. I
  38. [received confirmation](https://twitter.com/crossbario/status/904690145907142656)
  39. from the Crossbar.io team that it was present.
  40. Autobahn and Crossbar.io supports a number of
  41. [different authentication schemes](https://crossbar.io/docs/Authentication/).
  42. As I plan on putting this behind a reverse proxy (which I realize will
  43. have it's own issues w/ channel binding), I wanted the strongest security
  44. binding between my client and the server (and I'm a glutton for punishment
  45. for using unproven tech). The only one that satisfies this requirement
  46. is WAMP-Cryptosign.
  47. After I got basic functionality working to make sure things would be
  48. workable w/ this framework, I decided to start working on the
  49. authentication piece. First problem I ran into was that the AutoBahn|JS
  50. library does not support TLS channel binding. There is a good reason the
  51. library doesn't support it, and it's for a very bad reason. There is
  52. no support in the browser [WebSocket API](https://www.w3.org/TR/websockets/)
  53. to query the channel binding information necessary. The fact that
  54. WebSockets was standardized after Channel bindings were demonstrates that
  55. the people involved in standardizing the web do not take security
  56. seriously. As usual, they assume that security is not their problem and
  57. leaves it up to someone else to solve (or at another layer).
  58. Disappointed that I wouldn't be able to use channel bindings w/ the web
  59. client for this project (I still had the crappy CA authentication of TLS,
  60. so not all was lost), I moved forward w/ CryptoSign. As has been
  61. demonstrated many times, the only way to get security baked in, is to
  62. make it as easy as possible to use. I've been long familiar w/
  63. [Crypto Box](https://nacl.cr.yp.to/box.html) by djb (and used by the
  64. Autobahn libraries), and also the [noise protocol](https://noiseprotocol.org/)
  65. (which my friend Trevor created). Both of these have goals of making
  66. it simple to let developers include security in their projects and not
  67. mess it up, resulting in a broken system. As currently implemented,
  68. Autobahn's CryptoSign is most definitely not easy to use.
  69. Though the documentation is decent, some examples are not present
  70. (`client_ssh_key.py` for example from
  71. [WAMP-cryptosign Static Authentication](https://github.com/crossbario/crossbar-examples/tree/master/authentication/cryptosign/static)).
  72. The
  73. [ApplicationRunner](https://autobahn.readthedocs.io/en/latest/wamp/programming.html#running-components)
  74. helper class does not document how to make use of authentication. Though
  75. the static authentication page has examples, they make you write quite
  76. a bit of boiler plate.
  77. Then even once you do that, you find out that the code doesn't even work
  78. on Python 2.7 and have to
  79. [fix it](https://github.com/crossbario/autobahn-python/pull/901) for
  80. them. Hopefully the pull request (PR) will not be ignored because of the
  81. failing CI tests, because the current CI tests are problems with their
  82. CI environment, and not the PR. For CI checks like this, it should only
  83. ding your PR on checks that are newly failing, and ignore any checks that
  84. were previously failing. This isn't the first project that their CI
  85. environment was broken.
  86. Even w/ the fixes in place, there is no documented method of extracting
  87. a public key from a generated ssh key. I will be adding a method to
  88. print this out.
  89. If I (who knows cryptography decently) have to fix and spend hours making
  90. this work, it's no wonder than everyone things that strong cryptography
  91. is hard. It is hard, but it shouldn't be.