7 ms·
Do people work under the assumption that sudo is meant to protect against malicious actors? I always considered it an administrative tool to differentiate betw
by mywittyname 6y ago
Do people work under the assumption that sudo is meant to protect against malicious actors? I always considered it an administrative tool to differentiate between authorized users and administrators. You can, for example, limit a user to only running `sudo service` so they can log in an restart a service, but not make any other changes.
I thought the general strategy was to not give daemon accounts shell access at all. Getting shell access is the hard part for a malicious actor. Once you have shell, root access is just a matter of finding a piece of unpatched software with a privilege escalation exploit out there. Plus, there's still a lot of damage you can do without root access.
- parliament32 6y ago>Plus, there's still a lot of damage you can do without root access. That's not really true. An unprivileged user shouldn't be able to take down a production system, or really adversely effect other users. Assuming you have disk quotas enabled, what else could an unprivileged user do?
- Scarbutt 6y agoDoS attack, ex: consuming CPU or RAM resources.
- bch 6y agoThat’s a class of attacks that sudo doesn’t even pretend to address. I’m not championing sudo, but consider it as one piece of a “Defense in depth” approach.
- parliament32 6y agocgroups let you limit a user's usage of system resources. Like disk quotas, you need to configure this yourself if this is a threat model you care about, but it comes out-of-the-box with all modern distros.
- mywittyname 6y agoMy line of thinking was theft or data modification. I have access to this box and it has granted me access to some other system which has useful data, like a database, NFS mount, or S3 bucket. Let me hop in here and grep for something juicy to steal, maybe flip some bits around to fuck with people, or just delete shit.
- parliament32 6y agoBut an unprivileged user can't do any of that. The entire point of unix permissions is so you can't mess with other users' files unless you've explicitly been granted permission. File owned by, say, mysql are owned by a separate "mysql" user by default.
- mywittyname 6y agoIf there are readable configuration file sitting around, then it's totally possible to get the credential for other systems. I see this stuff all the time and have leveraged t his fact for troubleshooting systems that I'm unfamiliar with.
- dependenttypes 6y ago> theft You can't steal data unless if you intentionally delete the original after copying, but then that is not really theft as any proper organisation will have backups.
- mc32 6y agoSo someone steals a book from a library isn’t theft because they have secondary copies?
- 0_gravitas 6y agoA better analogy would be photocopying all the contents of one of the books and putting it back on the shelf
- 6y ago
- dependenttypes 6y ago> An unprivileged user shouldn't be able to take down a production system How about deleting everything under /var/www/?
- parliament32 6y agoAn unprivileged user can't do that. /var/www/ will be owned either by root, or (by default on debian, depends on your distro) www-data. Your unprivileged user can't modify other users' files, that's the entire point of unix permissions.
- dependenttypes 6y agoGiven > >Plus, there's still a lot of damage you can do without root access. > That's not really true. An unprivileged user We can see that "unprivileged user" equals to anything that is not root in your post. Considering that definition www-data is an unprivileged user which can delete everything under /var/www/. So no, what you are saying is not really true.
- parliament32 6y agoBut www-data doesn't get a login shell, so it can't[1]. Obviously a user can modify their own files. The idea is if you compromise unprivileged user "scott", with their account, you can't harm other users or the system itself. [1]easily. Technically it depends, but a hardened configuration would only give www-data permissions to read files its data files in /var/www, not write them (which includes delete), apart from things it actually needs to write like its app logs (and even then you should be using syslog facilities, which only let you write, again not delete or cause any issues). Principal of least privilege and all that. For fun, try to figure out how to ssh into your system as www-data and see the half dozen different roadblocks that come up in your way.
- closeparen 6y ago>An unprivileged user shouldn't be able to take down a production system Why do these people have shell access to production systems in the first place?
- grawprog 6y ago>Do people work under the assumption that sudo is meant to protect against malicious actors? I wonder if it comes from having a windows mindset and the way windows screams at you about unauthorized software and forces you to use an administrator password for random arbitrary things while saying it's for your protection. With windows background as a single user operating system, heavily targetted by malware this makes sense. Then they come onto linux, find out they need to use sudo to install things from package managers or access files in the root directory and immediately that protecting themselves mindset comes into play. However, taking into account Linux's background as a multi-user operating system, this mindset makes less sense as the tools while working similarly at a shallow level, were designed for totally.different purposes.
- windthrown 6y ago> I wonder if it comes from having a windows mindset and the way windows screams at you about unauthorized software and forces you to use an administrator password for random arbitrary things while saying it's for your protection. As a novice Linux user, that was exactly my mindset and reasoning.
- stinos 6y agoSeeing that what you describe is a fairly recent thing in windows in the larger scale of things (assuming you talk about the UAC prompt): I'm not sure that has much to do with it. I met people working under that asumption 2 decades ago as well. random arbitrary things From what I can see that's not the case at all. In fact for me it seems rather sudo-y. Want to change system files? Need sudo / UAC. Want to install software (which is basically like the first case)? Need sudo / UAC? Want to screw up your home directory? No need for sudo, no UAC.
- snazz 6y agoDepending on your UAC protection level, you might have to enter your password for normal Settings and Control Panel changes too. Additionally, a lot of registry settings are things that should be user settings. Want to remap caps to escape? That would normally be a per-user window manager setting on Unix, but on Windows you have to use the Registry Editor.
- nix23 6y ago>Do people work under the assumption that sudo is meant to protect against malicious actors >only running `sudo service` so they can log in an restart a service, but not make any other changes So you think too, its a security measure?
- awakeasleep 6y agoYou're having trouble thinking about security, where the goal and the threat are as important as the solution. For example, a short fence can be considered a security measure, though it can be purposefully stepped over. Maybe it only serves as a guide, or maybe it protects a window from a nearby soccer field. In that same way, the sudo example you're deriding can provide the 'security' of making the proper workflows more visible to the user- without being designed to keep out a malicious professional hacker.
- dependenttypes 6y agoSudo in this instance is an easy way to allow the user to call service without giving them root access, thus a security measure. It has nothing to do with making things more visible to the user.
- snazz 6y agoWhile you're right, this might be a reasonable compromise if you trust the person. The advantage of restricting their sudo use is to make it harder for them to accidentally mess something up, not protect against a malicious user.
- dependenttypes 6y ago> The advantage of restricting their sudo use is to make it harder for them to accidentally mess something up, not protect against a malicious user. What makes you think that?
- nix23 6y agoWell sudo for me has one good point, i can see witch person did something with root-rights, a bit like a lightweight auditd, but security to me really means something else, its here or its not, correctly implemented or not (in a technical and especially in the management space)
- dheera 6y ago> I always considered it an administrative tool to differentiate between authorized users and administrators. For that you could just do alias sudo=su -c if you want the admin (root) password to be different from the user (authorized users) password. I suppose the main advantage of sudo is it gives you more granular control over which commands are allowed and which aren't. For example if you're building a robot, you can allow the robot's process access to /sbin/shutdown to be able to restart the system on remote command (or lack of remote command).
- dependenttypes 6y ago> alias sudo=su -c This will not work. sudo cp aaa bbb will work but su -c cp aaa bbb will complain that the user aaa does not exist, you need to quote them instead, like su -c "cp aaa bbb". It would make more sense to make it a script #!/bin/sh su -c "$@"
- jabirali 6y agoOr make it a shell function that operates on $@ in the same way, so you can put it in your bashrc with your aliases.
- dheera 6y agoI tried this but didn't work: ~ :) gudo () { su -c "$@"; } ~ :) gudo echo foo bar su: user foo does not exist
- jabirali 6y agoI searched it up, and apparently "$@" and expands to "foo" "bar" while "$*" expands to "foo bar", and the latter is what we want. From a quick test on my machine, that replacement in in your function definition seems to fix it :).
- TecoAndJix 6y agoThis site is good to check out when evaluating specific Sudo permissions for users - https://gtfobins.github.io/ https://gtfobins.github.io/
- m463 6y agosudo for me is anti-footshoot, but not a super-strong one: pi ALL=(ALL) NOPASSWD: ALL (I must go check my reports... "This incident will be reported.")
- AndrewKemendo 6y agoI always looked at sudo as being something between me and chmod 777 and inevitably bricking a distro.
- nemosaltat 6y agoHave done that (from root dir) out of desperation for some permissions issue I couldn’t figure out with -R flag before. 0/10 do not recommend. It’s worse than `rm -R *` because it leaves the hope of recovery.
- dTal 6y agoYes, they do work under that assumption. Just try announcing you run as root, anywhere with Linux users, and watch the pile-on.