You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some programs close all non-standard file descriptors when creating a fork process to make some kind of a sandbox and to limit the attack surface. Unfortunately, this forces s2n-tls to stuck in the s2n_rand_urandom_impl loop if the library was already initialized in the parent process and when the child process tries to establish TLS connection, because the library expects entropy_fd to still be a valid file descriptor pointing to the /dev/urandom. In the best case the process is just stuck forever receiving EBADF errors, in the worst case RNG is initialized with some data stolen from another file descriptor.
getrandom() function can be used instead of the file descriptor.
Library can stop caching entropy_fd and properly open and close /dev/urandom for every reseeding.
This behavior can be documented and clear instructions can be provided what is the proper way of working this around (including for users of AWS SDK).
Implications of each solution should be evaluated and the best fitting one should be implemented.
Does this change what S2N sends over the wire? It changes which random numbers are used in cryptography in the described case of the file descriptor misuse (or if something is send at all). If /dev/urandom file descriptor is not closed by the code outside of this library, nothing changes.
Does this change any public APIs? No.
Which versions of TLS will this impact? Any.
Requirements / Acceptance Criteria:
s2n-tls should properly process errors during read of entropy_fd.
Users of the library should understand how to safely close file descriptors if they are required to take some action to fix this issue.
Problem:
Some programs close all non-standard file descriptors when creating a fork process to make some kind of a sandbox and to limit the attack surface. Unfortunately, this forces s2n-tls to stuck in the
s2n_rand_urandom_impl
loop if the library was already initialized in the parent process and when the child process tries to establish TLS connection, because the library expectsentropy_fd
to still be a valid file descriptor pointing to the/dev/urandom
. In the best case the process is just stuck forever receivingEBADF
errors, in the worst case RNG is initialized with some data stolen from another file descriptor.Solution:
There are several ways to fix this:
getrandom()
function can be used instead of the file descriptor.entropy_fd
and properly open and close/dev/urandom
for every reseeding.Implications of each solution should be evaluated and the best fitting one should be implemented.
/dev/urandom
file descriptor is not closed by the code outside of this library, nothing changes.Requirements / Acceptance Criteria:
s2n-tls should properly process errors during
read
ofentropy_fd
.Users of the library should understand how to safely close file descriptors if they are required to take some action to fix this issue.
The text was updated successfully, but these errors were encountered: