globaleaks / whistleblowing-software

GlobaLeaks is free, open-source whistleblowing software enabling anyone to easily set up and maintain a secure reporting platform.
https://www.globaleaks.org
Other
1.22k stars 267 forks source link

Improve Side Channel Attack protection based on HTTP response throttling #865

Open fpietrosanti opened 10 years ago

fpietrosanti commented 10 years ago

This ticket is to improve Side Channel Attack protection based on HTTP response throttling based on the early implementation that has been done at #857 .

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

vecna commented 10 years ago

check this comment: https://github.com/globaleaks/GlobaLeaks/issues/857#issuecomment-40921667

evilaliv3 commented 10 years ago

@vecna i see only two issues in the solution implemented:

public commented 10 years ago

You should try and actually measure some of these suspected side channels in controlled circumstances. It's often surprisingly easy to get them to show up and fixing something you can directly test gives you much more confidence that things are being fixed than stuff you are fairly sure exists but haven't actually seen :)

As people have noted, adding randomised, constant or other forms of time delay to requests is not a great solution. Throttling request rates is challenging to do well too as it's fairly easy for an attacker to use a widely distributed set of systems to carry out the requests required for analysing any timing side channel.

fpietrosanti commented 10 years ago

Let's say that for this feature, we need to write down a 1-2 page specification to acquire consensus on the proper way to do it?

Like #264 it seems that everything that involve timing always trigger a lot of debate, so it probably need to be specified in advance and peer-reviewed in order to acquire the needed consensus.

I'm confident that with proper timing management (random or constant, it's a matter of documenting the algorithm and it's drawback) an external/remote attacker would not be able to infere any kind of possibly present side-channel attack to be identified/exploited.

Think about the old OpenSSH bug http://www.cvedetails.com/cve/CVE-2003-0190/ that has been fixed just by adding a delay in order to defeat the timing analysis.

So, this make me to be convinced that this "approach" works, but probably we would need to:

/cc @defuse

fpietrosanti commented 10 years ago

Side Channel Vulnerabilities on the Web - Detection and Prevention https://www.owasp.org/images/c/cd/Side_Channel_Vulnerabilities.pdf

fpietrosanti commented 10 years ago

"Worst Case Execution Time" (WCET) is our friend

fpietrosanti commented 10 years ago

From what i read online looking at OWASP, IMHO the constant timing approach sounds like a good approach, we probably just need to:

public commented 10 years ago

WCET makes DoS easier and is vulnerable to attacks to which increase the running time of the suspect algorithm beyond your anticipated WCET.

fpietrosanti commented 10 years ago

@public Well, any "delay based" system introduce possible additional attack surface from the DoS point of view, but it's always a matter on "what the worst scenario" you are protecting from.

But If we want to look towards following "best practices", the only paper to add layer of protection against side-channel attack on web application, is that one from owasp, that talk about WCET.

So, if we accept the additional risks of DoS because of added delay, the question is:

Do you see any other possible defense-in-depth approach to this HTTP-side-channel issue?

public commented 10 years ago

In my opinion the correct solution is to identify which classes of data are sensitive in your application and to encapsulate them to prevent accidental leakage and provide side channel protected APIs for working with them. If you don't design the APIs that handle the sensitive data well then no amount of middleware is going to save you from inevitable coding errors.

This is also basically the the conclusion that this paper from Microsoft Research comes to. http://research.microsoft.com/pubs/119060/webappsidechannel-final.pdf

We also studied the challenges in mitigating such a problem, and show that effective and efficient mitigations have to be application-specific: developers will need to identify the vulnerabilities first, and then specify mitigation policies accordingly. This effort requires analysis of web application semantics, information flow and network traffic patterns. Public domain knowledge also needs to be examined in order to understand the real power of the attacker and the effectiveness of the defense.

defuse commented 10 years ago

Also consider side channels that are not based on the response time. For example, cache timing attacks, which can be performed by processes running as unprivileged users on the same system or on a different Virtual Machine that's running on the same hardware.

In my opinion, it is better to remove the side channel itself than to try to hide it.

evilaliv3 commented 10 years ago

@vecna there are a lot of handlers that are not protected currently so that i think that it's better to introduce your patch only when fully implemented and audited. having some handler unprotected adds no protection and simply add usability issues.

list of handlers not protected:

in addition i think that this kind of uniform delay must evantually be applyed only to the secrets_check functions that in general are applied to the first part of the handler and takes ~5ms so that uniforming at 800ms is an exaggeration

evilaliv3 commented 10 years ago

while we decide how to better refine the solution i've temporary removed it's application from the new release (2.60) except from the authentication handlers: https://github.com/globaleaks/GLBackend/commit/73cd9de5363254b21d2182199c9d95077a20870f

in fact: