Docsity

Cybersecurity Techniques: Nmap, Backtrack, Nessus, and SQL Injection, Study notes of Computer Science

Partial preview of the text

Download Cybersecurity Techniques: Nmap, Backtrack, Nessus, and SQL Injection and more Study notes Computer Science in PDF only on Docsity!

Introduction

●

Physical Security

●

Scanning with nmap

●

Backtrack

●

V ulnerability assessment with nessus

●

M etasploit Framework

●

SQL Injection

●

Protecting A gainst SQL Injection

●

Conclusion

Physical Security

●

Physical security is one of the most important aspects of

computer security and one of the most over looked aspects.

●

Control access to all machines. (If someone can get their

physical hands on a computer, consider it hacked).

● Don’t trust someone just because they sound ‘legit’.

Simple Nmap port scan

Nmap common options

●

-h Nmap help

●

-sS TCP SY N scan

●

-sT TCP connect() scan

●

-sU UCP port scan

●

-v verbose output

●

-vv very verbose output

●

-O operating system detection (TCP/IP

fingerprinting)

●

-sV service version detection

●

-p scans a specified port range

●

-F fast scan: scans only ports in the nmap-services

file

●

-n D on't do reverse D NS lookups

Nessus

● (^) Nessus is arguably one of the best network vulnerability assessment analyzers. ● (^) Nessus is released under the GPL and is designed to automate the testing and discovery of known security problems. A llowing system administrators to correct problems before they are exploited. ● (^) Nessus uses a client/server design that allows the user to set up one nessus server that has multiple nessus clients that can attach and initiate vulnerability scans.

B ackTrack and Nessus

● (^) One of the tools that BackTrack comes with is Nessus. ● ● (^) First thing you will want to do is update the plugins for nessus. Open up a konsole and then type nessus-update-plugins ● ● (^) A fter this is done, to start nessus just type “start-nessus” ● ● (^) Y ou will be given the default server to login to: in BackTrack the default login is auditor/auditor. ● ● (^) Then just pick the options you want and the host(s) you wish to scan and start the assessment. ● ●A fter the scan is done, you will be given a list of the vulnerabilities and warnings on the computer. ● ●Nessus flash tutorial using A uditor: ●http://www.irongeek.com/i.php?page=videos/nessus

M icrosoft Sequel Server 2000

● (^) M SSQl runs on TCP port 1433 and UDP port 1434. ● ● (^) With a default install, microsoft leaves the administrator password as blank... sa/. ● ● (^) With the default install, microsoft also has 2 example databases that are installed, both of which have their own flaws (northwind and pubs). Need to delete these. ● ● (^) A great site talking about M SSQL security is http://sqlsecurity.com/ ● ● (^) This site has also made a lockdown.sql script that aids administrators in locking down the sql server.

M SSQL Stored Procedures

● (^) A stored procedure is a set of SQL statements that can be stored in the server. ● ● (^) xp_cmdshell is used to execute commands on the underlying operating system. In order to access this, you must first be a systems administrator (by default), however, if your sa password gets compromised (weak password or leave it blank...), the attacker can use this stored procedure to do anything they wish to the database A ND the computer (or computers if this database links to other databases...)

SQL Injection (continued)

● (^) Example: Suppose we are at a website that prompts us to enter our username and password to login. ● ● (^) Instead of entering something that the database might expect, we instead enter as the username something like: ● ● (^) ‘darth'; update tblusers set password='hacker" where username='darth"’ and then enter anything they like for the password ● ●In a vulnerable database, the SQL query may look something like the following: ● ●"SELECT * FROM tblusers WHERE username= 'darth'; ● (^) update tblusers set password='hacker" where username='darth" ● ●This would change darth’s password to hacker. Now he can easily log into the database.

SQL Injection (continued)

● (^) Since we know that this type of attack is allowed. We could also inject the database using any stored procedures that we like. ● ● (^) This time instead of changing the password, say we want to totally hack the server. A ll we would have to do is use the xp_cmdshell stored procedure to execute commands on the server.

Protecting against SQL Injection

● (^) Sanitize the input: What this means is to remove everything but known good data. ● ● (^) For example: in an email, you would likely only allow the following characters to be entered: a-z,A-Z,0-9,@ ,.,-,_, and +. ● ●Escape/Quotesafe the input: Add an extra apostraphe if you see an apostraphe. ● ●Use bound parameters (the PREPARE statement) ●In this technique, an SQL statement string is created with placeholders - a question mark for each parameter - and it's compiled ("prepared", in SQL parlance) into an internal form.

Protecting SQL Injection (continued)

● (^) Example in perl: $sth = $dbh->prepare("SELECT email, userid FROM members WHERE email = ?;"); $sth->execute($email); ● (^) Here, $email is the data obtained from the user's form, and it is passed as positional parameter #1 (the first question mark), and at no point do the contents of this variable have anything to do with SQL statement parsing. Quotes, semicolons, backslashes, SQL comment notation - none of this has any impact, because it's "just data". There simply is nothing to subvert, so the application is be largely immune to SQL injection attacks.

Resources

●SQL Injection tutorials ●http://www.samspublishing.com/articles/article.asp?p=30124&seqNum=3&rl= ●http://www.unixwiz.net/techtips/sql-injection.html ●Nmap homepage ●http://www.insecure.org/nmap ●Nessus homepage ●http://www.nessus.org/ ●BackTrack homepage ●http://www.remote-exploit.org/index.php/M ain_Page ●M etasploit framework homepage ●http://www.metasploit.com/projects/Framework/downloads.html ● (^) M etasploit framework GUI flash tutorial ● (^) http://www.irongeek.com/i.php?page=videos/metasploit ●Nessus flash tutorial using A uditor: ●http://www.irongeek.com/i.php?page=videos/nessus