How To Patch and Protect Linux Kernel Stack Clash Vulnerability CVE-2017-1000364 [ 19/June/2017 ]

Avery serious security problem has been found in the Linux kernel called “The Stack Clash.” It can be exploited by attackers to corrupt memory and execute arbitrary code. An attacker could leverage this with another vulnerability to execute arbitrary code and gain administrative/root account privileges. How do I fix this problem on Linux? The Qualys Research Labs discovered various problems in the dynamic linker of the GNU C Library (CVE-2017-1000366) which allow local privilege escalation by clashing the stack including Linux kernel. This bug affects Linux, OpenBSD, NetBSD, FreeBSD and Solaris, on i386 and amd64. It can be exploited by attackers to corrupt memory and execute arbitrary code. What is CVE-2017-1000364 bug? From RHN: A flaw was found in the way memory was being allocated on the stack for user space binaries. If heap (or different memory region) and stack memory regions were adjacent to each other, an attacker could use this flaw to jump over the stack guard gap,

read more How To Patch and Protect Linux Kernel Stack Clash Vulnerability CVE-2017-1000364 [ 19/June/2017 ]

Cpustat – Monitors CPU Utilization by Running Processes in Linux

Cpustat is a powerful system performance measure program for Linux, written using Go programming language. It attempts to reveal CPU utilization and saturation in an effective way, using The Utilization Saturation and Errors (USE) Method (a methodology for analyzing the performance of any system). It extracts higher frequency samples of every process being executed on the system and then summarizes these samples at a lower frequency. For instance, it can measure every process every 200ms and summarize these samples every 5 seconds, including min/average/max values for certain metrics. Cpustat outputs data in two possible ways: a pure text list of the summary interval and a colorful scrolling dashboard of each sample. How to Install Cpustat in Linux You must have Go (GoLang) installed on your Linux system in order to use cpustat, click on the link below to follow the GoLang installation steps that is if you do not have it installed: Install GoLang (Go Programming Language) in Linux Once

read more Cpustat – Monitors CPU Utilization by Running Processes in Linux

Linux security alert: Bug in sudo’s get_process_ttyname() [ CVE-2017-1000367 ]

Skip to contCa There is a serious vulnerability in sudo command that grants root access to anyone with a shell account. It works on SELinux enabled systems such as CentOS/RHEL and others too. A local user with privileges to execute commands via sudo could use this flaw to escalate their privileges to root. Patch your system as soon as possible.It was discovered that Sudo did not properly parse the contents of /proc/[pid]/stat when attempting to determine its controlling tty. A local attacker in some configurations could possibly use this to overwrite any file on the filesystem, bypassing intended permissions or gain root shell.From the description We discovered a vulnerability in Sudo’s get_process_ttyname() for Linux:this function opens “/proc/[pid]/stat” (man proc) and reads the device number of the tty from field 7 (tty_nr). Unfortunately, these fields are space-separated and field 2 (comm, the filename of the command) cancontain spaces (CVE-2017-1000367). For example, if we execute Sudo through the symlink “./ 1 “, get_process_ttyname()

read more Linux security alert: Bug in sudo’s get_process_ttyname() [ CVE-2017-1000367 ]

Impermanence in Linux – Exclusive (By Hari Iyer)

