CYBV 301 Week 2 Lecture
CYBV 301 Week 2 Lecture
Week 2
You can’t always access the functions you want via the GUI
The GUI doesn't always tell the truth
When you turn something off – it doesn't always go or stay off
DASH - the Almquist shell (also known as A Shell, ash and sh) is a lightweight Unix shell originally written
by Kenneth Almquist in the late 1980s. Initially a clone of the System V.4 variant of the Bourne shell, it
replaced the original Bourne shell in the BSD versions of Unix released in the early 1990s.
Windows
Cmd.exe - Command Prompt, also known as cmd.exe or cmd (after its executable file name), is the command-
line interpreter on Windows operating systems.
PowerShell - PowerShell (including Windows PowerShell and PowerShellCore) is a task automation and
configuration management framework from Microsoft, consisting of a command-line shell and associated
scripting language built on the .NET Framework.
Linux
Linux File Structure
One root
One tree
Different distributions
Slight variations
Navigation in Linux (1 of 7)
Some Important Linux Notes
Linux is case sensitive - “Desktop” is not the same as “desktop”
You can use tab autocomplete in Linux – typing is hard
The Absolute Pathname tells about the complete path to a certain file or
directory
Example: The shadow-sample-2.txt file on your system has an absolute pathname as follows:
/home/student/samples/shadow-sample-2.txt
Absolute file names start with a slash because the slash indicates the root
directory followed by the filesystem tree directory by directory
The slash is also used to separate the directories within a path
The dot (.) and two dots (..) represent the working directory and the
parent directory respectively.
Navigation in Linux (2 of 7)
The Command Prompt
~#
Running as root
Full privileges
Very dangerous
Can run any command Running as root
So can any malware or attacker! Running as root
Navigation in Linux (3 of 7)
To see/print the current working
directory
~$ pwd Current working directory
To change directories
~$ cd [directory name]
~$ cd Desktop
No loss of data
~$ head
~$ less
~$ more
Example
~$ man ls
Provides details on the
“ls” command
Linux Admin (2 of 7)
To make a directory
~$ mkdir [directory name]
To delete a directory
~$ rm [directory name]
~$ rm -r [directory name] (*Note: deletes directory and all subdirectories & files)
To create a file
~$ touch [file name]
To rename a file
~$ mv [old file name] [new file name]
To move a file
~$ mv [file name] [directory name/]
To delete a file
~$ rm [file name]
Linux Admin (3 of 7)
To create a user account (Must use Virtualbox or VMWare)
~$ su –
The system will prompt you for the admin password
~# useradd [user name]
Then add the user’s password
~# passwd [user name]
The system will prompt you for the user’s new password then you will have to verify it.
Your system will continue to ping the target system until you quit
~$ CTRL + C
Linux Admin Exercise
Open a terminal window in your Linux desktop
Identify your system’s IP address using the “ifconfig” command
Check the status of your firewall
Clear your terminal window
Create a user with a username of “test1” and a password of “!passWord1!”
Delete the “test1” user account
Clear your terminal window
Ping the 8.8.8.8 IP address
Clear your terminal then close the window.
Linux CLI & Security (1 of 7)
Linux Commands – Unusual Network Usage
Look for promiscuous mode, which might indicate a sniffer:
# ip link | grep PROMISC
Look for unusual ARP entries, mapping IP address to MAC addresses that aren’t
correct for the LAN:
# arp –a
Get familiar with "normal" processes for the machine. Look for unusual processes. Focus
on processes with root (UID 0) privileges. If you spot a process that is unfamiliar,
investigate in more detail using:
# lsof –p [pid]
* Note: This command shows all files and ports used by the running process.
If your machine has it installed, run chkconfig to see which services are enabled at
various runlevels:
# chkconfig --list
Look for files named with dots and spaces ("...", ".. ", ". ", and " ") used to camouflage files:
# find / -name " " –print
# find / -name ".. " –print
# find / -name ". " –print
# find / -name " " –print
Look for processes running out of or accessing files that have been unlinked (i.e., link count is zero).
An attacker may be hiding data in or running a backdoor from such files:
# lsof +L1
Pay special attention to changes associated with items in /sbin, /bin, /usr/sbin, and /usr/bin.
In some versions of Linux, this analysis is automated by the built-in check-packages script.
Normal accounts will be there, but look for new, unexpected accounts, especially with
UID < 500. Also, look for unexpected UID 0 accounts:
# egrep ':0+:' /etc/passwd
Look for orphaned files, which could be a sign of an attacker's temporary account that
has been deleted.
# find / -nouser -print
Look through your system log files for suspicious events, including:
"entered promiscuous mode"
Large number of authentication or login failures from either local or remote access
tools (e.g., telnetd, sshd, etc.)
Remote Procedure Call (rpc) programs with a log entry that includes a large number
(> 20) strange characters (such as ^PM-^PM-^PM- ^PM-^PM-^PM-^PM-^PM)
For systems running web servers: Larger than normal number of Apache logs saying
"error" Reboots and/or application restarts
Many Roots
Many Trees
Navigation in Windows (1 of 6)
Some Important Windows Notes
Windows is generally not case sensitive - “Desktop” is the same as
“desktop”
Windows tab autocomplete does not work well – typing is hard…type carefully
The dot (.) and two dots (..) represent the working directory and the parent
directory respectively.
Navigation in Windows (2 of 6)
The Command Prompt
C:\Users\Administrator>
Running as a limited user whenever possible
Least privilege
Less dangerous – best practice
When running as system or administrator
Full privileges
Very dangerous
Can run any command
So can any malware or attacker!
Command Prompt
Navigation in Windows (3 of 6)
To see/print the current working directory
C:\User\Administrator> cd
Changed to the
Desktop Directory
Navigation in Windows (6 of 6)
To move a file
C:\User\Administrator> move\[file name]\[source directory]\[target directory name]
To delete a file
C:\User\Administrator> del [file name]
Windows Control & Admin (2 of 6)
To create a user account
C:\User\Administrator> net user /add [username] [password]
The system will provide you a message to tell you if the command completed successfully or if
there was an error
To delete a user account
C:\User\Administrator> net user [username] /delete
The system will provide you a message to tell you if the command completed successfully or if
there was an error
To reset the local user password
C:\User\Administrator> net user [user name] *
The system will then prompt you for the new password
The system will prompt you to retype the new password
Then the system will inform you that the password has been changed
Check other autostart items as well for unexpected entries, remembering to check user
autostart directories and registry keys.
Using the GUI, run msconfig and look at the Startup tab:
Start > Run, msconfig.exe
Using the command prompt:
C:\User\Administrator> wmic startup list full
Look for large number of failed logon attempts or locked out accounts.
Using the GUI, run the Windows event viewer:
C:\User\Administrator> eventvwr.msc
Look for unusual system crashes, beyond the normal level for the given system.
Malware
References
Pfleeger, C., & Pfleeger, S. (2011). Analyzing Computer Security: A
Threat/Vulnerability/Countermeasure Approach. Pearson Education.
Pfleeger, C., Pfleeger, S., & Margulies, J. (2015) Security in Computing – Fifth Edition.
Prentice Hall
SANS Institute. (2015). Intrusion Discovery Cheat Sheet v2.0. www.sans.org
Skoudis, E., Strand, J. (2015). Incident Handling. SANS, www.sans.org