Skip to content

Commit

Permalink
favor SecureRandom.bytes over Rex::Text.rand_text_alphanumeric
Browse files Browse the repository at this point in the history
Co-authored-by: adfoster-r7 <[email protected]>
  • Loading branch information
sfewer-r7 and adfoster-r7 authored Jan 24, 2025
1 parent de6b14e commit 4c0f407
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/msf/core/exploit/remote/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def connect(opts={})
# @return [Rex::Proto::Http::WebSocket::Interface]
def connect_ws(opts={}, timeout = 20)
# As per the spec (RFC6455 Section 11.3.1), a Sec-WebSocket-Key is a 16 byte value that has been Base64 encoded.
ws_key = Rex::Text.encode_base64(Rex::Text.rand_text_alphanumeric(16))
ws_key = Rex::Text.encode_base64(SecureRandom.bytes(16))
opts['headers'] = opts.fetch('headers', {}).merge({
'Connection' => 'Upgrade',
'Upgrade' => 'WebSocket',
Expand Down

0 comments on commit 4c0f407

Please sign in to comment.