Lab Telematica
Lab Telematica
Lab Telematica
IT Security
Students’ LABs
Ch.2: Cryptography
“Don’t get LOST in bad Hacking …”
IT Security Lab 2.1: SSH Analysis and Configuration
IT SECURITY
LAB 2.1: SSH Analysis and Configuration
1. Scenario
This is the scenario to implement:
Linux
SSH Server SSH Client
.50 .51
192.168.0.0 /24
2. Material used
• Windows XP with PUTTY (Ssh client)
• Knoppix 7 with SSH Server
3. Learning Objectives
Upon completion of this lab you must be able to:
• Identify symmetric and asymmetric cryptography mechanisms
• Have good knowledge about SSH protocols 1 and 2
• Identify SSH operation
• Perform SSH configuration
4. Implementation
Task 1: Implement the scenario
1. Connect the 2 hosts
2. Configure IP parameters
3. Check IP connectivity between hosts
4. Do not start the SSH server yet
man sshd
2. Which protocol versions of SSH are supported and which one is the default?
Page: 1
IT Security Lab 2.1: SSH Analysis and Configuration
Acording to the manual of sshd, it supports SSH protocols 1 and 2. The default protocol is 2 and it can be changed in sshd_config(5)
It encrypts this random number using both the host key and the server key
3DES is the default protocol for protocol 1. Others may be DES, BLOWFISH, IDEA, AES...
Diffie-Hellman
Page: 2
IT Security Lab 2.1: SSH Analysis and Configuration
128-bit AES, Blowfish, 3DES, CAST128, Arcfour, 192-bit AES, or 256-bit AES. Is chosen by the client
/etc/init.d/ssh start
RSA is used to secure data transmission, the data sent is private between
computers.
DSA is used to digital signature and its verification, to check that the site
you are trying to access is the real one and not an impostor.
4. Where are each of these 4 keys stored? List each file and its directory location.
5. The “key fingerprint” is a hash of the “key”. How big (in bits) is each of the
fingerprints?
128 bits
6. Which algorithm has been used to generate the fingerprints?
128-bit MD5
/etc/ssh/sshd_config
2. Where is the ssh (ssh client) configuration stored?
Page: 3
IT Security Lab 2.1: SSH Analysis and Configuration
Symmetric
5. Change the default port for SSH to a new one, i.e. port 65001. Verify that you
can connect using the new port. Describe the steps that you have followed:
We changed the value from /etc/ssh/sshd_config. It had:
Port 22
We changed it to:
Port 65001
regedit
rsa2
65001
192.168.0.50
public key of server
2. First of all, you get a message about the server’s key fingerprint. How long in
bits is this fingerprint? (Tip: 1 hexadecimal character = 4 bits).
Page: 4
IT Security Lab 2.1: SSH Analysis and Configuration
128 bits
3. Attending to the length in bits of the fingerprint, what algorithm do you think
has been used to obtain this fingerprint? (Check cryptography bibliography
before answering this question).
128-MD5
4. The Linux SSH client keeps the public keys of the server in a file, in the .ssh
directory of the user.
5. Establish an SSH connection using the “knoppix” user and disconnect. Locate
the file key and write its path and name. Be sure you have previously accepted
the SSH key.
6. Erase the file and reconnect to the previous server. Notice that you will have to
accept the key again.
7. Now establish another SSH connection using the “root” user. Locate the file key
and write its path and name.
/root/.ssh/known_hosts
5. Results
• Successfully complete task 2
• Successfully complete task 3
• Successfully complete task 4
• Successfully complete task 5
• Successfully complete task 6
• Successfully complete task 7
Notes:
Page: 5
IT Security Lab 2.2: File Hashing
IT SECURITY
LAB 2.2: File Hashing
1. Scenario
This is the scenario to implement:
Internet
Computer with
Internet connection
2. Material used
• Windows
• Linux Knoppix 7
• Internet connection
3. Learning Objectives
Upon completion of this lab you must be able to:
• Identify different hashing algorithms
• Use different hashing applications
4. Implementation
Task 1: Implement the scenario
1. Connect the Windows and the Linux computer to Internet.
Task 2: File hashing applications
1. Search and identify different free hashing applications for WINDOWS that
implement MD5 and SHA-1 algorithms. Write they names here and download
one of them.
Page: 1
IT Security Lab 2.2: File Hashing
md5.cz - MD5
onlinemd5.com - MD5 and sha1 and sha256
md5hashgenerator.com - MD5 and sha1
MD5: 0CC175B9C0F1B6A831C399E269772661
SHA1: 86F7E437FAA5A7FCE15D1DDCB9EAEAEA377667B8
3. Modify only one character of one the previous files and generate again both
hashes, MD5 and SHA-1.
That we downloaded the file correctly. The file that they used for the hash
published in the web, is the same file that we have downloaded.
Page: 2
IT Security Lab 2.2: File Hashing
# echo -n lost | md5sum We get the same hash that using the other command
4. Copy the hash obtained and paste it on the previous web page, on the “Decrypt
MD5 hash” tab. (https://hashtoolkit.com/decrypt-md5-hash/)
5. Then click on the “search” icon and you will get the original word.
6. Try again with different words. Write down the words you have used.
password
user
qwerty
7. Try again the same words but use now the sha1 algorithm, so use the sha1sum
command and the previous web page or any other similar web page you can
find.
8. Is the web page really “decrypting” the hash?
No, it just has the value and its hash stored. It compares hashes to find the password
5. Results
• Successfully complete task 2
• Successfully complete task 3
• Successfully complete task 4
• Successfully complete task 5
Notes:
Page: 3
IT Security Lab 2.3: Linux Password Encryption
IT SECURITY
LAB 2.3: Linux Password Encryption
1. Scenario
This is the scenario to implement:
Linux Server
with Internet
Connection
Internet
2. Material used
• Knoppix 7
• Knoppix 4 for the last exercise
• Internet connection
3. Learning Objectives
Upon completion of this lab you must be able to:
• Identify how Linux passwords are stored
• Understand what encryption methods are used
4. Implementation
Task 1: Implement the scenario with a Linux Server
1. Connect the Linux server to the Internet.
su knoppix
2. Linux accounts are stored in the file /etc/passwd, with one account per line.
Open it and analyze its format. Search the Internet to determine all the
information contained for each account.
3. List, in order, all the parameters for each account and give a description of each:
Page: 1
IT Security Lab 2.3: Linux Password Encryption
4. What do you get as the password for each account? What does it mean?
/etc/shadow
6. Who can read this file?
Only root
7. Try to open the file as the “knoppix” user. Were you successful? Why?
su
2. Verify what user you are now with the next instruction:
whoami
passwd root
Page: 2
IT Security Lab 2.3: Linux Password Encryption
6. The password’s format is composed by 3 parts, each separated by the “$” char:
o Encryption method:
“1”: MD5 “5”: SHA-256
“2”: Blowfish “6”: SHA-512
“_”: DES
o Salt: When a user picks or is assigned a password, it is encoded with a
randomly generated value called the salt. This means that any particular
password could be stored in 4096 different ways. The salt value is then
stored with the encoded password.
o The encrypted password.
Add an extra layer of security. In a brute force attack you would have to
try 4096 times each password if you don't know the salt value.
Page: 3
IT Security Lab 2.3: Linux Password Encryption
512 bits
10. How long (in characters) is the “root” password once it is encrypted?
86 characters
11. Knowing that passwords are kept in Base-64 format, is this correct according to
the two previous answers?
5. Results
• Successfully complete task 2
• Successfully complete task 3
Notes:
Page: 4
IT Security Lab 2.4: Digital Certificates
IT SECURITY
LAB 2.4: Digital Certificates
1. Scenario
This is the scenario to implement:
Internet
Computer with
Internet connection
2. Material used
• Computer with Internet connection and an updated web browser
3. Learning Objectives
Upon completion of this lab you must be able to:
• Identify Digital Certificates structure
• Manage Digital Certificates correctly
4. Implementation
Task 1: Implement the scenario
1. Connect your computer to Internet
A digital certificate is used to cryptographically link ownership of a public key with the
entity that owns it. Digital certificates are for public keys to be used for encryption and
authentication.
It's an electronic document to prove the validity of a public key.
Page: 1
IT Security Lab 2.4: Digital Certificates
Certificate
Version Number
Serial Number
Signature Algorithm ID
Issuer Name
Validity period
Not Before
Not After
Subject name
Subject Public Key Info
Public Key Algorithm
Subject Public Key
Issuer Unique Identifier (optional)
Subject Unique Identifier (optional)
Extensions (optional)
...
Certificate Signature Algorithm
Certificate Signature
Uses the PKI protocol. This protocol uses a mathematical algorith to generate the
private/public keys.
VeriSign, Inc
3. When the “issuer” is the same than the subject who the certificated was issued
for, then it’s a “root” certificate. Is this the case?
Yes the issuer and the subject is the same, VeriSign, Inc
4. How long (in bits) is the public RSA key included in the certificate?
1024
Page: 2
IT Security Lab 2.4: Digital Certificates
5. Which algorithms were used to generate the digital signature of the certificate?
https://eSecretary.salle.url.edu
GEANT Vereniging
3. How long (in bits) is the public RSA key included in the certificate?
2048
4. Which algorithms were used to generate the digital signature of the certificate?
Sectigo (AAA) -> USERTrust RSA Certification Authority -> GEANT OV RSA CA 4 -> *.salle.url.edu
Sectigo (AAA)
7. If you have this root certificate in your list then you can verify the lower
certificate, and so, you don’t get a “validation error” for the certificate of the
server you are connecting at. Is this the case?
We don't get the error because the root certificate is preinstalled and appears on the certificate list.
Page: 3
IT Security Lab 2.4: Digital Certificates
No
2. Now open the web page: https://cadi.salleurl.edu. Do you get any security
warning?
Yes
3. Open the digital certificate of “https://cadi.salleurl.edu”. Be sure to connect to
cadi.salleurl.edu and not to cadi.salle.url.edu.
4. Who is the issuer and the subject of this certificate?
5. Results
• Successfully complete task 2
• Successfully complete task 3
• Successfully complete task 4
• Successfully complete task 5
Notes:
Page: 4
IT Security Lab 2.5: HTTPS and SSL
IT SECURITY
LAB 2.5: HTTPS and SSL
1. Scenario
This is the scenario to implement:
Internet
Computer with
Internet connection
2. Material used
• Windows client
• Internet connection
3. Learning Objectives
Upon completion of this lab you must be able to:
• Identify HTTPS and SSL operation
4. Implementation
Task 1: Implement the scenario with a Windows client
1. Connect the Windows XP computer to Internet
Task 2: HTTPS
1. HTTP stands for “Hypertext Transfer Protocol”. What does HTTPS stand for?
443
3. What two elements does HTTPS use to secure the communications?
Page: 1
IT Security Lab 2.5: HTTPS and SSL
4. How do the different Web browsers indicate you are using a secure connection?
(Icons in the browser).
Task 3: SSL/TLS
1. What do SSL and TLS stand for?
Page: 2
IT Security Lab 2.5: HTTPS and SSL
6. Using a sniffer, capture all the packets related to an HTTPS connection to this
server. Identify each packet corresponding to each step of the handshake.
https://esecretary.salle.url.edu
7. What SSL or TLS message is used by the server to send its certificate to the
client? Identify the corresponding packet.
The message after "Server Hello" has the certificate of the server
8. Which version of SSL or TLS is being used? And what Cipher Suite? Focus on
the “Server Hello” message.
esecretary.salle.url.edu
estudy.salle.url.edu
facebook.com
instagram.com
twitter.com
2. Are they using HTTPS to identify users? Check it for each of them.
Jim Roskind
3. What are QUIC’s goals?
Page: 3
IT Security Lab 2.5: HTTPS and SSL
chrome://flags/
5. Start wireshark and capture traffic while you connect to Google. Verify that you
capture quic protocol filtering traffic conveniently. Show your results to the
instructor.
6. What transport protocol (UDP or TCP) and what destination port quic uses?
5. Results
• Successfully complete task 2
• Successfully complete task 3
• Successfully complete task 4
• Successfully complete task 5
Notes:
Page: 4