-1
$\begingroup$

How can I write a program in python to predict the random key (urandom) that is used for encryption? I tried to search and I couldn’t find anything related to guessing and predicting urandom in python

$\endgroup$
1
  • 1
    $\begingroup$ The fact that the question is about "writing a program", in a specified language (and one rather not adapted to the task, which likely would involve acquiring side-channel data), towards attacking a highly system-specific and version-specific Operating System component, all without specifying these, leads me to the conclusion that this question is off-topic. $\endgroup$
    – fgrieu
    Apr 20, 2022 at 21:59

2 Answers 2

3
$\begingroup$

We hope that's impossible; urandom is supposed to use a cryptographically strong random number generator, and so (without the internal rng state) we hope that you can't do it.

$\endgroup$
2
$\begingroup$

It might be possible to write a program that has some success with this if the program executes a side-channel attack on the underlying pseudorandom generator of /dev/urandom. If the system that we are running on is starved of entropy (think headless server without a hardware random number generator), it is not inconceivable that a process running on the same system might be able to gather side-channel information (from process timing or any other internal sensors available to it) that allows reconstructing the state of the internal RBG and maybe some of the data that is being mixed into the entropy pool from outside. It could then use that information to predict the pseudorandom output of the generator.

However, doing this would still easily qualify as a research project and if successful (even to a modest degree, for instance showing an ability to predict some RBG output in an entropy-starved laboratory setting after one initial good seeding of the state) it would likely yield a nice paper. Until someone writes that paper, there is no certainty that something like this is doable. Given that, the chances of finding an implementation of such an attack on the internet are currently effectively zero.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.