-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CWE-330: Use of Insufficiently Random Values Documentation #698
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: ebakrra <bartlomiej.karas@ericsson.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated main readme.md !
Loads of empty lines with a single space. Please install black, format code and C&P into readme.md.
Suggest to update the MT to the publication, that is assuming the existing reference did not provide any more insights.
some formatting issues
Updated the blank spaces. Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Co-authored-by: myteron <myteron@gmail.com> Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Co-authored-by: myteron <myteron@gmail.com> Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Co-authored-by: myteron <myteron@gmail.com> Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Co-authored-by: myteron <myteron@gmail.com> Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Co-authored-by: myteron <myteron@gmail.com> Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some formatting issues
docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-330/compliant01.py
Outdated
Show resolved
Hide resolved
Signed-off-by: myteron <myteron@gmail.com>
Signed-off-by: myteron <myteron@gmail.com>
Signed-off-by: myteron <myteron@gmail.com>
Signed-off-by: myteron <myteron@gmail.com>
Signed-off-by: myteron <myteron@gmail.com>
Signed-off-by: myteron <myteron@gmail.com>
…communicate via review Signed-off-by: Helge Wehder <helge.wehder@ericsson.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All formatting fixed. no major content changes as such, only added sonar ref back in.
Co-authored-by: Hubert Daniszewski <61824500+s19110@users.noreply.github.com> Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Co-authored-by: Hubert Daniszewski <61824500+s19110@users.noreply.github.com> Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Co-authored-by: Hubert Daniszewski <61824500+s19110@users.noreply.github.com> Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Co-authored-by: Hubert Daniszewski <61824500+s19110@users.noreply.github.com> Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Had one too many blank lines! Signed-off-by: BartyBoi1128 <58297160+BartyBoi1128@users.noreply.github.com>
Python's `random` module is a standard library module that provides functions to generate pseudorandom numbers for various distributions. This module can lead to a vulnerability due to its predictability. The random module is based on the Mersenne Twister `MT19937` | ||
[[MATSUMOTO, NISHIMURA 1998](https://dl.acm.org/doi/pdf/10.1145/272991.272995)], which is a deterministic algorithm, that, given a particular input, will always produce the same output [[Wikipedia 2024](https://en.wikipedia.org/wiki/Deterministic_algorithm)]. An attacker knowing or guessing the seed value can predict the entire sequence of the pseudorandom numbers. This also means that if two `Random` class objects are created using an identical seed, they will generate the same sequence of numbers, regardless of the Python environment. | ||
|
||
Therefore, the `random` module is unsuitable for applications requiring high security as it does not incorporate cryptographic randomness, which means it is not resistant to reverse engineering. Its limited entropy makes it easier for attackers to deduce the internal state of the generator and predict future outputs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Therefore, the `random` module is unsuitable for applications requiring high security as it does not incorporate cryptographic randomness, which means it is not resistant to reverse engineering. Its limited entropy makes it easier for attackers to deduce the internal state of the generator and predict future outputs. | |
Therefore, the `random` module is unsuitable for applications requiring security as it does not incorporate cryptographic randomness, which means it is predictable. Its use makes it easy for attackers to deduce the internal state of the generator and predict future outputs. | |
"Reverse engineering" isn't the issue. The problem is that you're using the wrong algorithm.
|
||
Therefore, the `random` module is unsuitable for applications requiring high security as it does not incorporate cryptographic randomness, which means it is not resistant to reverse engineering. Its limited entropy makes it easier for attackers to deduce the internal state of the generator and predict future outputs. | ||
|
||
Instead, for generating random numbers, it is recommended to use a more robust option, such as Python's `secrets` module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, for generating random numbers, it is recommended to use a more robust option, such as Python's `secrets` module. | |
Instead, for generating random numbers for security purposes, use an appropriate option, such as Python's `secrets` module. | |
The random
algorithm is robust, it's just robustly wrong when you use it for the wrong purpose.
Documentation for CWE-330, and a few minor code changes