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

Victim disconnects when in sleep mode #152

Open
3 of 4 tasks
timingobituary opened this issue Aug 29, 2022 · 35 comments
Open
3 of 4 tasks

Victim disconnects when in sleep mode #152

timingobituary opened this issue Aug 29, 2022 · 35 comments
Assignees
Labels
Bug: Client Something isn't working right with the client Status: Updates Required Updates are required to fix this issue

Comments

@timingobituary
Copy link

timingobituary commented Aug 29, 2022

This is an issue with the

  • AhMyth Client

Describe the bug

I have a victim connected to the victims lab, however whenever the victim puts its device in sleep mode(i.e. phone is still on but screen off) then after 30 seconds of idle waiting the victim disconnects.
The victim doesn't disconnect if I keep using the victims lab, doing stuff like getting files or call logs, etc.
This happens on 2 different devices (android 11 & 12)

To Reproduce

Steps to reproduce the behavior:

  1. Install standalone payload
  2. Connect victim
  3. Turn off the victim's screen
  4. Wait for ~30 seconds
  5. Victim disconnects

Expected behavior

I would've expected the connection to remain even after putting the device in sleep mode.

Client Issue

please complete the following information:

  • Android Version: Android 11 & 12

Checklist

  • Is this really an issue?
  • Have I looked at previous issues to see if this has already been addressed?
  • Have I used some initiative to try and solve the issue myself?
@Morsmalleo
Copy link
Owner

Morsmalleo commented Aug 29, 2022

Wow this is a new one, I'm glad you brought this to my attention because we can't have this happening, so this is actually a Client issue, so can you tell me what sort of Payload you built, was it a standalone payload 🐞 or a Bound Payload 🪲 (Payload templated with an original APK) ?

@Morsmalleo Morsmalleo added the Error: Client something went wrong with the client label Aug 29, 2022
@timingobituary
Copy link
Author

Yeah I was wondering whether or not this was a client or server side problem. I have updated the issue description.

The payload I used was the standalone payload

@Morsmalleo
Copy link
Owner

Yeah I was wondering whether or not this was a client or server side problem. I have updated the issue description.

The payload I used was the standalone payload

Yes I seem to be getting the same thing, I will do some research on this, and I will post back here ASAP.

@timingobituary
Copy link
Author

Great! Thanks for the quick response, at the very least it is good that the bug is reproducible. Let me know if you need something else

@Morsmalleo Morsmalleo added the Bug: Client Something isn't working right with the client label Sep 1, 2022
@Morsmalleo
Copy link
Owner

Morsmalleo commented Sep 16, 2022

Great! Thanks for the quick response, at the very least it is good that the bug is reproducible. Let me know if you need something else

Ok I'm back, so sorry it took me so long, but I think I've figured out the problem.... so with socket.io client java which is what the AhMyth client uses for connections back to the AhMyth Server, the connections are known to drop when the android device idles and goes to sleep or when put on sleep mode by the user. I've seen this happen in a few devices but not many, namely Samsung and Vivo devices, but even then only some.

I am currently working on a fix I've found and will get back to you once again once it's done and tested

@timingobituary
Copy link
Author

Great! Thanks for the quick response, at the very least it is good that the bug is reproducible. Let me know if you need something else

Ok I'm back, so sorry it took me so long, but I think I've figured out the problem.... so with socket.io client java which is what the AhMyth client uses for connections back to the AhMyth Server, the connections are known to drop when the android device idles and goes to sleep or when put on sleep mode by the user. I've seen this happen in a few devices but not many, namely Samsung and Vivo devices, but even then only some.

I am currently working on a fix I've found and will get back to you once again once it's done and tested

No problem, take your time! Thanks for updating

@airwilb
Copy link

airwilb commented Sep 28, 2022

Had the exact same issue, really appreciate that you're still working on this and updating things accordingly!

@Morsmalleo
Copy link
Owner

Had the exact same issue, really appreciate that you're still working on this and updating things accordingly!

You're most welcome, if anyone has an issue, I work hard to resolve it, and if the issue is caused by bugs, I'll fix it no matter how long it takes

@airwilb
Copy link

airwilb commented Oct 7, 2022