Impermanence, also called Anicca or Anitya, is one of the essential doctrines and a part of three marks of existence in Buddhism The doctrine asserts that all of conditioned existence, without exception, is “transient, evanescent, inconstant” On Linux, the root of all randomness is something called the kernel entropy pool. This is a large (4,096 bit) number kept privately in the kernel’s memory. There are 24096 possibilities for this number so it can contain up to 4,096 bits of entropy. There is one caveat – the kernel needs to be able to fill that memory from a source with 4,096 bits of entropy. And that’s the hard part: finding that much randomness. The entropy pool is used in two ways: random numbers are generated from it and it is replenished with entropy by the kernel. When random numbers are generated from the pool the entropy of the pool is diminished (because the person receiving the random number has some information about the

read more Impermanence in Linux – Exclusive (By Hari Iyer)

10 Important “rsync” command – UNIX

Rsync (Remote Sync) is a most commonly used command for copying and synchronizing files and directories remotely as well as locally in Linux/Unix systems. With the help of rsync command you can copy and synchronize your data remotely and locally across directories, across disks and networks, perform data backups and mirroring between two Linux machines. This article explains 10 basic and advanced usage of the rsync command to transfer your files remotely and locally in Linux based machines. You don’t need to be root user to run rsync command. Some advantages and features of Rsync command It efficiently copies and sync files to or from a remote system. Supports copying links, devices, owners, groups and permissions. It’s faster than scp (Secure Copy) because rsync uses remote-update protocol which allows to transfer just the differences between two sets of files. First time, it copies the whole content of a file or a directory from source to destination but from next time,

read more 10 Important “rsync” command – UNIX

Fork: retry: Resource temporarily unavailable

Issue:  It was reported that a particular application user is not able to Login. Troubleshoot: 1. Tried Logging to the system with root user it was fine. 2. Tried to switich user it failed with an Error “Write Failed; Broken Pipe” 3. Created a file and it was working. 4. Tried switch the user. This time it goes through. 5. Tried running some jobs with the user. It throws an error saying “fork: retry: Resource temporarily unavailable”. 6. Then checked the “/etc/security/limits.d/90-nproc.conf” file to find out that all the users are given nproc limit as 1024. Resolution: 1. Changed it to a higher value and it solved the issue. 2. I changed the value to 4096.

How to use parallel ssh (PSSH) for executing ssh in parallel on a number of Linux/Unix/BSD servers

Recently I come across a nice little nifty tool called pssh to run a single command on multiple Linux / UNIX / BSD servers. You can easily increase your productivy with this SSH tool. More about pssh pssh is a command line tool for executing ssh in parallel on some hosts. It specialties includes: Sending input to all of the processes Inputting a password to ssh Saving output to files IT/sysadmin taks automation such as patching servers Timing out and more Let us see how to install and use pssh on Linux and Unix-like system. Installation You can install pssh as per your Linux and Unix variant. Once package installed, you can get parallel versions of the openssh tools. Included in the installation: Parallel ssh (pssh command) Parallel scp (pscp command ) Parallel rsync (prsync command) Parallel nuke (pnuke command) Parallel slurp (pslurp command) Install pssh on Debian/Ubuntu Linux Type the following apt-get command/apt command to install pssh: $ sudo

read more How to use parallel ssh (PSSH) for executing ssh in parallel on a number of Linux/Unix/BSD servers

30 Shades of “Alias” Command – UNIX

You can define various types aliases as follows to save time and increase productivity. #1: Control ls command output The ls command lists directory contents and you can colorize the output: ## Colorize the ls output ## alias ls=’ls –color=auto’   ## Use a long listing format ## alias ll=’ls -la’   ## Show hidden files ## alias l.=’ls -d .* –color=auto’ #2: Control cd command behavior ## get rid of command not found ## alias cd..=’cd ..’   ## a quick way to get out of current directory ## alias ..=’cd ..’ alias …=’cd ../../../’ alias ….=’cd ../../../../’ alias …..=’cd ../../../../’ alias .4=’cd ../../../../’ alias .5=’cd ../../../../..’ #3: Control grep command output grep command is a command-line utility for searching plain-text files for lines matching a regular expression: ## Colorize the grep command output for ease of use (good for log files)## alias grep=’grep –color=auto’ alias egrep=’egrep –color=auto’ alias fgrep=’fgrep –color=auto’ #4: Start calculator with math support alias bc=’bc

read more 30 Shades of “Alias” Command – UNIX

Linux – Concepts – IPTABLES v/s FIREWALLD

Today we will walk through iptables and firewalld and we will learn about the history of these two along with installation & how we can configure these for our Linux distributions. Let’s begin wihtout wasting further more time. What is iptables? First, we need to know what is iptables. Most of senior IT professionals knows about it and used to work with it as well. Iptables is an application / program that allows a user to configure the security or firewall security tables provided by the Linux kernel firewall and the chains so that a user can add / remove firewall rules to it accordingly to meet his / her security requirements. Iptables uses different kernel modules and different protocols so that user can take the best out of it. As for example, iptables is used for IPv4 ( IP version 4/32 bit ) and ip6tables for IPv6 ( IP version 6/64 bit ) for both tcp and udp. Normally, iptables rules

read more Linux – Concepts – IPTABLES v/s FIREWALLD

Linux – Concepts – Ulimits & Sysctl

ulimit and sysctl The ulimit and sysctl programs allow to limit system-wide resource use. This can help a lot in system administration, e.g. when a user starts too many processes and therefore makes the system unresponsive for other users. Code Listing 1: ulimit example # ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited pending signals (-i) 8191 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 8191 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited All these settings can be manipulated. A good example is this bash forkbomb that forks as many processes as possible and can crash systems where no user limits are set: Warning: Do not run this in a shell! If no

read more Linux – Concepts – Ulimits & Sysctl