Skip to content

Commit a3b22b7

Browse files
authored
Throw error when using sni and setting server_hostname manually in remote (#2482)
* Throw error when using `sni` and setting `server_hostname` manually in `remote` Prevents silently replacing the `server_hostname` that was provided in `ssl_args`. Fixes #2425 * Update CHANGELOG
1 parent 584ecca commit a3b22b7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ The table below shows which release corresponds to each branch, and what date th
8181
- [#2470][2470] Fix waiting for gdb under WSL2
8282
- [#2479][2479] Support extracting libraries from Docker image in `pwn template`
8383
- [#2483][2483] Only print `checksec` output of `ELF.libc` when it was printed for the `ELF` already
84+
- [#2482][2482] Throw error when using `sni` and setting `server_hostname` manually in `remote`
8485

8586
[2471]: https://github.com/Gallopsled/pwntools/pull/2471
8687
[2358]: https://github.com/Gallopsled/pwntools/pull/2358
@@ -90,6 +91,7 @@ The table below shows which release corresponds to each branch, and what date th
9091
[2470]: https://github.com/Gallopsled/pwntools/pull/2470
9192
[2479]: https://github.com/Gallopsled/pwntools/pull/2479
9293
[2483]: https://github.com/Gallopsled/pwntools/pull/2483
94+
[2482]: https://github.com/Gallopsled/pwntools/pull/2482
9395

9496
## 4.14.0 (`beta`)
9597

pwnlib/tubes/remote.py

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def __init__(self, host, port,
8989
import ssl as _ssl
9090

9191
ssl_args = ssl_args or {}
92+
if "server_hostname" in ssl_args and sni:
93+
log.error("sni and server_hostname cannot be set at the same time")
9294
ssl_context = ssl_context or _ssl.SSLContext(_ssl.PROTOCOL_TLSv1_2)
9395
if isinstance(sni, str):
9496
ssl_args["server_hostname"] = sni

0 commit comments

Comments
 (0)