Skip to content
Snippets Groups Projects
  1. Jun 06, 2019
  2. Jun 05, 2019
  3. Jun 03, 2019
  4. May 31, 2019
  5. May 29, 2019
    • Nick Mathewson's avatar
      Shutdown libevent _after_ the subsystems. · ba9b0319
      Nick Mathewson authored
      This is necessary since shutting down libevent frees some pointer
      that the subsystems want to free themselves. A longer term solution
      will be to turn the evloop module into a subsystem itself, but for
      now it is best to do the minimal fix.
      
      Fixes bug 30629; bugfix on 0.4.1.1-alpha.
      ba9b0319
    • Nick Mathewson's avatar
      Make get_proxy_type() connection-specific · 5cbd71b9
      Nick Mathewson authored
      Previously, we were looking at our global settings to see what kind
      of proxy we had.  But doing this would sometimes give us the wrong
      results when we had ClientTransportPlugin configured but we weren't
      using it for a particular connection.  In several places in the
      code, we had added checks to see if we were _really_ using a PT or
      whether we were using a socks proxy, but we had forgotten to do so
      in at least once case.  Instead, since every time we call this
      function we are asking about a single connection, it is probably
      best just to make this function connection-specific.
      
      Fixes bug 29670; bugfix on 0.2.6.2-alpha.
      5cbd71b9
    • Nick Mathewson's avatar
      Remove want_cmddata from HSFETCH, which does not in fact want data · 2d66250d
      Nick Mathewson authored
      This looks a copy-and-paste error to me.  Fixes bug 30646; bugfix on
      0.4.1.1-alpha.
      2d66250d
    • David Goulet's avatar
      hs: Implement a helper to repurpose a circuit · 3789f22b
      David Goulet authored
      
      When we repurpose a hidden service circuit, we need to clean up from the HS
      circuit map and any HS related data structured contained in the circuit.
      
      This commit adds an helper function that does it when repurposing a hidden
      service circuit.
      
      Fixes #29034
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      3789f22b
    • Nick Mathewson's avatar
    • Tobias Stoeckmann's avatar
      Fixed tor_vasprintf on systems without vasprintf. · 0d5a0b4f
      Tobias Stoeckmann authored and Nick Mathewson's avatar Nick Mathewson committed
      
      If tor is compiled on a system with neither vasprintf nor _vscprintf,
      the fallback implementation exposes a logic flaw which prevents
      proper usage of strings longer than 127 characters:
      
      * tor_vsnprintf returns -1 if supplied buffer is not large enough,
        but tor_vasprintf uses this function to retrieve required length
      * the result of tor_vsnprintf is not properly checked for negative
        return values
      
      Both aspects together could in theory lead to exposure of uninitialized
      stack memory in the resulting string. This requires an invalid format
      string or data that exceeds integer limitations.
      
      Fortunately tor is not even able to run with this implementation because
      it runs into asserts early on during startup. Also the unit tests fail
      during a "make check" run.
      
      Signed-off-by: default avatarTobias Stoeckmann <tobias@stoeckmann.org>
      
        [backported to 0.2.9 by nickm]
      0d5a0b4f
    • Taylor R Campbell's avatar
      Use MAP_INHERIT_ZERO or MAP_INHERIT_NONE if available. · 7971b3a5
      Taylor R Campbell authored and Nick Mathewson's avatar Nick Mathewson committed
      Fixes assertion failure in tests on NetBSD:
      
      slow/prob_distr/stochastic_log_logistic: [forking] May 25 03:56:58.091 [err] tor_assertion_failed_(): Bug: src/lib/crypt_ops/crypto_rand_fast.c:184: crypto_fast_rng_new_from_seed: Assertion inherit != INHERIT_RES_KEEP failed; aborting. (on Tor 0.4.1.1-alpha-dev 29955f13)
      May 25 03:56:58.091 [err] Bug: Assertion inherit != INHERIT_RES_KEEP failed in crypto_fast_rng_new_from_seed at src/lib/crypt_ops/crypto_rand_fast.c:184: . (Stack trace not available) (on Tor 0.4.1.1-alpha-dev 29955f13)
      [Lost connection!]
      7971b3a5
  6. May 28, 2019
  7. May 27, 2019
    • Nick Mathewson's avatar
    • Nick Mathewson's avatar
      Make sure that we send at least some random data in RELAY_DATA cells · 0bc12414
      Nick Mathewson authored
      Proposal 289 prevents SENDME-flooding by requiring the other side to
      authenticate the data it has received.  But this data won't actually
      be random if they are downloading a known resource.  "No problem",
      we said, "let's fell the empty parts of our cells with some
      randomness!" and we did that in #26871.
      
      Unfortunately, if the relay data payloads are all completely full,
      there won't be any empty parts for us to randomize.
      
      Therefore, we now pick random "randomness windows" between
      CIRCWINDOW_INCREMENT/2 and CIRCWINDOW_INCREMENT. We remember whether we have
      sent a cell containing at least 16 bytes of randomness in that window.  If we
      haven't, then when the window is exhausted, we send one.  (This window approach
      is designed to lower the number of rng checks we have to do.  The number 16 is
      pulled out of a hat to change the attacker's guessing difficulty to
      "impossible".)
      
      Implements 28646.
      0bc12414
  8. May 26, 2019
  9. May 23, 2019
  10. May 22, 2019
    • Nick Mathewson's avatar
      ebe39dcb
    • Nick Mathewson's avatar
    • Nick Mathewson's avatar
      Bump to 0.4.1.1-alpha · 3a7ed8bc
      Nick Mathewson authored
      3a7ed8bc
    • David Goulet's avatar
      sendme: Add non fatal asserts for extra safety · 0cad83be
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      Two non fatal asserts are added in this commit. First one is to see if the
      SENDME digest list kept on the circuit for validation ever grows bigger than
      the maximum number of expected SENDME on a circuit (currently 10).
      
      The second one is to know if we ever send more than one SENDME at a time on a
      circuit. In theory, we shouldn't but if we ever do, the v1 implementation
      wouldn't work because we only keep one single cell digest (the previous cell
      to the SENDME) on the circuit/cpath. Thus, sending two SENDME consecutively
      will lead to a mismatch on the other side because the same cell digest would
      be use and thus the circuit would collapse.
      
      Finally, add an extra debug log in case we emit a v0 which also includes the
      consensus emit version in that case.
      
      Part of #30428
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      0cad83be
    • David Goulet's avatar
      sendme: Always pop last SENDME digest from circuit · 5479ffab
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      We must not accumulate digests on the circuit if the other end point is using
      another SENDME version that is not using those digests like v0.
      
      This commit makes it that we always pop the digest regardless of the version.
      
      Part of #30428
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      5479ffab
    • David Goulet's avatar
      sendme: Clarify how sendme_circuit_cell_is_next() works · 482c4972
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      Commit 4ef8470fa5480d3b was actually reverted before because in the end we
      needed to do this minus 1 check on the window.
      
      This commit clarifies that in the code, takes the useful comment changes from
      4ef8470fa5480d3b and makes sendme_circuit_cell_is_next() private since it
      behaves in a very specific way that one external caller might expect.
      
      Part of #30428.
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      482c4972
    • David Goulet's avatar
      sendme: Properly record SENDMEs on both edges · 3835a3ac
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      Turns out that we were only recording the "b_digest" but to have
      bidirectionnal authenticated SENDMEs, we need to use the "f_digest" in the
      forward cell situation.
      
      Because of the cpath refactoring, this commit plays with the crypt_path_ and
      relay_crypto_t API a little bit in order to respect the abstractions.
      
      Previously, we would record the cell digest as the SENDME digest in the
      decrypt cell function but to avoid code duplication (both directions needs to
      record), we now do that right after iff the cell is recognized (at the edge).
      It is now done in circuit_receive_relay_cell() instead.
      
      We now also record the cell digest as the SENDME digest in both relay cell
      encryption functions since they are split depending on the direction.
      relay_encrypt_cell_outbound() and relay_encrypt_cell_inbound() need to
      consider recording the cell digest depending on their direction (f vs b
      digest).
      
      Fixes #30428
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      3835a3ac
    • David Goulet's avatar
      sendme: Never fallback to v0 if unknown version · 44265dd6
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      There was a missing cell version check against our max supported version. In
      other words, we do not fallback to v0 anymore in case we do know the SENDME
      version.
      
      We can either handle it or not, never fallback to the unauthenticated version
      in order to avoid gaming the authenticated logic.
      
      Add a unit tests making sure we properly test that and also test that we can
      always handle the default emit and accepted versions.
      
      Fixes #30428
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      44265dd6
    • David Goulet's avatar
      sendme: Validate v1 SENDMEs on both client and exit side · 69e0d5bf
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      The validation of the SENDME cell is now done as the very first thing when
      receiving it for both client and exit. On failure to validate, the circuit is
      closed as detailed in the specification.
      
      Part of #30428
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      69e0d5bf
    • David Goulet's avatar
      sendme: Record cell digest on both client and exit · 59b9eecc
      David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
      
      It turns out that only the exit side is validating the authenticated SENDME v1
      logic and never the client side. Which means that if a client ever uploaded
      data towards an exit, the authenticated SENDME logic wouldn't apply.
      
      For this to work, we have to record the cell digest client side as well which
      introduced a new function that supports both type of edges.
      
      This also removes a test that is not valid anymore which was that we didn't
      allow cell recording on an origin circuit (client).
      
      Part of #30428
      
      Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
      59b9eecc
Loading