Skip to content

Error: operand type mismatch for `pop', when trying to rewrite /usr/bin/true (64-bit) #4

Description

@mewmew

On rev b90ffd6, the following error is output when running python2 ./multiverse.py /usr/bin/true

I've uploaded a copy of the true command to https://ufile.io/nyh9c

EDIT: note, the above download link is only valid for 30 days.

Found .text
binary does not contain plt
Writing as main binary
Base address: 0x0
Generating mapping...
Starting disassembly...
Disassembly 0% complete...
[ERROR] There was an error running ['/usr/bin/as', '-64', '-o', '/tmp/pwn-asm-u2XtGd/step2', '/tmp/pwn-asm-u2XtGd/step1']:
    It had the exitcode 1.
    It had this on stdout:
    /tmp/pwn-asm-u2XtGd/step1: Assembler messages:
    /tmp/pwn-asm-u2XtGd/step1:7: Error: operand type mismatch for `pop'
    
[ERROR] An error occurred while assembling:
       1: .section .shellcode,"awx"
       2: .global _start
       3: .global __start
       4: _start:
       5: __start:
       6: .intel_syntax noprefix
       7:     pop eax
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/pwnlib/asm.py", line 665, in asm
        _run(assembler + ['-o', step2, step1])
      File "/usr/lib/python2.7/site-packages/pwnlib/asm.py", line 383, in _run
        log.error(msg)
      File "/usr/lib/python2.7/site-packages/pwnlib/log.py", line 417, in error
        raise PwnlibException(message % args)
    PwnlibException: There was an error running ['/usr/bin/as', '-64', '-o', '/tmp/pwn-asm-u2XtGd/step2', '/tmp/pwn-asm-u2XtGd/step1']:
    It had the exitcode 1.
    It had this on stdout:
    /tmp/pwn-asm-u2XtGd/step1: Assembler messages:
    /tmp/pwn-asm-u2XtGd/step1:7: Error: operand type mismatch for `pop'
    
Traceback (most recent call last):
  File "./multiverse.py", line 317, in <module>
    rewriter.rewrite(args.filename,args.arch)
  File "./multiverse.py", line 191, in rewrite
    mapping = mapper.gen_mapping()
  File "/home/u/Desktop/go/src/github.com/mewbak/multiverse/brute_force_mapper.py", line 53, in gen_mapping
    newins = self.translator.translate_one(ins,None) #In this pass, the mapping is incomplete
  File "/home/u/Desktop/go/src/github.com/mewbak/multiverse/x86_translator.py", line 24, in translate_one
    return self.translate_ret(ins,mapping)
  File "/home/u/Desktop/go/src/github.com/mewbak/multiverse/x86_translator.py", line 64, in translate_ret
    code = asm(template_before)
  File "/home/u/Desktop/go/src/github.com/mewbak/multiverse/x86_assembler.py", line 119, in asm
    code+=_asm(line)
  File "/home/u/Desktop/go/src/github.com/mewbak/multiverse/x86_assembler.py", line 28, in _asm
    code = pwn.asm(text)
  File "/usr/lib/python2.7/site-packages/pwnlib/context/__init__.py", line 1392, in setter
    return function(*a)
  File "/usr/lib/python2.7/site-packages/pwnlib/asm.py", line 710, in asm
    log.exception("An error occurred while assembling:\n%s" % lines)
  File "/usr/lib/python2.7/site-packages/pwnlib/asm.py", line 665, in asm
    _run(assembler + ['-o', step2, step1])
  File "/usr/lib/python2.7/site-packages/pwnlib/asm.py", line 383, in _run
    log.error(msg)
  File "/usr/lib/python2.7/site-packages/pwnlib/log.py", line 417, in error
    raise PwnlibException(message % args)
pwnlib.exception.PwnlibException: There was an error running ['/usr/bin/as', '-64', '-o', '/tmp/pwn-asm-u2XtGd/step2', '/tmp/pwn-asm-u2XtGd/step1']:
It had the exitcode 1.
It had this on stdout:
/tmp/pwn-asm-u2XtGd/step1: Assembler messages:
/tmp/pwn-asm-u2XtGd/step1:7: Error: operand type mismatch for `pop'

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions