You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the app downloads and installs the binaries to /data/user/0:
However, since Android 10 and the introduction of the W^X policy, it's not permitted to run binaries from an application's home directory in /data/user/0 (i.e. /data/data). On a rooted phone, it would be possible to install the binaries to /system/xbin to make them available system-wide. Unfortunately, oftentimes it's not an option to users to root their phone due to various reasons. However, as far as I understand, there is an alternative solution for non-rooted phones:
While exec() no longer works on files within the application home directory, it continues to be supported for files within the read-only /data/app directory. In particular, it should be possible to package the binaries into your application's native libs directory and enable android:extractNativeLibs=true, and then call exec() on the /data/app artifacts.
So what you could do, to continue to offer busybox on non-rooted phones, is to package the busybox binaries into the app as a native library. (There are a few rules regarding naming the file beginning lib and ending in .so, but that's it.) After installing the APK, due to extractNativeLibs=true, the files will be available under something like /data/app/<package name>/lib/arm/libbusybox.so to the whole system. No root required! Users can then symlink to that file or write shell scripts which include it.
Also, I've been suggesting adding this app to the F droid app store. However, a few fixes would be required to do so. For example, the busybox binaries should be built in this repository during APK building, too. So you include the busybox source code here, build busybox and include the resulting binary as a native library into your APK instead of downloading the binaries during app runtime. Also, you'd have to remove non-free libraries. See https://gitlab.com/fdroid/rfp/-/issues/2849 for more information.
Please let me know what you think. I'd appreciate it if you'd consider adding this feature.
Cheers
Ruben
The text was updated successfully, but these errors were encountered:
Wow, that's pretty sweet. I'm now on android 14 but it sounds like this is still possible on new devices too. I'm going to give it a shot. Thanks a lot for your reply, I completely forgot I even wrote this! Haha. I'll let you know how it went. Thanks again. Cheers.
Here's an update so far, I found a busybox binary and as shell user went to /data/user/0/com.android.shell, mkdir files then moved the binary from /sdcard into the files folder I created and chmod +x busybox. The only thing I haven't looked into is figuring out how to make it stick in my $PATH. This is on a Samsung S22 Android 14. Could probably run a chroot or whatever in there. Anyways, nice to know it's close to being done
Yo @wr3cckl3ss, updated telegram and now I can't login. Keeps sending a login code to my telegram so it must be logged in somehow. Looks like I'm hooped for telegram for now bud. At work so I'll try again later
Currently, the app downloads and installs the binaries to
/data/user/0
:However, since Android 10 and the introduction of the W^X policy, it's not permitted to run binaries from an application's home directory in
/data/user/0
(i.e./data/data
). On a rooted phone, it would be possible to install the binaries to/system/xbin
to make them available system-wide. Unfortunately, oftentimes it's not an option to users to root their phone due to various reasons. However, as far as I understand, there is an alternative solution for non-rooted phones:Source: https://issuetracker.google.com/issues/128554619
So what you could do, to continue to offer busybox on non-rooted phones, is to package the
busybox
binaries into the app as a native library. (There are a few rules regarding naming the file beginninglib
and ending in.so
, but that's it.) After installing the APK, due to extractNativeLibs=true, the files will be available under something like/data/app/<package name>/lib/arm/libbusybox.so
to the whole system. No root required! Users can then symlink to that file or write shell scripts which include it.Also, I've been suggesting adding this app to the F droid app store. However, a few fixes would be required to do so. For example, the busybox binaries should be built in this repository during APK building, too. So you include the busybox source code here, build busybox and include the resulting binary as a native library into your APK instead of downloading the binaries during app runtime. Also, you'd have to remove non-free libraries. See https://gitlab.com/fdroid/rfp/-/issues/2849 for more information.
Please let me know what you think. I'd appreciate it if you'd consider adding this feature.
Cheers
Ruben
The text was updated successfully, but these errors were encountered: