Questions tagged [timing-attack]

32 questions
18
votes
4 answers

Could a random sleep prevent timing attacks?

From Wikipedia In cryptography, a timing attack is a side channel attack in which the attacker attempts to compromise a cryptosystem by analyzing the time taken to execute cryptographic algorithms. Actually, to prevent timing attacks, I'm…
DrKey
  • 3,365
  • 2
  • 29
  • 46
13
votes
1 answer

Why is order of arguments in PHP's hash_equals() function important?

PHP 5.6 introduced hash_equals() function for safe comparison of password hashes and prevention of timing attacks. Its signature is: bool hash_equals(string $known_string, string $user_string) As described in the documentation, $known_string and…
Alex Shesterov
  • 26,085
  • 12
  • 82
  • 103
12
votes
1 answer

Timing attack with PHP

I'm trying to produce a timing attack in PHP and am using PHP 7.1 with the following script:
exussum
  • 18,275
  • 8
  • 32
  • 65
10
votes
2 answers

MessageDigest.isEqual function use in Java

I have two question that I don't understand. Please help me take a look.Thanks. What is the use of MessageDigest.isEqual function in Java? Explain why, in some versions prior to Java SE 6 Update 17, it was vulnerable to a timing attack.
user5545809
  • 101
  • 1
  • 7
7
votes
1 answer

Does this prefetch256() function offer any protection against cache timing attacks on AES?

This is a borderline topic. Since I wanted to know about programming, CPU cache memory, reading CPU cache lines etc, I'm posting it here. I was implementing AES algorithm in C/C++. Since performing GF(28) multiplications are computationally…
Vivekanand V
  • 340
  • 2
  • 12
7
votes
1 answer

String prediction through comparisons

Today I woke up and thought if it would be possible to predict Strings only analyzing the time between each comparison. I create a rudimentary class (I know that it is not the best alghorithm, but it works for me) to try prove this, and the answer…
juanhl
  • 1,170
  • 2
  • 11
  • 16
3
votes
2 answers

Main techniques for preventing timing attacks

I am not very familiar with security stuff, but have encountered this constant time function to prevent timing attacks: // shortcutting on type is necessary for correctness if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { return false; } //…
Lance
  • 75,200
  • 93
  • 289
  • 503
3
votes
0 answers

Cache timing on ARM processor

i need to implement AES algorithm on a smartphone with ARM Cortex A-15 processor(Samsung Galaxy Note 3, etc) and need to observe and save cache timings for each process, round. How do I go about it? To be precise, I need to observe time taken by the…
Tashi
  • 108
  • 6
3
votes
1 answer

Compare 2 secrets in constant time using Windows crypto API

Using the Windows cryptography API, how do I compare two byte arrays for equality in constant time? Edit: The length of the secret is fixed and is public knowledge.
Demi
  • 3,535
  • 5
  • 29
  • 45
3
votes
1 answer

Comparing two byte arrays guarding against timing attacks

I want to write a method to compare two byte arrays, but I do not want to use these solutions because I want the method to be resistant to timing attacks. My method essentially looks like: static bool AreEqual(byte[] a1, byte[] a2) { bool…
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
2
votes
2 answers

Prevent django send_mail timimg attack

I have different REST-API views where I either send a mail (if an account exists) or do not send a mail. For example, the user can input the email in the forgot-password form and a mail is sent if the account exists. I am using from django.core.mail…
2
votes
2 answers

Should I use == for string comparison?

sorry if this is a weird question. I was actually curious about timing attacks, so I have done a little research and understood the concept. I understood that, code like: if token == password: print('Welcome') else: print('Wrong…
nltc
  • 83
  • 2
  • 10
2
votes
0 answers

Is it necessary to worry about timing attacks when comparing SHA256 or Argon2 hashes?

I have implemented Argon2 hashing algorithm for password hashing. I am worry about my code, it may vulnerable to timing attack. public static boolean login(String mailId, String password) { List userList = findByMailId(mailId); if…
Victory
  • 1,184
  • 2
  • 11
  • 30
2
votes
1 answer

PHP double randomised hmac verification to prevent timing attack

A way to prevent timing attacks for hash string comparison is to perform additional HMAC signing in order to randomize the verification process (see…
az2014
  • 41
  • 3
1
vote
0 answers

Reproduce a Timing Attack with Node.js

I'm trying to recreate a Timing Attack with Node.js for training purpose. I think I'm doing something wrong, because I was expecting other results. I've created a simple and basic Node app: const express = require('express'); const app =…
1
2 3