pwnlib.exception.PwnlibException:必须指定内核架构

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

嗨,我在 Intel arch 上有一个 32 位小端可执行文件,所以我使用 context.binary 并尝试 context.arch = vax 来解决这个问题,但两者都不起作用,我该怎么办? 代码如下:

from pwn import *

context.binary = binary = ELF("./vuln3-32")
rop = ROP(binary)
rop.execve('/bin/sh')

非常简单,只需调用 execve 即可打开 shellcode。有任何想法吗?我现在会尝试不同的 context.archs。

python-3.x binaryfiles elf 32-bit pwntools
1个回答
0
投票

您必须指定

context.kernel
才能为 pwntools 提供有关您的运行环境的更多信息:它是在 32 位内核上执行的 32 位 ELF 还是在 64 位内核上执行?

你可以在“pwnlib/rop/srop.py”中看到它:

    @LocalContext
    def __init__(self):
        if context.kernel is None and context.arch == 'i386':
            log.error("kernel architecture must be specified")

        self.arch = context.arch
        self.endian = context.endian
        self._regs = [self.registers[i] for i in sorted(self.registers.keys())]
        self.update({r:0 for r in self._regs})
        self.size = len(bytes(self))
        self.update(defaults[self.arch])

        if context.arch == 'i386' and context.kernel == 'amd64':
            self.update(defaults['i386_on_amd64'])
© www.soinside.com 2019 - 2024. All rights reserved.