Disable/Remove root access on Android - android

Is it possible to disable or remove the root access programmatically on Android? Thank you

A "user" (vs "userdebug" or "eng") build of official Android sources does not feature any sort of root access as a designed feature.
This is what you normally get on a production end-user device from a name brand vendor. In contrast, it is not uncommon for cheap devices of uncertain origin to ship with one of the other build varieties (though that is not necessarily a bad thing, as such half-finished builds often have flaws you need this capability to fix).
Of course nearly any software project has the potentially to be intentionally exploited, and someone's modified customization of Android could include anything under the sun, but those are different topics and far too broad for Stack Overflow where questions must be specific.
In terms of removing exploits or escalation toolkits installed as part of a custom ROM - to remove them, you would have to ask a question that was specific about what they were and how they worked. It is likely however that you would need to have the capability to make lasting changes to the system partition, something that can be as much about hardware locking and bootloader/recovery capabilities as it is about having root access after a complete boot (root can't make a lasting change if the flash is locked; conversely, if you can write to the flash without booting the normal system, root matters less).

Related

How to enable flight mode with root android 7?

Interested in such a question. Everywhere I read that on android 7 it is programmatically impossible to turn off flight mode. And they write that if there is a root, then everything can be done. And I see that there are programs that allow you to programmatically enable flight mode (Tasker for example).
Question
How the root helps turn on flight mode. Do we have access to new features? Or there is editing files (adding scripts). Describe in the general process, if possible, at least a general idea.
With root, you get access to modify system files. It is usually due to this that many apps do not work if you have a root. Generally speaking, when you have the ability to modify these system files, you or any other app can make any change to your device.
I really suggest that you go visit xda. You will find a massive community that is super interested with this kind of stuff. The community there is very well versed with rooting and custom ROMs which I believe you may find interesting based on your question.

Is it possible to write applications on android using only C?

Now wait just one moment before you mark this as a duplicate, because this is a very specific question.
I'm not asking if you can write an application using another language which is a binding using the NDK; what I want to know is:
At a hardware level, how does dalvik interact with the Linux kernel on android devices?
The answer to (1) as I understand it, is that because android is fundamentally a Linux system, this is done via syscalls. Which is to say, at some level the davlik/art VM must interact with the C Linux kernel through a C API.
If you had root permission on a device, why could you not do the same thing from a native system binary?
So, certainly it would be a painful experience, but technically is there any reason why it would not be possible to write an application purely in C, without using the android run-time at all?
(Note: Not without the run-time; obviously the run-time must be present to do various things like device initialization; but a stand alone binary that did not interact with the run-time).
(I can think of a few reasons why this might be the case, specifically the run-time requiring exclusive hardware access to various hardware, but I can't find any specific documentation about it)
It is possible, this is how daemons work on Android (think RILD for example). However you cannot gain access to the Android facilities (graphics, location, etc) as there is no API from C.
Note that in order to speak to the Android API, your process needs to be a child of zygote. If you spawn a process from an ADB shell, or from init you will not be a fork() of zygote and will not have direct access to the JVM.

How to grant root access to a specific application from source code instead of rooting the ROM?

I'm compiling an Android ROM from source, and I have one application that I want it to be pre-installed and have it run with root permission.
How can I grant root access to this specific application, without rooting entire ROM?
Hopefully you don't need root...
Typical stock Android ROMs provide root privileges to very few things, in line with the principle of least privilege. Instead, apps are granted the precise permissions they need.
Why exactly do you need this app to have root permissions? You should first look through the list of all the internal unpublished Android permissions to see if one of them does what you want. Since you're building a system app, you can even use signature permissions which are not normally available to other apps. You just need to ensure that your app is signed by the key with which you build the Android ROM - you can then distribute it with the ROM or separately, and it will still have access to the permissions you require.
The advantages of doing it this way are:
If your app is compromised or buggy, the effects are limited.
Your actual Java code has these permissions so there's no need to craft fiddly command lines.
So if you can possibly do your task this way, do.
But if you really do...
If you really do need root, then things get tricky.
You have three options. In order of preference:
Add a new system service.
Add some alternative setuid-root binary which does just what you need.
Modify the su binary to check exactly who is calling it.
If you really do need root, then I would add a new system service. This can run as root. You would then add suitable extra APIs so that your app can call into it - and the permissions can be signature-level so that only your system app can call it. This is the architecturally 'correct' way to do it in Android-land.
The second or third options involve creating some command-line tool which does what you want, but I don't know a secure way for such a tool to check who is calling it. It may be acceptable to allow any app to call this functionality. If so, a new setuid-root executable might be the way to go. However, as I say, I don't know a way to stop other apps running it.

Can we make something like comodo firewall in Android?

AFAIK, one might need to work on the low level linux to do this job or use theorem provers to anlayze programs without having to understanding the underlying programs. In addition, AFAIK each program is controlled in its own sandbox so that it does not affect other programs.
However, during the past year, researchers have demonstrated that they could "borrow" permission from other programs even if their programs did not initially ask for them. This unfortunately makes Android much less trustworthy as its security model is essentially permission-based at install time ONLY. I guess one way to ensure that this kind of attacks (I mean malicously acquiring permissions a program should not have had) would be to monitor inter-programs communications and in real time.
Since dalvik is not open source, and neither is Android itself (apart from open API's), can anyone think of a way, using Java only, to implement a dynamic and realtime firewall in Android that would at least ensure no program can start another without our explicit permission each time (more like how comodo firewall works)?
Thank you very much
Before making any software you might have complete understanding about the functionality of that software. You are trying to make software like comodo firewall then you must know that how comodo firewall works, how it block any software activity, how it monitor network activity and many other activity that comodo firewall can do. if you don't have basic understanding about that then first understand it then think next..
Download it from here and understand it..
http://www.filekb.com/windows/download-comodo-firewall/

How to use libudev on android

As a part of low-level monitoring application, that needs to monitor some changes in sysfs I should use udev interface instead of inotify. It's pretty clear that most of android devices, and all devices that I really need to run this application on, are using udev for enumerating devices and apply policies. The standard way to interact with udev from C-application is to use libudev (libudev.h), but there is no libudev.so in /lib directory and no include directory at all. So I need to get ARM port of this library or do some workaround here. Please, help me with this problem, since I'm not good in cross-compiling and libudev specific questions.
Note: I have root access on all devices, that I going to run this application on.

Categories

Resources