Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault loading arm binary files on termux #1367

Closed
delmarocks opened this issue Nov 13, 2019 · 39 comments
Closed

Segmentation fault loading arm binary files on termux #1367

delmarocks opened this issue Nov 13, 2019 · 39 comments
Labels
mystery This is really suspicious and probably related to something totally unrelated

Comments

@delmarocks
Copy link

Whenever i tried to load the binary on my environment using ELF it crashes and i got segmentation fault. What's the reason behind this? Is there any way to get this work on my device?

@Arusekk
Copy link
Member

Arusekk commented Nov 13, 2019

Wow, this is unsettling. Is the file you open big? Can you open other files, or does it crash for every binary (e.g. /bin/sh)? What are other scenarios that break or others that work fine?

@delmarocks
Copy link
Author

No the files is just a small binary. Even using checksec pwntools always gives me segmentation fault

@delmarocks
Copy link
Author

Even "/bin/sh" cant be loaded

@delmarocks
Copy link
Author

My python is 32 bit. I think thats the reason why. Is there any way pwntools can be used in 32 bit arch?

@delmarocks
Copy link
Author

Here's my device architecture.

@Arusekk
Copy link
Member

Arusekk commented Nov 14, 2019

Does it also happen when you use just python3 instead of ipython? Could you run it through pdb/gdb and post some backtrace of the crash?

@delmarocks
Copy link
Author

Yes it does with every binary i want to use. unfortunately my gdb is not compiled with python.

@delmarocks
Copy link
Author

@Arusekk
Copy link
Member

Arusekk commented Nov 14, 2019

Sorry to see that. Pwntools do not officialy support anything besides a linux/*BSD environment on x86-64, but from what your crash looks like I can't tell why this doesn't work for you.

@delmarocks
Copy link
Author

delmarocks commented Nov 14, 2019

How do i produce the crash report?

@Arusekk
Copy link
Member

Arusekk commented Nov 14, 2019

Problably if you ran gdb --args python3 script.py, the backtrace at crash could be helpful

@delmarocks
Copy link
Author

@delmarocks
Copy link
Author

delmarocks commented Nov 14, 2019

Is that correct?

@delmarocks
Copy link
Author

The output is the same even just using python3 instead of ipython

@zachriggle
Copy link
Member

zachriggle commented Nov 14, 2019 via email

@delmarocks
Copy link
Author

My device does not support 64 bit. Is it possible to make 32 bit as host OS

@Arusekk
Copy link
Member

Arusekk commented Nov 14, 2019

Please run the program in gdb again (this image), type run in the interactive session and when it breaks, type bt screen

@delmarocks
Copy link
Author

@Arusekk this is the crash

@Arusekk
Copy link
Member

Arusekk commented Nov 14, 2019 via email

@delmarocks
Copy link
Author

@Arusekk this is the output continuing execution. What does it mean?


@Arusekk
Copy link
Member

Arusekk commented Nov 14, 2019

That's what I meant, but now please type bt to get the backtrace (you can even create a core dump, that would be the most helpful, but I don't remeber how was the command named)

@delmarocks
Copy link
Author

delmarocks commented Nov 14, 2019

@Arusekk this is the backtrace. Sorry im just a noob when it comes to this situation.

This is the core file 👈

@zachriggle
Copy link
Member

zachriggle commented Nov 14, 2019 via email

@delmarocks
Copy link
Author

delmarocks commented Nov 15, 2019

@zachriggle yes i am using termux. I wonder if pwntools can support android platforms as it is easy to to create exploits with pwntools while on the go😊😊

@delmarocks
Copy link
Author

Here is the sample exploit i created for ROP

@delmarocks
Copy link
Author

@Arusekk does pwntools support android platform?

@Arusekk
Copy link
Member

Arusekk commented Nov 15, 2019

While technically being a linux flavor, android is vastly different even when it comes to coreutils and such, so I don't know for sure. But a grand majority should work fine.

@delmarocks
Copy link
Author

@Arusekk so what should i do base on the crash i sent to you to make this work on my device

@ghost
Copy link

ghost commented Nov 17, 2019

Screenshot_20191118-062641
@delmarocks you should try using Gcloud instead of Termux App because your device does not Support Pwntools 32bit Python & Your device Architechture....

@ghost
Copy link

ghost commented Nov 17, 2019

Screenshot_20191118-063152

@ghost
Copy link

ghost commented Nov 17, 2019

Screenshot_20191118-065048

@delmarocks
Copy link
Author

@0xEscxtt how did you setup pwntools on gcloud?

@ghost
Copy link

ghost commented Nov 18, 2019

@delmarocks how did you setup pwntools on gcloud?

pip2 install pwntools

@delmarocks
Copy link
Author

@0xEscxtt is gcloud available as package in termux repo?

@ghost
Copy link

ghost commented Nov 18, 2019

@delmarocks is gcloud available as package in termux repo?

yes same as Termux because Gcloud uses Debian OS same a Standard APT resources...

@ghost
Copy link

ghost commented Nov 18, 2019

ask the Termux maintainer If you want to add Gcloud as a package toolkit via pkg...

@ghost
Copy link

ghost commented Nov 18, 2019

@delmarocks take a Look at this
https://github.com/philips/termux

@delmarocks
Copy link
Author

@0xEscxtt thanks I'll try this out

@Arusekk Arusekk added the mystery This is really suspicious and probably related to something totally unrelated label Jan 16, 2020
@Arusekk
Copy link
Member

Arusekk commented Nov 3, 2020

Closing this as I cannot reproduce, termux does not run on my ancient android. If you still have the issue, and manage to install debugging symbols (termux does not seem to have any, but here is a guide https://wiki.ubuntu.com/Debug_Symbol_Packages) or build python from source, and then post the output of something like:

gdb -ex r -ex bt --args python3 -c 'from pwn import*; ELF("./vuln")'

@Arusekk Arusekk closed this as completed Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mystery This is really suspicious and probably related to something totally unrelated
Projects
None yet
Development

No branches or pull requests

3 participants