Lab 9 - Security
In this lab, we’re going to use a few security tools so you can get your hands on them.
Hashing
A hash function is any function that can be used to map data of arbitrary size to data
of a fixed size. (Wikipedia). This can be
as trivial as taking the first 8 bits of a file, or finding the value of the data modulus
n.
A cryptographic hash function has the following additional property: Given an output, we
should not be able to derive any information about the input, nor should we be able to
find another input with the same output. This is formalized by the three following rules:
- Pre-image resistance: Given any hash value h, it is computationally infeasible to find
- an input x such that hash(x) = h. Second pre-image resistance: Given a fixed
input x, it is computationally infeasible to find a different input x’ such that
- hash(x) = hash(x’). Collision resistance: It is computationally infeasible to find
any two different inputs x and y such that hash(x) = hash(y).
What is the use of such a function? Consider your favorite Linux distro. Mirrors (such as
the OCF) are an excellent mechanism for distribution.
Unfortunately, how is one supposed to trust that a mirror didn’t install some form of
malware? This is where the checksum (or the result of hashing data) comes into play: A
hash is miniscule compared to the original image (<512 bits vs >800MB of Arch). Thus,
developers are able to distribute checksums at a much lower cost. Because of the nature of
these hash functions, even the tiniest change results in completely different checksums,
rendering any modification without detection impossible. I’ve provided a few sha256 sums.
In the lab, answer which corpus
belongs to 5876fcc87f2db7adbd548cad3ca225c6a3e815f8fc737902588f1f2ca216247e
?
Public Key Encryption
Public key encryption provides a nifty way for people to securely send messages without
trading symmetric keys beforehand. One of the more “common” ways is through GPG-encrypted
mail. Send me an email with you OCF username at mdcha@ocf.berkeley.edu
encrypted with my
public key. You can find my public key on MIT’s key server. My
fingerprint is FA17 A706 5591 C293 C00C D52F 0BF0 AB95 491E C5BC
haveged
If you try to make keys on your VM, you might find it to be exteremely slow. Generating
your keys requires entropy. Install haveged
to make this process go faster.
Network security.
-
Make a list of all the services running on your student VM that are accessible from the
public internet, what user they are running as, and what port they are listening on.
Use the tools you learned about in lab 5, such as netstat
, as well as tools like
ps
. You may also want to point nmap -A
at your VM from another machine, such as
tsunami.
-
Use less and grep to open up and search your SSH login log file, located in
/var/log/auth.log
. Besides yourself, is anyone trying to log in? Who and why?
Threat Modeling
Choose any chapter in the range 10-26 from Ross Anderson’s Security
Engineering. Write up a threat model of a
described environemnt. In particular, answer the following questions:
- What do I want to protect?
- Who do I want to protect it from?
- How bad are the consequences if I fail?
- How likely is it that I will need to protect it?
- How much trouble am I willing to go through to try to prevent potential consequences?
This question can be answered in any coherent, human-readable (YAML/JSON doesn’t count)
format, e.g. bullet point, essay-style.
Submission
Fill out the Google Form once you’re done!