News for hackers. Stuff that matters.
Re:String Comparison Timing Attacks by jamilbk on Saturday June 01, 2024 @12:00PM (#40546824)
The author's conclusion to question of "are timing attacks viable?" seems to be... it depends on the nature of the language or library. Are most devs going to understand these nuances though?

In the time it takes to research the timing behavior of your runtime, you could have reached for a constant-time comparison instead.

Similarly, in the time it takes you to reach the conclusion the comparison you're using isn't vulnerable, you could have reached for a secure compare instead.

I'm not convinced this post makes a compelling case against the best practice of always using a secure compare for secret strings.

Re:String Comparison Timing Attacks by teo_zero on Saturday June 01, 2024 @12:16PM (#40546943)
In fact the bottom line is

> The time differences for individual characters are often below one nanosecond, making it virtually impossible to detect remotely.

What I'm taking away is: scrutinizing the algorithm used for string comparison should be low priority compared to other security-related concerns.

Re:String Comparison Timing Attacks by robertclaus on Saturday June 01, 2024 @12:14PM (#40546926)
It was interesting how small the differences in these computations are. Can you do timing attacks like this in the web at all, or do they only work if you already have direct access to the machine without additional variance (like networking) to take into account?
Re:String Comparison Timing Attacks by pierrefermat1 on Saturday June 01, 2024 @01:09PM (#40547411)
Given the Y scale in ns, no doubt it has to be local
Re:String Comparison Timing Attacks by zrm on Saturday June 01, 2024 @02:05PM (#40547831)
That doesn't necessarily follow. Even if the network latency is 50ms, the variance in network latency can often be less than 1ms, and then even smaller timing differences can be measured through statistical sampling.
Re:String Comparison Timing Attacks by kdbg on Saturday June 01, 2024 @02:23PM (#40547932)
You can, but maybe not in the "standard" way.

Standard way being trying to measure the precise differences between requests. The smaller the difference the more requests are needed to level things out and that just becomes pretty impractical quickly but still possible in some situations.

If you actually wanted to do a timing attack on the web you'd probably want to do something like a "Timeless Timing Attack" [0]. At a high-level the idea is to measure relative timing differences rather than the precise difference. Answering which request completes faster rather than how much faster.

The specific attack from the paper is taking advantage of HTTP/2 multiplexing to send two requests within a single packet, ensuring they arrive at the same time. Then uses the response order to determine which was processed faster/slower. It still requires making multiple requests to smooth out the data just not as much since you're only interested in the relative competition time.

Its not practical everywhere, but its more practical for the web than the traditional technique.

[1] https://www.usenix.org/conference/usenixsecurity20/presentat...

Re:String Comparison Timing Attacks by sylware on Saturday June 01, 2024 @12:27PM (#40547029)
I remember a decade and a half ago, a network protocol which was flat , statistically, on internet traffic metrics (bandwidth expensive as even with 0 traffic encrypted blank noise was isochronously transfered).

It was at the time rumors spread about statistical attacks on tor with man-in-the-middle agents and corrupted nodes.

The rumors said the author of the published thesis was asked nicely by "authorities" to un-publish it...

Re:String Comparison Timing Attacks by halfcat on Saturday June 01, 2024 @12:55PM (#40547304)
BREACH attack [1] is another interesting study.

I learned about it when someone suggested using compression to address scenarios where Tailwind CSS is duplicated in HTTP responses, and a BREACH attack was suggested as a potential downside to consider.

[1] https://en.m.wikipedia.org/wiki/BREACH

Re:String Comparison Timing Attacks by tptacek on Saturday June 01, 2024 @01:04PM (#40547373)
BREACH is, of course, a compression side channel, not a timing side channel.
Re:String Comparison Timing Attacks by tveita on Saturday June 01, 2024 @02:26PM (#40547957)
Maybe this can save you by accident but it feels too fragile to rely on for security. For in-house code you might know every compiler and CPU you will run on now and in the future. For open source, are you comfortable releasing code with silent assumptions that turns into a security hole if someone runs it on an AVR.
Re:String Comparison Timing Attacks by saagarjha on Saturday June 01, 2024 @03:31PM (#40548430)
The author of this seems to conclude that timing attacks are very difficult, because the effects seem very small. And they are pretty hard. But attackers are also very resourceful, and they have all sorts of tricks to extract signal out of noise. Even the coarsest of timers falls victim to statistics if you sample enough. And there are all sorts of tricks to increase the measured times, too: a clever attack would be to influence the heap so that the string straddles a cache line or page boundary, then force the remaining data out of the cache so you can notice a much larger bump if it gets read.
Re:String Comparison Timing Attacks by wglb on Saturday June 01, 2024 @06:46PM (#40549761)
I am not sure that the general conclusion is warranted.

See for example the cryptopals exercise https://cryptopals.com/sets/4/challenges/31

Experience has shown that this is even detectable remotely.

When auditing any cryptographic library, this is one of the first things I look for.

Re:String Comparison Timing Attacks by dfox on Saturday June 01, 2024 @07:20PM (#40549966)
There are a many ways how to recover a signal from the noise. This means that the sidechannel from the string comparison looks irrelevant, but given enough samples there is an information in that. And well, somehow getting rid of the noise is the idea behind essentially any side-channel attack.

For context: the GPS signal that your phone fixes to is something like -120dB under the noise floor, there is a way to recover that.