3 ms·
> (It's similar to persuading a Linux user to unpack a tarball over /etc) Would this allow for arbitrary code execution? Curious as a Linux amateur
by jjice 4y ago
> (It's similar to persuading a Linux user to unpack a tarball over /etc)
Would this allow for arbitrary code execution? Curious as a Linux amateur
- blibble 4y agoyou could put a cron entry by dumping a file into /etc/cron.d/ run any command as any user once a minute
- JonathonW 4y agoOr put something into /etc/profile.d and run at every shell startup, or put something into /etc/ld.so.conf.d and inject code into every process started on the system, or put something into /etc/init.d and run at every boot... (continue ad infinitum) If you let code overwrite the files that make up your system configuration, you're going to have a Bad Time on any OS; this isn't somehow specific to Windows and the registry.
- entropie 4y ago/etc/inittab You could probably replace the executables for the ttys, potentially having a keylogger for every userinput on the terminal?
- mananaysiempre 4y agoSure; the list of startup services is maintained there, for one (in one of a number of ways), but a variety of programs allow the administrator to configure hooks to execute when something happens as well. Then there are lists of variables that are in fact shell scripts, names of users’ configured shells, mount options, kernel modules, ... . Arbitrary code execution immediately (as opposed to after next reboot or at least a service’s configuration being reloaded) seems harder, but I expect it to be possible as well. ETA: Took a couple of minutes, huh. A sibling comment mentions the dynamic linker, which apparently maintains a cache of well-known library locations in /etc. This yields execution as soon as a new dynamically linked executable is started, which probably qualifies as immediate. (More care would be required to avoid breaking the system in the process, though.)