- In 8.7, last lesson of lesson eight,
we're gonna focus in on cryptographic attacks.
Now, a cryptographic attack is a circumvention
of a cryptographic system by exploiting a weakness
or vulnerability in code or in the cipher
or in the cryptographic protocol or in the key
or key management scheme or in the implementation.
The process of finding a cryptographic weakness
or vulnerability is known as cryptoanalysis.
Because a cryptographic system
is usually a pretty strong system, attackers are always
looking to take advantage of a weak implementation.
So they're looking for things like misconfigurations
or weak keys or broken or deprecated versions.
As a reminder, we talked about this earlier,
deprecated means that there's a weakness, right?
And that the user must accept some risk.
Deprecated in terms of cryptographic systems
means that the use of an algorithm
and the key length is allowed, but the user,
again, has to acknowledge and accept some risks.
There's some weaknesses.
We talked about that.
We talked about symmetric algorithms, and we said,
you know, DES, which is broken, Triple DES is weak,
so AES really is our current government standard.
Now, broken means that the algorithm
and/or the key length is exploitable
and so we don't wanna use it anymore.
So for example, we don't wanna be using 802.11 WEP
or DES because they're both been broken and exploitable.
So deprecated, weak, broken, exploitable.
So I wanna introduce you to a downgrade attack
because this is a fairly common
and very powerful attack that takes people by surprise.
A downgrade attack is a type of attack
the system forces degradation to a lower quality crypto mode
and then the attacker exploits the lesser security control.
So you think you're fine, right?
You're using that strong crypto mode.
Turns out though, that the attacker can force you
into using a lesser security control.
So let me give you two examples.
SSL has known vulnerabilities and has been replaced
with TLS in most, if not all, implementation.
In a later lesson, we'll talk more about SSL and TLS.
However, many servers might have
SSL installed for backward compatibility.
So the attacker exploits the configuration
and forces a downgrade to SSL.
Now, what's even more common than having it on
because of backward compatibility is
it was just on by default and you're not using it,
but you never turned it off because you're using TLS.
Just the fact that SSL 2.0 or 3.0 is enabled, right,
even if you're not using it in any fashion, would be enough
for the attacker to force the downgrade attack.
Another example would be redirecting a visitor
from an HTTPS version, right, of a resource
or secure website to an HTTP copy.
HTTP being insecure, a clear text protocol.
Now, a side-channel attack is any attack
that's based on information gained from implementation
of a computer system rather than the weakness
in the implemented algorithm itself.
So in a side-channel attack, attackers use physical data
such as monitoring CPU cycles
or power consumption or radiation admissions
and timing to break the crypto system.
Now, a side-channel attack was used
back in 1995 to successfully identify RSA keys.
Now a timing attack exploits the fact
that different computations take different times
to compute on a processor.
So for example, if the encryption takes a longer time,
it indicates that the secret key is long.
So timing and side-channel attacks.
Of course, there's always, right,
always the motivation to find the key.
So let's look at three types of cryptovariable key attacks.
There's a brute force attack.
We've talked about brute force earlier.
In a brute force attack, our adversary
is trying to test every possible key.
Now, they could do it in online
or offline mode, until the key is discovered
that successfully decrypts the cipher text.
Brute force attacks are going to be
limited by work factor, right?
That's the time and the resources,
I would say also the talent, and of course, discovery.
A dictionary attack is when a list of known keys are tested,
generally common wordlists.
And a frequency analysis analyzes
the pattern of frequencies, so for example,
specific letters that may show up,
in an encrypted message to deduce information
about the underlying plain text
or the key that's used to encrypt the message.
So brute force, dictionary, and frequency analysis.
Next, we're gonna turn our attention to hash attacks.
Remember that we use hashing for integrity
and a hashing is a visual representation of a dataset.
And one of the most important things about a hash
is that the output is always unique to the input.
If I put the same input in a thousand times,
the output will always be the same.
If I make even the slightest change in the input,
the output will be different.
So here is some of the hash attacks
we need to be concerned with.
Collision, birthday, rainbow tables, and pass-the-hash.
A collision attack uses a mathematical technique
to force two inputs into producing the same hash value.
Well, if two different inputs are giving us
the same hash value, then the process
is no longer useful for us.
So that hash method can't be relied on anymore
to identify different data.
Now, the birthday attack just exploits
some mathematics behind the birthday problem
in probability theory to cause a collision.
Rainbow tables are publicly available tables
of pre-computed hashes, and we've talked about
those earlier, and those can be used
to quickly crack password hashes, right?
If we have these pre-computed tables, if we capture a hash
and we compare it to our rainbow table, we can say,
"Oh yeah, this hash is this password."
And then we have a pass-the-hash attack.
In a pass-the-hash attack, attackers use
captured hash credentials from one machine
to successfully gain control of another machine.
And that's because in a lot of environments,
passwords are hashed.
So they're not sent encrypted form, right?
They're sent in a hashed format,
which is better than clear text but still problematic.
In older Microsoft's environments.
Like in NTLM, NT LAN Manager, again,
all of our passwords were hashed.
This was in pre-Active Directory days.
But even if you're running AD, you still might have
NTLM turned on by default, which means that
your system is creating hashes of passwords.
Capture that hash and reuse it on another system,
and voila, the attacker has access.
Let's look a little deeper to rainbow table.
I keep describing them to you,
but I want you to see what they look like.
And so let's say we have the string Password99.
That's somebody's password.
Terrible password, but let's say that's what they're using.
So a SHA-256 hash, you can see what it would look like.
A SHA-512, right, It's gonna have a longer hash.
You can see what it looks like.
So if I capture, I'm the bad guy, and I capture the hashes,
I can compare it to the 256 or the 512.
And if either those match, I know that
the password string was Password99.
So let's look next at rainbow tables and salting,
how we can use salting to diminish the impact
or the usability of a rainbow table.
So in our example here, we've got Mary and Tom.
They're both using Password99
and their passwords are being hashed.
And if that hash was captured, right,
and compared to a rainbow table, well we'd be able to see
that their passwords were Password99.
But what if I add a salt?
A salt is just a random bunch of numbers and letters, right,
that are added to in string that's inputted
before we create the hash.
So we add as salt to Mary's, we add a salt to Tom.
Now, if we're looking at a SHA-256 hash,
not only do they not match each other
because they have this additional salt,
they're not gonna match anything
that's in a rainbow table unless, for some reason, right,
the attacker knew to add that salt
but they're not going to, right?
So that really negates the use of those rainbow tables.
Now, another form of cryptography
that we wanna talk about is adversarial cryptography.
Adversarial cryptography is when
our adversaries use cryptography to harm us.
And ransomware is really one of the best examples
of adversarial cryptography.
Ransomware being a form of malware designed to
encrypt files on a device, rendering them unusable.
Now, we know that ransomware generally adds
an extension to the encrypted files.
There's a whole bunch there
to show that the file's been encrypted.
And the file extension is generally unique
to the ransomware.
And once the ransomware has completed its file encryption,
it creates and displays a file or files
to the user saying, "Hey, I've encrypted all your files.
If you want a decryption key,
you need to pay me some ransom."
But I want to illustrate to you
how ransomware uses cryptography.
So I know that for some of you,
you might still be struggling a little bit with cryptography
and you might get a little overload on this,
but once you've gotten the concepts
of the keys and encryption, this is a really cool thing
to come back to and look at.
So in ransomware, the attacker's gonna generate a key pair.
The public key is going to be embedded in the malware.
Remember, the public key can be freely distributed
so it's embedded in the malware.
The malware generates a symmetric key.
The symmetric key is used to encrypt the files.
Why a symmetric key?
Because a symmetric key is computationally efficient
and works well on large blocks of data.
The malware public key is used to encrypt the symmetric key,
because what is the corresponding key
to the malware public key?
The malware private key.
And who has the malware private key?
Well, the attacker.
So the malware public key is used
to encrypt the symmetric key.
The payment response includes that encrypted symmetric key.
The attacker uses the malware private key,
the one they have in their possession,
to decrypt that symmetric key.
And then the symmetric key is sent
to the user to decrypt files.
I think this is just a fascinating illustration.
And if you're really comfortable already
with asymmetric and symmetric and private and public keys,
you'll be like, "Wow, that's really something."
If you're not, after you do become comfortable,
I wanna once again implore you
to come back and look at this.
It'll really help you understand how ransomware works.
And that, my friends, brings us to a three-second challenge.
Five challenge questions, three seconds each.
Let's do it.
When two different hash inputs
produce the same hash output.
What is that called?
One, two, three.
And that's a collision.
Number two, an attack that forces a system
into using a lesser crypto mode.
Really dangerous attack.
One, two, three.
And that's a downgrade attack.
Number three, term used to describe an algorithm
or a key length that's exploitable and should not be used.
One, two, three.
That's gonna be broken.
Number four, an attack that uses physical data inputs.
One, two, three.
That's a side-channel attack.
And lastly, number five, an attack which captured
hash credentials from one machine
are used to gain control of another machine.
One, two, three.
And that's a pass-the-hash attack.
Right, let's do a security-in-action.
This one's about downgrade attacks.
I'm glad we're talking about downgrade attacks again
because they're really dangerous,
and, you know, there are so many things we can do
just so that they never happen.
So one of the most infamous crypto downgrade attacks
is FREAK which stands for Factoring RSA Export Keys.
This is a vulnerability in SSL and TLS
that allows an attacker to force a target system
to use weaker encryption ciphers,
which can be easily cracked using brute force methods.
Now the attack works by exploiting a flaw in the way
SSL and TLS handle export-grade encryption keys.
You've been asked to recommend preventative controls
against a downgrade attack.
So really, we've told you a lot about this FREAK attack,
but that's not really the question.
We're not asking you how to defend against
a FREAK attack specifically.
You've been asked to recommend
preventative controls against a downgrade attack.
You don't wanna be subject to a downgrade attack.
So put me on pause, write some notes,
tell me what those preventative controls are gonna be.
All right, let's talk about those preventative controls.
Downgrade attacks are particular dangerous
because they exploit vulnerabilities in older,
widely-used software protocols and communication channels
which can be difficult to update and replace.
So to protect against downgrade attacks,
we wanna keep our software and our systems
up-to-date with the latest security patches.
We always wanna use the most secure versions
of protocols and communication channels.
And probably the most important thing here
is that we want to disable older, insecure versions.
We shouldn't ever say, "Well, we're not using it,
so not a big deal that it's there."
No, we always wanna make sure
we are disabling those versions.
And we should also enable firewall filtering.
So in this case, we wouldn't allow
any SSL traffic to come through.
So really understanding what you can do
to prevent an attack is very important.
Of course, there are other controls we can put.
Deterrent, right, detective, corrective controls,
but if we can prevent something from happening,
isn't that really the best of all actions?
And that, my friends, is definitely security-in-action.
There's your word cloud.
A lot here.
Make sure that you, again, know all of these terms.
You can speak to all of them confidently.
When you're ready, we've got a 10-question quiz coming up
so I'll see you there.