我运行一个用python2编写的堆栈溢出漏洞利用脚本来执行shellcode(/bin/sh),受害者程序运行/bin/sh并立即退出

问题描述 投票:0回答:0

我使用 gdb -p

pidof test
访问 gdb 进行调试 结果如图 gdbMeanwhile the python scripts are running

不知道为什么新进程马上就退出了。如果您能给我一些解决问题的想法或解决方案,我将不胜感激

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import socket
import ssl
import re
import md5
import os
import uuid
from pwn import *
context(log_level='debug',arch='amd64',os='linux')

PROTO = "udp"
SERVER_IP = "127.0.0.1"
SERVER_PORT = 5060
USERNAME = "3000"
PASSWORD = "3000"
SUBSCRIBE_USERNAME = "3000"

# default to SIP TCP
socktype = socket.SOCK_STREAM
if PROTO == "udp":
    socktype = socket.SOCK_DGRAM
sock = socket.socket(socket.AF_INET, socktype)
if PROTO == "tls":
    sock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1)

sock.connect((SERVER_IP, SERVER_PORT))
sh = remote.fromsocket(sock)

......
    
    sh.sendline(newmsg)
    sh.interactive()
    os.system("cat")
gdb
© www.soinside.com 2019 - 2024. All rights reserved.