What to Do When You Cannot Chmod Chmod
When you cannot chmod chmod? what to do? This might help to re-instate permission back.
Here are following techniques where you can use chmod to change permission when chmod itself is not executable.
The first technique is to use rsync where you copy the chmod binary into another location with adding permission to file being copied.
Another way is one of my favorites where you first use setfacl to set executable permission to chmod for the owner, then use the owner permission to set permission to groups and others.
Using dynamic linker:
Third one is the easiest of them all. Using dynamic linker.
Since most of the linux system are pre built with perl, we can use perl to execute command which can be used to change permission.
Another method is using busybox. It is a software which provides various linux/unix utilities in a file.
Using dd and chown
We can change permission for chmod using dd and chown which is used to convert and copy files.
If you are very good in python then you can set it up using python script with os module and execute it from there to change permission.
Burrowing permission from other executable
This this step we are basically borrowing permission from another executable file.
Using install we can use to copy file from source to destination with modified permission.
Also. some of the commands are executed with sudo privilege. If you don’t have it then make sure you first run some privilege escalation techniques. One of which is to use an exploit dirtycow.