I wonder if this bug is specific to certain devices. I was testing out the connection on a tablet I have Xiaomi pad 5 Android 11 and I'm not disconnecting in sleep mode. Could be because I'm connected over wifi but thought I should mention this in case it helps @Morsmalleo

Edit: never mind it just lasted a lot longer before disconnecting unlike other devices I've tried in sleep mode. Probably has to do with certain devices entering sleep mode quicker. Disregard my comment lol

@Morsmalleo Morsmalleo added Status: Updates Required Updates are required to fix this issue and removed Error: Client something went wrong with the client labels Oct 14, 2022
@Morsmalleo
Copy link
Owner

Morsmalleo commented Oct 17, 2022

I think I've figured out the problem, from my research things like this happen due to battery optimisation, if we ignore battery optimisation then we shouldn't experience this problem!

We can't keep a socket app, or for that matter, any app that requires large amounts of power, alive forever on a battery-powered mobile device, doing so would kill the phone's battery!

This is why battery optimisation was officially implemented for Android 6.0 Marshmallow and above, simply because it would only take 1 poorly misbehaved app to completely drain an android phones battery.

Battery optimisation is supposedly at its highest when the phone is in sleep mode according to my research, so ignoring battery optimisation for the client should solve the problem, I'll get to work on this ASAP

@airwilb
Copy link

airwilb commented Oct 17, 2022

I think I've figured out the problem, from my research things like this happen due to battery optimisation, if we ignore battery optimisation then we shouldn't experience this problem!

We can't keep a socket app, or for that matter, any app that requires large amounts of power, alive forever on a battery-powered mobile device, doing so would kill the phone's battery!

This is why battery optimisation was officially implemented for Android 6.0 Marshmallow and above, simply because it would only take 1 poorly misbehaved app to completely drain an android phones battery.

Battery optimisation is supposedly at its highest when the phone is in sleep mode according to my research, so ignoring battery optimisation for the client should solve the problem, I'll get to work on this ASAP

I thought battery optimization might be the issue here, so on the target device after the APK is installed I've gone into the app settings and turned off battery optimization for that app. Connections will remain for longer periods but eventually they still disconnect at a certain point once the phone is in sleep mode

@timingobituary
Copy link
Author

Yeah I can confirm that disabling battery optimization allows the connection to last much longer! I have tried 1 hour for now and that seems to work on my android 11 device.

@Morsmalleo
Copy link
Owner

This is good I will implement something that will hopefully allow full ignorance of battery optimisation

@Morsmalleo
Copy link
Owner

I'll let everyone know once this is done

Repository owner deleted a comment from airwilb Nov 10, 2022
Repository owner deleted a comment from airwilb Nov 10, 2022
Repository owner deleted a comment from airwilb Nov 10, 2022
Repository owner deleted a comment from comodoro64 Nov 10, 2022
Repository owner deleted a comment from comodoro64 Nov 10, 2022
Repository owner deleted a comment from airwilb Nov 10, 2022
Repository owner deleted a comment from comodoro64 Nov 10, 2022
Repository owner deleted a comment from airwilb Nov 10, 2022
Repository owner deleted a comment from airwilb Nov 10, 2022
Repository owner deleted a comment from airwilb Nov 10, 2022
Repository owner deleted a comment from airwilb Nov 10, 2022
@SubUrban23
Copy link

Any update on this topic?

@Morsmalleo
Copy link
Owner

Any update on this topic?

Updates for this one will begin soon

@nyctophiliac0
Copy link

It also occur in oppo mobile phone

@Morsmalleo
Copy link
Owner

Morsmalleo commented May 1, 2023 via email

@nyctophiliac0
Copy link

Please try to fix it

@Morsmalleo
Copy link
Owner

Please try to fix it

I'll fix it when I have the time, I'm not superman, I'm only one person doing all these updates, so be patient please

@timingobituary
Copy link
Author

I'll fix it when I have the time, I'm not superman, I'm only one person doing all these updates, so be patient please
Please take your time! I'm more than happy to see that you're keeping this project alive

@Morsmalleo
Copy link
Owner

could not implement the fixes for this in beta.5, but I'm jumping on to this issue in the next few weeks.

@timingobituary
Copy link
Author

Hi, has there been any update on this issue?

@mbarekTrismegistus
Copy link

mbarekTrismegistus commented Jun 11, 2024

hi i have the same issue, any news on this ?, it disconnect when i take a pic or access files or put phone on sleep, and it reconnect again after a while, sometimes it works and get some files but is disconnect

@SubUrban23
Copy link

hi i have the same issue, any news on this ?, it disconnect when i take a pic or access files or put phone on sleep, and it reconnect again after a while, sometimes it works and get some files but is disconnect

sorry friend, this project is already dead

@Morsmalleo
Copy link
Owner

hi i have the same issue, any news on this ?, it disconnect when i take a pic or access files or put phone on sleep, and it reconnect again after a while, sometimes it works and get some files but is disconnect

sorry friend, this project is already dead

The project is not dead actually, so don't be salty.

Why don't you head on over to the development branch and then navigate to .github/Dev and you'll see the progress I'm making as well as why shit takes so long on this repo!!

@Morsmalleo
Copy link
Owner

hi i have the same issue, any news on this ?, it disconnect when i take a pic or access files or put phone on sleep, and it reconnect again after a while, sometimes it works and get some files but is disconnect

Setup AhMyth using the source code the binaries do not contain any of the recent fixes I made a few months ago.

Disabling Battery Optimisation helps as well, and this is already an open issue as well.

I'm working on it, just give me time.

@Morsmalleo
Copy link
Owner

Morsmalleo commented Jun 12, 2024

hi i have the same issue, any news on this ?, it disconnect when i take a pic or access files or put phone on sleep, and it reconnect again after a while, sometimes it works and get some files but is disconnect

sorry friend, this project is already dead

Why don't you try maintaining a project like this by yourself then tell me what a dead repo looks like again.

Get salty on my repo like this again @SubUrban23 and you will be banned for 72 hours

@mbarekTrismegistus
Copy link

hi i have the same issue, any news on this ?, it disconnect when i take a pic or access files or put phone on sleep, and it reconnect again after a while, sometimes it works and get some files but is disconnect

Setup AhMyth using the source code the binaries do not contain any of the recent fixes I made a few months ago.

Disabling Battery Optimisation helps as well, and this is already an open issue as well.

I'm working on it, just give me time.

exactly, i disabled power saving mode and gives the app permission over battery optimization and now it disconnect sometimes but reconnect after a bit of time, I think asking for user permission to ignore battery optimization would really be helpful

@mbarekTrismegistus
Copy link

and also the the permission to stay alive on the background because i also noticed that after a 30 minute it stops reconnecting

@Morsmalleo
Copy link
Owner

Morsmalleo commented Jun 12, 2024 via email

@mbarekTrismegistus
Copy link

yes I disabled it but it still disconnect and reconnect, i guess this depend on my phone, because i only have the these options , i will try on another phone and i will return
Screenshot_20240612-103200

@mbarekTrismegistus
Copy link

i tried to add this <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
to the manifest file but it seems that the app dont ask for the permission, im not a mobile dev lol, im just a full stack web dev, but i think as the original payload is for older versions of android this permission wont work, so i guess you will have a lot of work on this one, and good luck, and if u ever needed help ask me for it and ill try to do my best to help :3

@Morsmalleo
Copy link
Owner

i tried to add this <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> to the manifest file but it seems that the app dont ask for the permission, im not a mobile dev lol, im just a full stack web dev, but i think as the original payload is for older versions of android this permission wont work, so i guess you will have a lot of work on this one, and good luck, and if u ever needed help ask me for it and ill try to do my best to help :3

Disabling Battery Optimisations should do the trick however if you're testing on any android version higher than 5.1 you'll be greeted with problems, this will happen until I've finished building the new modern payload

@mbarekTrismegistus
Copy link

i tried to add this <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> to the manifest file but it seems that the app dont ask for the permission, im not a mobile dev lol, im just a full stack web dev, but i think as the original payload is for older versions of android this permission wont work, so i guess you will have a lot of work on this one, and good luck, and if u ever needed help ask me for it and ill try to do my best to help :3

Disabling Battery Optimisations should do the trick however if you're testing on any android version higher than 5.1 you'll be greeted with problems, this will happen until I've finished building the new modern payload

good luck man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Client Something isn't working right with the client Status: Updates Required Updates are required to fix this issue
Projects
None yet
Development

No branches or pull requests

6 participants