I wrote my first buffer overflow exploit and it worked well with

./vulnerable $(cat payload)

but when I tried to launch it from a Python shell it didn't work

import os
os.system("./vulnerable $(cat payload)")

This does a segmentation fault. Can someone explain why? Is there a difference in the memory when it's launched in different environments?

  • Have you checked out how Python handles os.system?
    – schroeder
    Jan 18, 2022 at 23:54

1 Answer 1


Are you using a reliable pivot, like jmp esp or are you jumping to a fixed address on the stack? If you're using the latter then your addresses are likely misaligned, and you should consider using a reliable pivot instead. If the former you'll need to inspect the crash by enabling coredumps and loding the core into a debugger.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .