Skip to content
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

Masking is not cryptographically secure #334

Closed
danielgrad opened this issue Mar 22, 2024 · 1 comment · Fixed by #335
Closed

Masking is not cryptographically secure #334

danielgrad opened this issue Mar 22, 2024 · 1 comment · Fixed by #335

Comments

@danielgrad
Copy link
Contributor

The random number generator used for masking frames is not cryptographically secure:

final _random = Random();

final maskBytes = [
_random.nextInt(256),
_random.nextInt(256),
_random.nextInt(256),
_random.nextInt(256)
];
header.setRange(index, index + 4, maskBytes);

This is a security concern (CWE-331), and deviates from RFC 6455 section 10.3:

Clients MUST choose a new masking key for each frame, using an
algorithm that cannot be predicted by end applications that provide
data. For example, each masking could be drawn from a
cryptographically strong random number generator.

@brianquinlan
Copy link
Contributor

This has been fixed in dart:io for over 7 years but it looks like the change never made it here despite the last import being 6 years ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants