Questions tagged [security]

Content related to computer security., i.e. content about policies, mechanisms, etc. needed make sure data is not leaked or corrupted and services available in all circumstances.

Filter by
Sorted by
Tagged with
274 votes
4 answers

Security implications of forgetting to quote a variable in bash/POSIX shells

If you've been following for a while, you should hopefully know by now that leaving a variable unquoted in list context (as in echo $var) in Bourne/POSIX shells (zsh being the ...
Stéphane Chazelas's user avatar
265 votes
11 answers

Allow setuid on shell scripts

The setuid permission bit tells Linux to run a program with the effective user id of the owner instead of the executor: > cat setuid-test.c #include <stdio.h> #include <unistd.h> int ...
Michael Mrozek's user avatar
32 votes
1 answer

Security Implications of using unsanitized data in Shell Arithmetic evaluation

In a comment to a recent question, Stéphane Chazelas mentions that there are security implications to double parentheses arithmetic such as: x=$((1-$x)) on most shells. My Google skills seem to be ...
garethTheRed's user avatar
113 votes
3 answers

Why is there a big delay after entering a wrong password?

I notice a weird (well, according to me) thing about passwords. For example, if I type an incorrect password during login, there will be a few seconds' delay before the system tells me so. When I try ...
phunehehe's user avatar
  • 20.3k
16 votes
1 answer

How is the authenticity of Debian packages guaranteed?

What security systems and processes are in place to prevent malicious third parties from hacking/compromising the security of code in the Debian mirrors, or to verify that the packages we get are in ...
emf's user avatar
  • 321
124 votes
2 answers

When was the shellshock (CVE-2014-6271/7169) bug introduced, and what is the patch that fully fixes it?

Some context about the bug: CVE-2014-6271 Bash supports exporting not just shell variables, but also shell functions to other bash instances, via the process environment to (indirect) child ...
Deer Hunter's user avatar
  • 1,866
134 votes
8 answers

Which is the safest way to get root privileges: sudo, su or login?

I would like to have the root account in safety even if my unprivileged user is compromised. On Ubuntu you can only use sudo for "security reasons" by default. However I am not sure it is any safer ...
stribika's user avatar
  • 5,454
125 votes
3 answers

SSH login with clear text password as a parameter? [duplicate]

I need to login to a user that I've created on a remote host running Ubuntu. I can't use an ssh key because the ssh login will happen from a bash script ran within a server that I won't have access to ...
mmla's user avatar
  • 1,377
25 votes
4 answers

How to safely use gawk's -i option or @include directive?

Using gawk -i inplace some-awk-code some-file (or @include "inplace" within an awk script) to edit a file in-place (or any other extension) is a security vulnerability. Why? How do I work ...
Stéphane Chazelas's user avatar
33 votes
2 answers

Security implications of running perl -ne '...' *

Apparently, running: perl -n -e 'some perl code' * Or find . ... -exec perl -n -e '...' {} + (same with -p instead of -n) Or perl -e 'some code using <>' * often found in one-liners ...
Stéphane Chazelas's user avatar
245 votes
8 answers

What's the difference between /sbin/nologin and /bin/false

Technically, unless pam is set up to check your shell with pam_shells neither of these can actually prevent your login, if you're not on the shell. On my system they are even different sizes, so I ...
xenoterracide's user avatar
94 votes
4 answers

Is there any way to keep a command from being added to your history?

Is there any way to keep a command from being added to your history? I have a command that I want to keep out of my history file, and I really don't care to have it there when I search the history ...
xenoterracide's user avatar
18 votes
3 answers

How can I be sure that a directory or file is actually deleted?

I know that most files, when deleted, aren't actually removed from the disk, and can be recovered later. How can I ensure that a directory I had deleted will actually be removed from the disk? Are ...
jcora's user avatar
  • 3,884
141 votes
9 answers

The myths about malware in Unix / Linux

Is it possible for my Linux box to become infected with a malware? I haven't heard of it happening to anyone I know, and I've heard quite a few times that it isn't possible. Is that true? If so, ...
Stefan's user avatar
  • 25.3k
121 votes
13 answers

How to create SHA512 password hashes on command line

In Linux I can create a SHA1 password hash using sha1pass mypassword. Is there a similar command line tool which lets me create sha512 hashes? Same question for Bcrypt and PBKDF2.
student's user avatar
  • 18.3k
19 votes
1 answer

How to use associative arrays safely inside arithmetic expressions?

A few Bourne-like shells support associative arrays: ksh93 (since 1993), zsh (since 1998), bash (since 2009), though with some differences in behaviour between the 3. A common use is for counting ...
Stéphane Chazelas's user avatar
63 votes
5 answers

Why is there no https transport for debian apt tool?

With all the paranoia that came with NSA revelations, I'm wondering why the Debian package installation mechanism does not support HTTPS for its transport, let alone use one by default. I know Debian ...
zaadeh's user avatar
  • 1,183
45 votes
7 answers

Can root/superuser read my read-protected files?

On shared unix hosting, if I have a file sensitive-data.txt and I issue: chmod 600 sensitive-data.txt Can root user still read my file? Specifically I'm wondering if it's safe to store my password ...
User's user avatar
  • 2,307
113 votes
5 answers

Why is root login via SSH so bad that everyone advises to disable it?

Everybody on the Internet advises to disable root login via SSH as it is a bad practice and a security hole in the system, but nobody explains why it is so. What is so dangerous in enabling root ...
rush's user avatar
  • 27.4k
74 votes
3 answers

How does curl protect a password from appearing in ps output?

I noticed some time ago that usernames and passwords given to curl as command line arguments don't appear in ps output (although of course they may appear in your bash history). They likewise don't ...
Wildcard's user avatar
  • 36.5k
69 votes
9 answers

How do I recursively shred an entire directory tree?

I have a directory tree that I would like to shred with the Linux 'shred' utility. Unfortunately, shred has no -R option for recursive shredding. How can I shred an entire directory tree ...
Steve V.'s user avatar
  • 945
20 votes
2 answers

How does ping work on Fedora without setuid and capabilities?

As far as I know, ping needs to create a raw socket (which needs either root access or cap_net_raw capabilities). From my understanding the trend these last years has been to remove setuid binaries ...
Antoine Catton's user avatar
16 votes
10 answers

Concern about logging in as root overrated?

For personal linux on my personal notebooks, I've usually set my environment to autologin as root even under X or lower runlevels. I've found my workflow is very pleasant and fast, without any ...
uray's user avatar
  • 3,880
9 votes
2 answers

Hide processes from other users based on groups (under Linux)?

Is it possible to configure process hiding for certain user groups under a linux system? For example: Users from group X should not see processes owned by users from group Y in ps/top or under /proc. ...
maxschlepzig's user avatar
  • 57.6k
70 votes
6 answers

Mutt: how to safely store password?

My .muttrc file looks something like this one or see below a glimpse. I am hesitant with the password. How should I store my password to use it with mutt? set imap_user = "[email protected]" set ...
user avatar
12 votes
1 answer

Log every invocation of every SUID program?

I would like to have a log file that contains an entry for every time a user runs any suid program, containing the user name, the program and any command line arguments passed to it. Is there a ...
Kim's user avatar
  • 764
103 votes
8 answers

Does /usr/sbin/nologin as a login shell serve a security purpose?

In my /etc/passwd file, I can see that the www-data user used by Apache, as well as all sorts of system users, have either /usr/sbin/nologin or /bin/false as their login shell. For example, here is a ...
Mark Amery's user avatar
  • 3,000
34 votes
2 answers

How can you log every command typed

How can you log every command someone has entered into the shell? I'm asking on both the basis of protecting yourself if you are logged into someone else's server and something breaks, or if someone ...
spuder's user avatar
  • 18.1k
22 votes
3 answers

Myth or reality: SELinux can confine the root user?

I read or heard somewhere (maybe in LinuxCBT's SELinux course; but I'm not sure) that there are online Linux servers, for which the password of the root user is also given. The Linux server is ...
Sadeq Dousti's user avatar
14 votes
2 answers

change /proc/PID/environ after process start

$ k=v p & [1] 3028 is there any way for p to change the contents of /proc/3028/environ to not mention k=v while p is still running?
Cetin Sert's user avatar
8 votes
3 answers

Securely feeding a program with a password

