symbuzzer / systemless-hosts-KernelSU-module

Required module to use applications such as AdAway on KernelSU and APatch
GNU General Public License v3.0
392 stars 15 forks source link

Module detection. #11

Closed Daerckdev closed 10 months ago

Daerckdev commented 11 months ago

After installing the latest version of the module, NativeDetector by reveny and MemoryDetector could found the mount point in /system/etc. I've tested it with ZygiskNext 133 and 141, both with and without shamiko.

symbuzzer commented 11 months ago

So what is the problem?

Daerckdev commented 11 months ago

The way the module works could be used by some applications (e.g. banking apps) to detect root, and apparently shamiko isn't able to hide it. If it's not fixable or you're not interested in it, I suggest at least adding some clarification in the README

symbuzzer commented 11 months ago

I understand now, thank you for your feedback. If there is a workaround you can suggest, I can try it @Daerckdev

Daerckdev commented 11 months ago

Not at the moment as I don't know how this detection works, I think it's something to do with the manual mount in the script, so maybe shamiko can't detect it (you can see the mount point with cat /proc/mounts). I'll have a look at it in the next few days.

Lu5ck commented 11 months ago

I am still using the already removed unmount injector by HuskyG though it is buggy now, as it can hang the device at times when you reboot it.

I am wondering if it is possible to use dynamic mount to bind mount that file just for specific apps that uses it. I am not an expert in these programming so just wondering.

symbuzzer commented 11 months ago

@Lu5ck which specific apps for example? only AdAway?

Lu5ck commented 11 months ago

@Lu5ck which specific apps for example? only AdAway?

Any apps that need to write to hosts, I assume can do it like through user config file.

But that isn't important, what's important is if dynamic mounting the hosts is possible and if possible, can it avoid detection?

Well, just throwing ideas out.

symbuzzer commented 11 months ago

Actually, the most possible solution is for Adaway to directly change the hosts file in the module.

Daerckdev commented 11 months ago

@Lu5ck The problem is that the hosts file is constantly being read by some system processes to resolve IPs. I don't think dynamic mounting would work.

symbuzzer commented 11 months ago

Can anyone test and send feedbacks new beta which builded with @Daerckdev 's PR?

systemless-hosts-KernelSU-module-beta.zip

Lu5ck commented 11 months ago

Can anyone test and send feedbacks new beta which builded with @Daerckdev 's PR?

systemless-hosts-KernelSU-module-beta.zip

doesn't work, can see ksu mounted on system/etc

@Lu5ck The problem is that the hosts file is constantly being read by some system processes to resolve IPs. I don't think dynamic mounting would work.

🤔🤔 I see HuskyDG created a dynamc mount for Revanced Youtube. From my limited guessing of what it does, it mount when system (UID below 10000) called, when youtube called, when system ui called which means all other user apps cannot see the mount.

So what if we unmount it when specific sensitive apps calls and then mount for others? I don't know programming so I can't put this theory to test.

Daerckdev commented 11 months ago

doesn't work, can see ksu mounted on system/etc

what apps can see it?

symbuzzer commented 11 months ago

Can anyone test and send feedbacks new beta which builded with @Daerckdev 's PR? systemless-hosts-KernelSU-module-beta.zip

doesn't work, can see ksu mounted on system/etc

@Lu5ck The problem is that the hosts file is constantly being read by some system processes to resolve IPs. I don't think dynamic mounting would work.

🤔🤔 I see HuskyDG created a dynamc mount for Revanced Youtube. From my limited guessing of what it does, it mount when system (UID below 10000) called, when youtube called, when system ui called which means all other user apps cannot see the mount.

So what if we unmount it when specific sensitive apps calls and then mount for others? I don't know programming so I can't put this theory to test.

It looks good in theory. But etc/hosts is not only called by AdAway. I'm sure there are dozens of service threads on the Unix system that call this, but I can't prove it.

Lu5ck commented 11 months ago

I tested the theory. Seems like hosts file need to be at all times mounted for it to work. That to say even unmount injector by HuskyDG which seemingly have a working hosts is actually not working! I guess that's why he remove the injector. Unmount injector does work for niche configurations files that don't require it to be always mounted.

Because hosts need to be mounted at all times to work, no solution will work because app will detect the mount point! That means the next best solution is to run a local DNS filter which eat battery.

Lu5ck commented 11 months ago

I am now using unmount injector by HuskyDG, I managed to resolve the problem regarding device hanging soon after bootup. All I did is modified it and move exec "$MODDIR/ksuhide" to boot-completed.sh. Unbelievably simple solution. I also can't stop using this because it actually hide every mount point related to KSU, very powerful module. I also removed the mount --bind part since that doesn't work for me.

I also found out that mount --bind works for some people but definitely not for me since my cat /system/etc/hosts show up differently from my what my file manager is seeing while browser unblocked.

  1. It can be my phone overlayfs is fucked so it bug out everything else
  2. It can be my phone is A partition so it behave differently from A/B partition phones
  3. I totally don't know what world force is at work here.

But given that mount --bind work for some people then the dynamic mount solution powered by Process Monitor Tool should also work for these people. Of course if they choose not to use unmount injector. Unfortunately, I already don't have the copy for my dynamic mounting test as I have modified further.....

As mentioned, my hosts show up different in cat and file manager, so it is fair to believe it has something to do with overlayfs. So I went a step further and play with Magical Overlayfs by HuskyDG. I mount this magical overlayfs which also unmount the kernelsu overlayfs, achieving a environment capable of toggling RW and RO. Then through the dynamic script, toggle rw when adaway is running, ro otherwise. It works, both cat and file manager show the same contents, my browser app also starting blocking the said contents.

Unfortunately, at this point, Magical Overlayfs seems to be completely hidden away, my phone now in its overlayfs. I don't know how to remove it and I am too tired to keep testing so I am gonna leave it be. What did I wanted to test further? I am unsure if Magical Overlayfs by itself is detectable by Apps or not.

LordMagnos1 commented 11 months ago

[Systemless Hosts](https://github.com/dchristl/KernelSU-systemless-hosts/releases) I found this version of Systemless Hosts that made it work without any errors 💯.NFC: now working (previously didn't work at all with the Systemless Hosts module activated).SafetyNet: Everything successful.Play Store: certified (Netflix now appears to install).Banks: working.Adaway: working, blocking ads. My modules:Play Integrity Next v14.1Systemless Hosts for KernelSU v1.0Zygisk-LSposed v1.9.2Shamiko v0.7.5Zygisk Next v4-0.8.1

Bug:Sometimes Adaway stops blocking ads on the browser (Chrome). The solution I found was to change the automatic DNS to private. I used dns.google, and Adaway started blocking ads again on Chrome.Settings > Connection and Sharing.

Lu5ck commented 11 months ago

I made Adaway Overlayfs Helper weeks ago and sharing it now because I encounter some people whose adblock not working despite adaway working. Basically, they have the same problem as me and this the only solution I found, to use magic_overlayfs and magic_proc_monitor

allisonbzk commented 7 months ago

i can confirm same problem here. as well as that https://github.com/dchristl/KernelSU-systemless-hosts/releases solves