Giter VIP home page Giter VIP logo

Comments (6)

micahflee avatar micahflee commented on May 28, 2024

I'm reopening this issue because of pull request #4 (@andrew-d wrote a quick and simple alternative to my commit, but he's also not using an established library) and the comments in a12dd0c.

@kofalt @svisser, any suggestions on what library to use? Is there one that's included with python, so we won't have to include more dependencies?

Also, while important, I think this is a defense-in-depth problem. I'm skeptical if timing attacks can even work when hopping across 7 Tor nodes. The person running onionshare gets to see logs scroll by of every request made. And the attacker would have to somehow learn the specific, short-lived .onion address to attack in the first place.

from onionshare.

andrew-d avatar andrew-d commented on May 28, 2024

There's the built-in hmac.compare_digest, but that was only added in Python 3.3. It might be possible to do a fallback of sorts:

import hmac

if hasattr(hmac, 'compare_digest'):
    is_equal = hmac.compare_digest
else:
    # Etc.

I'm not familiar with other, external libraries.

EDIT: Also, it appears that this only supports ASCII characters, throwing a TypeError on Unicode strings. You'd have to encode the strings first.

from onionshare.

micahflee avatar micahflee commented on May 28, 2024

I just implemented #2 which actually completely gets rid of basic auth and the username and password, which basically means there is no string comparison of secret data going on in onionshare.py anymore.

But the real question is: is there still the same timing attack to guess the URL, but this time the problem is nestled somewhere in flask's routing code?

from onionshare.

garrettr avatar garrettr commented on May 28, 2024

But the real question is: is there still the same timing attack to guess the URL, but this time the problem is nestled somewhere in flask's routing code?

Good point. I did not dig into the code enough to definitively determine this, but it is likely those comparisons are not constant time.

I do not agree that we should just assume that timing attacks are "impossible over Tor" (famous last words). I do, however, think, that this is a good opportunity to create a threat model document, which we can use to evaluate this kind of trade-off.

from onionshare.

garrettr avatar garrettr commented on May 28, 2024

The route decorator uses add_url_rule internally, so we can subclass and change that method, perhaps substituting a constant time string comparison algo such as hmac.compare_digest.

from onionshare.

micahflee avatar micahflee commented on May 28, 2024

@garrettr, nice I like it.

from onionshare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.