#!/bin/sh
#!/bin/bash
View Shell version
Bash--version
Bash vulnerability
The Bash vulnerability is a vulnerability in software that controls the command prompt for a Linux computer. exploiting this vulnerability, an attacker could take over the entire operating system of a computer, access confidential information, make changes to the system, and so on. Anyone's computer system, if you use bash software, you need to patch it up immediately.
This burst of bash vulnerability is that bash handles such "function environment variables" and does not end with the function End "}", but executes the subsequent shell commands! For example
Envx= ' () {:;}; Echovulnerable ' Bash-c "Echothisisatest"
If you return
Vulnerable
This is a test
If such a result, please upgrade as soon as possible
echo $USER (System variable)
Defining global Variables in/etc/profile
source/path/file.sh =. /path/file.sh is different from sh
You can bring the variables in the current script to the current shell
Vim a.sh
#!/bin/sh
Source/etc/init.d/functions
Action "It is a test Deamon"/bin/true
Troubleshooting commands
Dmesg
Cat/var/log/message
Script Cleanup/var/log/messages
#!/bin/sh
User=0
dir=/var/log/
If ["$USER"-ne "$UID"]then
echo "You must root"
Exit 1
Fi
CD $DIR
Cat/dev/null >messages && echo "It is clear"
Exit 0
Bash Learning ahead