After understanding the problem with using a password in the command line, I need to find a way of feeding a program with a password without it being a problem (without the password being recorded ...
Dor's user avatar
  • 2,535
5 votes
2 answers

Is there a way to get security updates for wheezy after EOL

I know the best solution would be to upgrade the server after Debian wheezy has reached End Of LIfe in May 2018, but is there a way to continue running an old wheezy instance and get some minimal ...
rubo77's user avatar
  • 29k
94 votes
3 answers

How do I recover from the Heartbleed bug in OpenSSL?

CVE-2014-0160 a.k.a. Heartbleed is a vulnerability in OpenSSL. It looks scary. How do I determine whether I am affected? If I'm affected, what do I need to do? Apparently upgrading isn't enough.
Gilles 'SO- stop being evil''s user avatar
70 votes
2 answers

How to identify a process which has no pid?

I have a process which listen to 2 ports : 45136/tcp and 37208/udp (actually I assume it is the same process). But netstat doesn't return any pid : netstat -antlp | grep 45136 tcp 0 0 0.0....
John Doe's user avatar
  • 1,011
66 votes
18 answers

Root access that can't change root password?

We are having a little problem on a server. We want that some users should be able to do e.g. sudo and become root, but with the restriction that the user can't change root password. That is, a ...
244an's user avatar
  • 761
33 votes
12 answers

Erasing a Linux laptop

I have a laptop with Debian on it, and I am going to sell this laptop. Would it suffice to erase the Debian installation before selling it to completely clean up my laptop from my personal data, and ...
user avatar
28 votes
2 answers

SSH key-based authentication: known_hosts vs authorized_keys

I read about setting up ssh keys in Linux and have some questions. Correct me if I'm wrong… Let's say host tr-lgto wants to connect to host tr-mdm using ssh. If we want to be sure that it's the real ...
damluar's user avatar
  • 483
28 votes
5 answers

Block Particular Command in Linux for Specific user

How to block command, let say mkdir for specific user ? What I did just created read-only function and store in users profile ~/.bashrc /bin/mkdir() { echo "mkdir command not allow for you" ...
Rahul Patil's user avatar
  • 24.7k
27 votes
3 answers

How to safely insert USB stick/device to Linux computer?

When inserting a USB stick or device to computer, there is always the risk that the device is malicious, will act as an HID and potentially do some damage on the computer. How can I prevent this ...
Martin Heralecký's user avatar
26 votes
1 answer

Why is "nodev" in /etc/fstab so important? How can character devices be used for hacking?

I am learning about linux security and struggling to understand why a USB stick with a character device on it is potentially dangerous. If I have a USB stick with a bash executable that has setuid ...
rosix's user avatar
  • 1,013
18 votes
4 answers

File permission execute only

How can I set file to be executable only to other users but not readable/writable, the reason for this I'm executing something with my username but I don't want to give out the password. I tried : ...
c0mrade's user avatar
  • 954
16 votes
1 answer

root owned program with setuid bit on

Ping is a a program owned by root with the user id bit set. $ ls -l `which ping` -rwsr-xr-x 1 root root 35752 Nov 4 2011 /bin/ping As I understand it, if a user runs the ping process, then the ...
sashang's user avatar
  • 736
15 votes
2 answers

Are there security consequences from not giving printf a format to use?

A well-formed printf usually has a format to use: $ var="Hello" $ printf '%s\n' "$var" Hello However, what could be the security implications of not providing a format? $ printf &...
user avatar
15 votes
7 answers

vsftpd fails pam authentication

Moving a tried-and-true vsftpd configuration onto a new server with Fedora 16, I ran into a problem. All seems to go as it should, but user authentication fails. I cannot find any entry in any log ...
KateYoak's user avatar
  • 735
12 votes
2 answers

How to get Oracle java 7 to work with setcap cap_net_bind_service+ep

I am trying to grant the java executable the right to open ports below 1024 on Linux. Here is the setup /home/test/java contains the Oracle Server JRE 7.0.25 CentOS 6.4 Here is what getcap returns [...
ams's user avatar
  • 1,358
12 votes
1 answer

How to enable user_namespaces in the kernel? (For unprivileged `unshare`.)

My Linux kernel must have been configured with user_namespaces when built, but their use is restricted after boot and has to be explicitly enabled. Which sysctl should I use? (If this was turned on, ...
imz -- Ivan Zakharyaschev's user avatar
6 votes
1 answer

What should I check after an unauthorized access?

I accidentally left an open port on my router, leaving access to one of my computers via SSH, using a rather insecure password. I noticed because I checked /var/log/auth.log and there is just one ...
Tomas's user avatar
  • 1,044
1 vote
1 answer

How to get a working clock on Debian? Clock is off by a couple minutes (time accuracy)

How to get a working clock in Debian 9 with KDE? My clock is almost 10 minutes slow on multiple of my machines running Debian 9 with KDE and (re)setting the timezone via tzselect didn't work. (I ...
mYnDstrEAm's user avatar
  • 4,168
70 votes
6 answers

Why does reboot and poweroff require root privileges? [duplicate]

To restart or shut off Linux from the terminal, one can use reboot and poweroff, respectively. However, both of these commands require root privileges. Why is this so? What security risk is posed by ...
Rohan's user avatar
  • 3,571
69 votes
6 answers

Moving /var, /home to separate partition

I am attempting to move some folders (such as /var and /home) to a separate partition after reading this guide: 3.2.1 Choose an intelligent partition scheme I was able to move one folder ...
toffee.beanns's user avatar

2 3 4 5