It's All About Time – Remote timing attacks in PHP
blog.ircmaxell.com
It's All About Time – Remote timing attacks in PHP
1–10 of 52 posts
Re: It's All About Time – Remote timing attacks in PHP
#2Not saying it's not an issue, but I'm not so sure it's a big deal either.
Re: It's All About Time – Remote timing attacks in PHP
#3I've looked into timing attacks in the past but failed to exploit one. Even running php locally from the command line, eliminating any possibility of network randomness, I couldn't get even a few bytes with any amount of certainty. Not saying it's not an issue, but I'm not so sure it's a big deal either.
The code for the tool (and a presentation pdf) is here if you're interested: https://github.com/aj-code/TimingIntrusionTool5000
Re: It's All About Time – Remote timing attacks in PHP
#4I've looked into timing attacks in the past but failed to exploit one. Even running php locally from the command line, eliminating any possibility of network randomness, I couldn't get even a few bytes with any amount of certainty. Not saying it's not an issue, but I'm not so sure it's a big deal either.
I wrote a tool a while ago for testing network based timing attacks. Getting the measurement right is really hard, just taking the average doesn't generally work while the 10th percentile measurement is much better. I did find PHP fairly hard to exploit though, but I was trying over a network which much more difficult than locally. The code for the tool (and a presentation pdf) is here if you're interested: https://g…
Re: It's All About Time – Remote timing attacks in PHP
#5I would imagine that you can prevent length leaks by looping through the characters of the known value and then returning that comparison with an additional check of length.
function timingSafeEquals($safe, $user) {
$safeLen = strlen($safe);
$userLen = strlen($user);
$result = 0;
for ($i = 0; $i Re: It's All About Time – Remote timing attacks in PHP
#6For optimal security, OP mentions that we should fix the underlying code, but I kind of disagree. Understanding all the underlying code is a lot of work and, except for extremely secure application, is not really needed. Also, hindering performance for security is not always the way to go (he mentions returning only at the end).
If you have ultra-secure tasks to do, you might want to do something like calculating the execution time of the function and sleep()'ing to add padding. Example code (doesn't work):
function login(){
execstart = utime()
// whatever code
execduration = utime() - execstart;
sleep( execduration % 100 ); // pad on at 100 boundary
}You'd have to carefully choose your padding so the execution time is (normally) not revealed in the code.
Re: It's All About Time – Remote timing attacks in PHP
#7Interesting article, I never took the time to really think about this. For optimal security, OP mentions that we should fix the underlying code, but I kind of disagree. Understanding all the underlying code is a lot of work and, except for extremely secure application, is not really needed. Also, hindering performance for security is not always the way to go (he mentions returning only at the end). If you have ultra-…
Re: It's All About Time – Remote timing attacks in PHP
#8Earlier quoted context omitted.
I wrote a tool a while ago for testing network based timing attacks. Getting the measurement right is really hard, just taking the average doesn't generally work while the 10th percentile measurement is much better. I did find PHP fairly hard to exploit though, but I was trying over a network which much more difficult than locally. The code for the tool (and a presentation pdf) is here if you're interested: https://g…
Even taking the straight minimum may be better.
Re: It's All About Time – Remote timing attacks in PHP
#9> NOTE In general, it's not possible to prevent length leaks. So it's OK to leak the length. I would imagine that you can prevent length leaks by looping through the characters of the known value and then returning that comparison with an additional check of length. function timingSafeEquals($safe, $user) { $safeLen = strlen($safe); $userLen = strlen($user); $result = 0; for ($i = 0; $i
Re: It's All About Time – Remote timing attacks in PHP
#10Interesting article, I never took the time to really think about this. For optimal security, OP mentions that we should fix the underlying code, but I kind of disagree. Understanding all the underlying code is a lot of work and, except for extremely secure application, is not really needed. Also, hindering performance for security is not always the way to go (he mentions returning only at the end). If you have ultra-…
I don't know how to do [code] tags
https://news.ycombinator.com/formatdoc
>Text after a blank line that is indented by two or more spaces is reproduced verbatim. (This is intended for code.)