Introduction

After fighting with many bugs to get everything to run, I finally got shellinabox to run on my Android phone!

shellinabox on android

shellinabox on android

Steps

I will probably post an updated article related on the exact steps on how to build (or just provide the executables) but the main issues were:

a) compile openssl so that libcrypto.a could be built with no-dso option (to avoid references to dlopen / etc calls which forced the Android executable to try to use bionic at runtime). Default Makefile is almost ok for static build, just CC / RUNLIB / AR need to be updated to point to arm-eabi equivalents.

b) compile openssh as Android doesn’t have /bin/login, and shellinabox would require SSH connection. Using LDFLAGS=”-static” created the static build.

c)compile shellinaboxd statically. It was difficult, as the configuration script, even if it does have options to try to create it statically, it fails and there are still references to libc.so.0. You need to statically link against libc, avoid the duplicates with warn method (between libc and launcher.c).

d) create fake /etc/passwd and /etc/group files, and use busybox’s passwd to create a root password for the phone (which is the same as the password for DroidSSHd server running already on the phone).

e) patch launcher.c to include also /system/xbin as member of PATH environment variable – I’ve submitted a bug report here: http://code.google.com/p/shellinabox/issues/detail?id=143

It works 🙂 for now but only plain HTTP connection, I will attempt to setup HTTPS whenever I find the next free timeslot.