Skip to content

Error of Segmentation fault is raised when a patched function is called where there is no print function inside the payload #2

@NaleRaphael

Description

@NaleRaphael

Steps to reproduce this issue:

  1. comment out the print function in demo/run_patched_module.py at line 61.
    # Payload to be injected
    def new_verification():
    print('... Content has been modified ...')
  2. add arbitrary code to make that function work normally. (just make sure there is no print function in it)
  3. repeat the function call modified.foo() as line 73 more than 3 times.
    # Check the output of modified function
    print('--- modified version ---')
    modified_mod = load_module_from_path('modified', osp.join(THIS_DIR, 'modified.pyc'))
    modified_mod.foo()
  4. execute demo/run_patched_module.py.

Result of execution:

  • Ubuntu 18.04, Python 3.6.9 (with gdb):
--- modified version ---
foo
foo
foo
Fatal Python error: deletion of interned string failed
KeyError: ''eyError'

Current thread 0x00007ffff7fd7740 (most recent call first):
  File "/media/nale/Data/Users/nale/project/bytejection/demo/pkg/foobarbuzz/core.py", line 8 in foo
  File "run_patch_module.py", line 78 in main
  File "run_patch_module.py", line 90 in <module>

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
  • Ubuntu 18.04, Python 3.7.4 (with gdb):
--- modified version ---
foo

Program received signal SIGSEGV, Segmentation fault.
PyFunction_NewWithQualName ()
    at /tmp/build/80754af9/python_1565725737370/work/Objects/funcobject.c:33
33	/tmp/build/80754af9/python_1565725737370/work/Objects/funcobject.c: No such file or directory.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions