Daniel Miessler Cyber-Sec Interview Prep Flashcards
How do you change your DNS settings in Linux?
1.) Open a terminal.
2.) Use vim or another text editor to edit the /etc/resolv.conf file.
3.) Add a line of “nameserver x.x.x.x” with x.x.x.x being the IP address of your DNS server.
save the file and you’re done!
How do you change your DNS settings in Windows?
There are 2 ways:
“GUI Method”
1.) Navigate to Control Panel -> Network and Sharing Center -> Change adapter settings
2.) Right-click on the adapter you want to configure and select ‘properties.’
3.) Double-Click on TCP/IPv4
Change the DNS settings to the server(s) you want, and apply your changes.
-OR-
“PowerShell”
- ) Run powershell as administrator
- ) Use the Set-DnsClientServerAddress cmdlet. Be sure to specify the appropriate interface index and server addresses
PS C:> Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses (“10.0.0.1”,”10.0.0.2”)
What are your first three steps when securing a Linux server?
STEP 1 - Update your server
Depending on your Linux distribution, your install ISO/DVD could be months or even years old! Running updates on your server immediately will help get any vulnerable packages updated. We can do this in one lines:
sudo apt-get update && sudo apt-get upgrade
STEP 2 - Disable root access via SSH
If you’ve ever watched your SSH logs after starting up a server, you’ll notice one thing very quickly: a lot of people are trying to access your server. The other thing you’ll notice is 95% of them are trying to access it via the root user.
Let’s disable the root login by editing the sshd_config file:
sudo vim /etc/ssh/sshd_config
Find the PermitRootLogin line and change it to “no”:
PermitRootLogin no
STEP 3 - Change your SSH port
After Step 2, you’ll notice your logs still are full of login attempts. Even though they can’t get in as the root user, they’ll still keep trying. Let’s change the OpenSSH server to use a different port. Open the sshd_config file once more and edit the “Port” line to use an atypical number. For example:
Port 5901
Restart your SSH server in order to pickup the changes from Steps 2 and 3
sudo service ssh restart
Does TLS use symmetric or asymmetric encryption?
TLS uses a combination of symmetric and asymmetric cryptography, as this provides a good compromise between performance and security when transmitting data securely.
The initial exchange is done using asymmetric and that bulk data encryption requires speed and therefore symmetric algorithms.
What’s the difference between symmetric and
public-key cryptography?
Symmetric uses a single key while public-key uses two.
In public-key cryptography you have a public and a private key, and you often perform both encryption and signing functions.
Which key is used for which function?
You encrypt with the other person’s public key, and you sign with your own private.
Describe the process of a TLS session being set up
when someone visits a secure website.
- ) The ‘client hello’ message: The client initiates the handshake by sending a “hello” message to the server. The message will include which TLS version the client supports, the cipher suites supported, and a string of random bytes known as the “client random.”
- ) The ‘server hello’ message: In reply to the client hello message, the server sends a message containing the server’s SSL certificate, the server’s chosen cipher suite, and the “server random,” another random string of bytes that’s generated by the server.
- ) Authentication: The client verifies the server’s SSL certificate with the certificate authority that issued it. This confirms that the server is who it says it is, and that the client is interacting with the actual owner of the domain.
- ) The premaster secret: The client sends one more random string of bytes, the “premaster secret.” The premaster secret is encrypted with the public key and can only be decrypted with the private key by the server. (The client gets the public key from the server’s SSL certificate.)
- ) Private key used: The server decrypts the premaster secret.
- ) Session keys created: Both client and server generate session keys from the client random, the server random, and the premaster secret. They should arrive at the same results.
- ) Client is ready: The client sends a “finished” message that is encrypted with a session key.
- ) Server is ready: The server sends a “finished” message encrypted with a session key.
- ) Secure symmetric encryption achieved: The handshake is completed, and communication continues using the session keys
If someone steals the server’s private key can they
decrypt all previous content sent to that server?
Not if forward Secrecy was implemented. This prevents an attacker from decrypting captured data that was sent to a server in the past, even if the server’s private key was stolen.
What is Forward Secrecy?
Forward Secrecy is a system that uses very short lived (ephemeral) session keys to do the actual encryption of TLS data so that even if the server’s private key were to be compromised, an attacker could not use it to decrypt captured data that had been sent to that server in the past.
What are some common ways that TLS is attacked,
and/or what are some ways it’s been attacked in the past?
Many known TLS vulnerabilities result from weak cryptographic primitives, which TLS 1.3, thankfully, did away with.
Heartbleed: Caused by a flaw in OpenSSL. Which, in short, a malicious user could easily trick a vulnerable web server into sending sensitive information, including usernames and passwords.
BEAST: Browser Exploit Against SSL/TLS, was an attack that allowed a man-in-the-middle attacker to uncover information from an encrypted SSL/TLS 1.0 session by exploiting a known theoretical vulnerability.
Cryptographically speaking, what is the main
method of building a shared secret over a public medium?
Diffie-Hellman.
What’s the difference between Diffie-Hellman and RSA?
RSA requires you to have key material beforehand while Diffie-Hellman does not.
What kind of attack is a standard Diffie-Hellman exchange vulnerable to?
Man-in-the-middle, as neither side is authenticated.
What’s the difference between encoding, encryption, and hashing?
Encoding is designed to protect the INTEGRITY of data as it crosses networks and systems, i.e. to keep its original message upon arriving, and it ISN’T primarily a security function. It IS EASILY REVERSIBLE because the system for encoding is almost necessarily and by definition in wide use.
Encryption is designed purely for CONFIDENTIALITY and is reversible only if you have the appropriate key/keys!
With hashing the operation is one-way (NON-REVERSIBLE!), and the output is of a fixed length that is usually much smaller than the input.
What is an IV(Initializing Vector) used for in encryption?
An IV is used to initiate encryption by providing an addition (third) input in addition to the cleartext and the key. In general you want IVs that are random and unpredictable, which are used only once for each message. The goal is to ensure that two messages encrypted with the same key do not result in the same ciphertext.