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.
 
 
 
 

101 lines
5.2 KiB

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