64
votes
Why does one need a strong password on Unix?
You seem to have a pretty clear understanding of the risks. As others have stated it highly encouraged to use a strong password, so if you are running a sensitive service, then by all means, please ...
43
votes
Accepted
Is it possible for a file that is non-executable and read-only to run malicious code?
Yes, something just has to execute it. The X flag hints to the shell that it can be directly executed, but that doesn't stop other programs from executing it if they know how.
For example, if you ...
26
votes
Accepted
Unix command to generate cryptographically secure random string
No, it's not entirely secure. Let's look at each of the commands:
dd if=/dev/urandom bs=256 count=1 2> /dev/null
This will read a single 256 byte block from /dev/urandom, a cryptographically ...
22
votes
Accepted
Why should one use sudo?
There are valid convenience uses for sudo, but because they are already adequately explained in other posts, I won't elaborate on them much here. I will however point you to sudoers(5), which is the ...
18
votes
Why should one use sudo?
Aside what's mentioned by the other users, sudo also keeps the original identity of the user that's executing the command. Meaning that you can track what userid performed the command. If you are ...
17
votes
How to view all SSH authorized_keys for a unix server
To answer your questions in order:
You can see all authorized keys by running the following script with root privileges.
#!/bin/bash
for X in $(cut -f6 -d ':' /etc/passwd |sort |uniq); do
if [ -...
15
votes
How can utilities with setuid set to root be secure if they are debuggable?
Normally, when su runs, it runs setuid (as root). When you start it with gdb, the setuid bit doesn't take effect (because it's being ptraced), so even if you convince it that you entered the right ...
13
votes
Why does one need a strong password on Unix?
You do not need a strong password.
The advise about password, like so many others, is a safe default that we security professionals give because it is usually a good advise, many people (and ...
12
votes
What is the entropy of a password made with pwgen?
An exact answer would require a deeper analyzis of the pwgen source code, or a more exact measurement. But I think we can use a strong compressor to approximate the entropy. The command
pwgen 1048576|...
11
votes
Is it possible for a file that is non-executable and read-only to run malicious code?
Let's say you have the file myscript containing the following:
#!/bin/bash
echo "Hello, World!"
If you make this file executable and run it with ./myscript, then the kernel will see that the ...
9
votes
Why is linux filesystem considered DAC and not MAC
I don't think the granularity of permissions that can be achieved is relevant here. It doesn't matter if permission can be assigned to specific users, it matters which users can change permissions. ...
9
votes
Accepted
Why is linux filesystem considered DAC and not MAC
In a discretionary access control system the owner of the source decides who can access data. In a mandatory access control system an admin decides who can access data, which is then typically ...
9
votes
Accepted
Is it safe to use a unix pipe to redirect sensitive output data as input to another program?
The | is anonymous. The pipe will usually not be accessible to anyone who isn't root or the owner of one of the processes. As soon as you read the standard input and close it, the cat process will ...
8
votes
Accepted
Is `arc4random` secure enough?
Both arc4random and /dev/urandom have histories of problems. Some systems have reimplemented arc4random without RC4, but some systems kept RC4. I prefer arc4random over /dev/urandom, but if your ...
7
votes
Why does one need a strong password on Unix?
On the one hand, the fact is that you don't know. A strong password is defense in depth. Say that you (or someone else) installs an additional service that also uses Unix authentication; for example ...
6
votes
Should I compile as root?
There are two different situations:
1. You are going to run the software as root
In this case you should really trust the source code before using it. Either by auditing it, or by trusting the ...
6
votes
What is the entropy of a password made with pwgen?
The actual answer to your question is too hard for me to reasonably calculate, but I can say a few useful things about this.
pwgen does not produce passwords uniformly. Some passwords are more likely ...
6
votes
Accepted
Why is `cd` restricted in rbash/restricted bash?
By itself, this measure most probably doesn't make a lot of sense, however you have to put it aside the other limitation to understand its role, in particular (quoting the page you linked):
...
6
votes
Why does one need a strong password on Unix?
I think the question should be "Why NOT use a strong password".
In my opinion, a strong password is the foundation of any secure system. You mentioned some safeguards, but you forgot some other ...
6
votes
Accepted
Way to properly escape user input which gets run by shell_exec() in PHP?
The function escapeshellarg safely quotes a value (including escaping quotes in the name, etc) so that it can be used as an argument in a command string passed to a shell.
$user_input = $_POST['...
5
votes
Can you describe a real-life scenario of exploiting sticky bits?
Even though the OP realized that he confused the sticky bit (t) with the setuid/setgid bits (s), I want to give a "real-life scenario" for a missing sticky bit on a directory:
If you use an old-style ...
5
votes
Why should one use sudo?
To me, one of the biggest reasons to use sudo (as opposed to su) is to avoid the need to keep track of "the root password" for every server I administer, and change it every time someone who knows it ...
5
votes
Always setgroups before setuid?
This almost entirely depends on whether you're temporarily or permanently dropping privileges.
In the case of temporarily dropping privileges, it's actually ill-advised to call setgroups with a ...
5
votes
Accepted
Security of o=rwx with classical Unix permissions
This is not directly insecure, as long as these files and directories have the same owner than the parent directory, that there is no hard-link allowing to bypass the parent directory permissions and ...
5
votes
Unix Privilege Escalation: "sudo must be owned by uid 0 and have the setuid bit set"
what's to stop an attacker from compiling their own custom sudo binary that allows it to execute with any uid?
There's a basic misunderstanding going on here. The program does execute, it just stops ...
4
votes
Is mosh now recommended by the security experts? (2014)
Something to keep in mind while using MOSH... Although most of us use SSH to initiate the connection, MOSH doesn't require that to make it work (SSH only kicks off a new mosh-server on the server side ...
4
votes
Is it safe to expose a logging socket endpoint in a chrooted environment?
Let's start with what we know:
You have a process running in an isolated environment
You want that process to communicate with the logging system
It follows therefore that you need to provide some ...
4
votes
`rsync -K`-based exploit
You are correct on the use of the -K option. But the exploit is about having different users performing the link creation and running rsync. Let's first see some rsync -K in action. Make some test ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
unix × 152linux × 47
permissions × 15
operating-systems × 11
file-system × 11
passwords × 10
exploit × 9
ssh × 9
authentication × 7
access-control × 7
cryptography × 6
php × 6
attacks × 6
macos × 6
c × 6
openbsd × 6
network × 5
malware × 5
windows × 5
encryption × 4
web-application × 4
hash × 4
sudo × 4
penetration-test × 3
password-management × 3