Skip to content

Fix ssl wrap socket python314#21302

Open
VISHVAJITH-REDDY wants to merge 2 commits intorapid7:masterfrom
VISHVAJITH-REDDY:fix-ssl-wrap-socket-python314
Open

Fix ssl wrap socket python314#21302
VISHVAJITH-REDDY wants to merge 2 commits intorapid7:masterfrom
VISHVAJITH-REDDY:fix-ssl-wrap-socket-python314

Conversation

@VISHVAJITH-REDDY
Copy link
Copy Markdown

Fixes #21301

ssl.wrap_socket() was removed in Python 3.12 (deprecated since 3.7), causing an
AttributeError on Python 3.12+ including 3.14.

Replaces it with SSLContext.wrap_socket() using a getattr fallback chain that
works across Python 2.7.9 through 3.14+ without deprecation warnings.

Files changed

  • modules/payloads/singles/cmd/unix/reverse_python_ssl.rb
  • modules/payloads/singles/python/shell_reverse_tcp_ssl.rb

Verification

  1. Start msfconsole
  2. use exploit/multi/handler
  3. set payload cmd/unix/reverse_python_ssl
  4. set LHOST <your IP>
  5. set LPORT 4444
  6. run
  7. On target: run the generated command with Python 3.14
  8. Verify a shell session opens (previously crashed with AttributeError)
  9. Repeat with payload python/shell_reverse_tcp_ssl
  10. Verify same fix works on Python 2.7 / 3.4+ targets too

Updated SSL handling in reverse TCP shell payload to use SSLContext for compatibility with newer Python versions.
@jeanmtr
Copy link
Copy Markdown
Contributor

jeanmtr commented Apr 15, 2026

python/meterpreter/reverse_tcp_ssl is also affected.

@VISHVAJITH-REDDY
Copy link
Copy Markdown
Author

I've also fixed lib/msf/core/payload/python/reverse_tcp_ssl.rb in my fork
but I see @jeanmtr has opened #21303 with a broader fix. Happy to defer to
that PR or add the mixin fix to this one if preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

cmd/unix/reverse_python_ssl Fails on Python 3.14

3 participants