JuliaWeb / JuliaWeb/WebSockets.jl
Websockets uses insecure random for mask
- Dominant language
- Julia
- Stars
- 161
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
Consider the [this](https://github.com/JuliaWeb/WebSockets.jl/blob/207c4424b9e5ebbcc3b69de33ff66c3f43fb9c16/src/WebSockets.jl#L555) line.
Here, we use the base `rand`, which uses Mersenne twister. This is not a cryptographically secure random source.
Per [rfc6455](https://tools.ietf.org/html/rfc6455#section-5.3), "The masking key needs to be unpredictable; thus, the masking key MUST be derived from a strong source of entropy, and the masking key for a given frame MUST NOT make it simple for a server/proxy to predict the masking key for a subsequent frame."
After reading the websockets spec and the paper that lead to this requirement, this is not a severe problem. Still, would be better to fix this and use a secure random source.
A possibility could be to simply use `const CSPRNG = Random.RandomDevice()`.
Cf general discussion [here](https://github.com/JuliaLang/julia/issues/32954). Cf same issue in [HTTP.jl](https://github.com/JuliaWeb/HTTP.jl/issues/437).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.