What is a random number vulnerability and a fragile random number?

Source: Internet
Author: User

Computers cannot generate real random numbers without user participation.

A vulnerable random number (random number vulnerability) occurs only when the program uses a common method to generate a random number. There are two main scenarios:
1. It is not a random number.
2. the random number generated by this algorithm can be predicted, or it can be predicted in some way.

If a good random number is created, the computer must meet two conditions:
1. A good Random Number Generation Algorithm
2. the random number generation algorithm has a random and unpredictable random number seed.

Example of a random Vulnerability

Code snippet:

srand (time (0));
x=rand();

This code generates a vulnerable random number, which uses 1 as the default seed.
Anyone else who compiles this code on the same machine will get the same random number.

Random Number vulnerability:
Random number generator local Stack Overflow

Affected Systems:
Linux Kernel <2.6.22

Unaffected system:
Linux Kernel 2.6.22

Description:
Linux Kernel is the kernel used by open source Linux.

The random number generator (RNG) of Linux kernel has the stack overflow vulnerability. Local attackers may exploit this vulnerability to escalate their permissions.

If the local root user sets the default wakeup threshold value to a value greater than the output pool size, the pool transfer function may use RNG bytes to write data to the stack, triggering stack overflow, this causes a denial of service or permission escalation.

Vendor patch:
Linux
The vendor has released a patch to fix this security problem. Please download it from the vendor's homepage:
Http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.3.tar.bz2

Refer to the following English snippets
----------

What is a random number vulnerability?

Computers are deterministic and are therefore predictable. Computers cannot, in and of themselves, generate truly random numbers.

In the absense of outside input, computers can only create pseudo-random numbers.

A random number vulnerability occurs when a program uses a method of generating random numbers which is either:

  1. Not random
  2. Predictable

To generate good random numbers, the computer must have two things:

  1. A good Random Number Generation Algorithm
  2. A random and unpredicatable seed for the random number generation algorithm
Random Number vulnerability examples

Consider the following code snippet:

x=rand();

This code generated bad random numbers because when you call Rand () before a seed has been established with srand (), it uses the value 1 as a default seed. anyone else on the same machine with the same compiler who callrand () with a seed of 1 will get the same random number as you just did.

Let's look at another code snippet:

srand (time (0));
x=rand();

This Code does call srand () with the current time as a seed. However, this code is still insecure because:

  1. The system time is a very bad seed, because it is predictable within a small range.
  2. The ansi c rand () function itself does not generate good random numbers.

Let's examine a third code snippet:

srandom (time (0));
x=random();

This Code uses the BSD random () and srandom () functions, which generate much better random numbers than their ansi c predecessors. however, this code still uses time () to generate the seed number. A much better source for random numbers on BSD and Linux systems is the/dev/Random Device.

Number seeds and random number Vulnerabilities

Good Seed numbers come from unpredictable events such as user keystrokes or mouse movements. these are not perfect sources of randomness, however. human behavior is somewhat predictable and computer hardware can buffer keyboard and mouse interrupts, cing their randomness.

Numerous other random number generators are available for varous platforms and development environments. it is extremely difficult to create a good one, and even more difficult to determine if the random number generator you created really is generating random and unpredictable numbers. the best path for most applications is to implement an existing random number generator which has been subject to public cryptanalysis.

Random Number vulnerabilities are of interest to hackers when they can be utilized to determine input values to cryptographic functions. This can be utilized in cryptanalysis.

Improper use of the function CILS rand () and random () are the normal causes of random number vulnerabilities.

Additional information sources on generating random numbers

For more information on generating random numbers, read RFC 1750-Randomness recommendations for security.

Encyclopedia address: http://wiki.mygogou.com/doc-view-771.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.