Archive for the ‘ Security ’ Category

Got hacked, back up

It finally happened, my server was hacked.  The attacker was on a path of destruction and simply destroyed all of my data and locked me out of the server.  Fortunately, I keep good backups.  Unfortunately, I’ve been busy with a new job so I haven’t been able to restore any of it until today

Notes:

I believe this attack was initiated by a former co-worker, as the timing for the intrusion lines up directly with my leaving my old position.  This leads me to believe that the server/sites were not necessarily mis-configured or vulnerable, rather a former manager / co-worker who knew some of my common passwords simply logged in and destroyed my data.

It also could have been a Steam phisher that I upset a few months back.  He messaged me a link to his phishing page saying that I would receive a free game for logging in.  I immediately knew what was going on and started taunting the phisher and then ddosed his phishing page.  The attacker very well could be related.

However, this is no execuse.  I broke one of the basic first rules of web security, use different passwords for everything.  Now, all services and users have their own unique password….so far….so good.

Debian/Ubuntu Anti-Virus and Root Kit Scan Script

A customer requested this script, once I started working on it I realized how useful this could be. I have this setup on a weekly CRON task. The script is very simple, it updates ClamAV and RKHunter then scans the server with both and mails the results to the specified email address. If you plan on adding this script to your server, you might want to ensure that you have the correct versions of ClamAV and RKHunter.

Click here to download the script

Click Here to see the full post with install instructions

Use NMAP To Detect Conficker

I found this gem of an Nmap command yesterday. I was unable to write about this nifty command because my site was offline. But I’m back now!

Important Notes:

You will need to download the latest version of nmap from insecure.org, or you can click here

The command:

nmap -PN -T4 -p139,445 -n -v --script=smb-check-vulns --script-args safe=1 [targetnetworks]

Just remove [targetnetworks] and replace that value with the subnet you wish to scan. Since my gateway is 192.168.1.1, I altered the command to scan my network to look like the following:

nmap -PN -T4 -p139,445 -n -v --script=smb-check-vulns --script-args safe=1 192.168.1.*

Analyze the output:

A clean machine should report at the bottom: “Conficker: Likely CLEAN”, while likely infected machines say: “Conficker: Likely INFECTED”. For more advice, see this nmap-dev post by Brandon Enright.

Plesk Hack: Email and FTP Usernames and Passwords

I wrote this simple script for work. This script allows us to gather all the username and password information on the server to let us troubleshoot faster. This is an early version of the script, I plan on added more functionality to improve the speed of troubleshooting. This script was not intended for malicious purposes, please do not use it for such.

Edit: It looks like a few people out there have been publishing my code without attribution.  I really don’t mind if you post my code, but please give me credit.  The one I’ve found didn’t even change the header (with my full name in it) of the script or the “doneskies” at the end.  Have some class and give me proper attribution.

Click Here to see the script

Quick SSH Tunnel Script

I wrote this script for a friend who needs to get around a work firewall. The script uses Plink to create an SSH tunnel to a server of your choice.

I haven’t added any error handling in it, but I like how it integrates FTP in a batch script. For this script to work, you’ll need at least one server with both FTP and SSH enabled. Make sure to lock down both accounts that you use in the script, and you’ll need to make sure that plink.exe is accessible in the root of the FTP account.

Click Here to check it out

Auto Ban Brute Force Attempts

This script was just handed to me by a friend, every sever with SSH access should have this script installed. This script will automatically ban an IP address that fails to authenticate after 3 attempts. You can change the ban duration with a simple command line option.

Click Here to check it out.