Skip to content

Commit

Permalink
Throw error when using sni and setting server_hostname manually i…
Browse files Browse the repository at this point in the history
…n `remote`

Prevents silently replacing the `server_hostname` that was provided in `ssl_args`.

Fixes #2425
  • Loading branch information
peace-maker committed Oct 3, 2024
1 parent b08f4b7 commit 171be55
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pwnlib/tubes/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def __init__(self, host, port,
import ssl as _ssl

ssl_args = ssl_args or {}
if "server_hostname" in ssl_args and sni:
log.error("sni and server_hostname cannot be set at the same time")
ssl_context = ssl_context or _ssl.SSLContext(_ssl.PROTOCOL_TLSv1_2)
if isinstance(sni, str):
ssl_args["server_hostname"] = sni
Expand Down

0 comments on commit 171be55

Please sign in to comment.