Instructor: In this lesson,
we will learn about secrets management.
Secrets management is securely storing, managing,
and controlling access to sensitive information
to prevent unauthorized access.
Secrets management concepts include tokens, certificates,
passwords, keys, rotation, and deletion.
Tokens are temporary digital credentials
used for authentication or authorization.
Certificates are digital documents that verify the identity
of entities and enable secure communication.
Passwords are traditional secret strings of characters
used for authentication.
And keys are cryptographic elements that secure data
through the encryption and decryption process.
Finally, in order to maintain security,
secrets should be regularly rotated,
meaning updated or replaced.
And to prevent unauthorized access,
secrets should be securely deleted when no longer needed.
Let's learn more about tokens, certificates, passwords,
keys, rotation, and deletion.
First, we have tokens.
Tokens are temporary digital credentials
used for authentication or authorization,
acting like digital keys that grant a user or application
access to a system for a set period of time.
They are widely used in modern security architectures,
especially in web applications
and application programming interfaces, or APIs.
Here, they are used to manage access
securely and efficiently.
For example, when you log into an online service,
you receive a session token
that keeps you logged in for a specific duration
without needing to repeatedly enter your credentials.
This token is usually stored in your browser or application,
and it authorizes your actions
while interacting with that service.
Tokens can be classified into different types,
such as JSON web tokens, OAuth access tokens, or API tokens,
each designed for specific purposes.
For example, JavaScript object notation, or JSON web tokens,
are commonly used to securely transmit
information between parties, containing data like user roles
and permissions encoded within the token itself.
OAuth tokens are widely used
to delegate access between applications,
such as when you use your Google account
to log into a third-party application
without sharing your Google password.
Tokens are signed and often encrypted to prevent tampering
and ensure they can be trusted
by the systems that issue and validate them.
However, because they grant access,
tokens must also be properly managed
to avoid security risks.
If a token is stolen,
an attacker could potentially access sensitive information
until the token expires.
So, to mitigate these risks, tokens are usually designed
to expire after a short period of time,
limiting the timeframe they can be misused.
For example, a session token
might expire after 15 minutes of inactivity,
requiring the user to re-authenticate.
Proper token management, including secure storage,
timely expiration, and the revocation of compromised tokens
helps maintain a secure environment
and protect against unauthorized access.
Second, we have certificates.
Certificates are digital documents
that verify the identity of entities such as users,
devices, or websites,
and enable secure communication between them.
Certificates use cryptographic methods
like public and private key pairs to create trust,
ensuring that the parties involved are who they claim to be.
For example, when you visit a secure website,
your browser checks the site's certificate
to confirm that it is legitimate and safe,
allowing for encrypted communication
and protecting your data from being intercepted.
There are different types of certificates,
each serving specific purposes.
Secure Sockets Layer, Transport Layer Security,
or SSL/TLS certificates,
are commonly used for websites to ensure secure connections
between web browsers and servers.
Code-signing certificates verify
that software or applications have not been tampered with
and are from a trusted source,
ensuring that downloaded programs are safe to use.
Next, client certificates authenticate users,
proving their identity to servers during secure connections,
often used in corporate environments
where users need to be verified across internal systems.
Email certificates, like Secure/Multipurpose
Internet Mail Extensions, or S/MIME,
are used to encrypt and digitally sign emails,
ensuring that messages are secure
and sent from verified senders.
Finally, device certificates authenticate devices,
such as printers or servers, within a network,
ensuring that only trusted hardware
can communicate within the environment.
Certificates must be carefully managed, regularly updated,
and securely stored to maintain their trustworthiness.
Expired or misconfigured certificates
can cause security warnings or interruptions in service.
For example, if a website's SSL/TLS certificate expires,
users will see a warning that the site is not secure,
potentially leading to a loss of trust and access issues.
Proper certificate management includes renewing certificates
before expiration, revoking them if compromised,
and ensuring they are correctly configured
to protect communication channels.
Third, we have passwords.
Passwords are traditional credentials made up
of secret strings of characters that users enter
to prove their identity during authentication.
Passwords are commonly used across websites,
applications, and systems,
but they are vulnerable to various attacks,
such as guessing, phishing, brute force,
and credential stuffing.
Passwords should never be stored in plain text.
Instead, they should be stored securely
using cryptographic techniques like hashing.
Hashing converts the password into a fixed-length
string of characters that is unique to the password input.
So, when a user logs in,
the system hashes their entered password
and compares it to the stored password hash,
ensuring the original password is never exposed,
while allowing authentication.
To reduce the risk of password exposure,
passwords should be rotated periodically,
meaning they should be updated or changed
on a regular schedule.
In high security environments, additional measures,
such as salting passwords,
enforcing domain-wide password policies,
using two-factor authentication,
and monitoring for compromised credentials,
can further protect against unauthorized access.
In all cases, proper password management
and secure storage are essential.
Fourth, we have keys.
Keys are cryptographic elements used to secure data
through the encryption and decryption process.
They include public and private keys
in the public key infrastructure, or PKI,
and symmetric keys used for data encryption.
Keys must be handled carefully because improper management,
such as storing them in insecure locations
or embedding them in code,
can lead to exposure and compromise.
When keys are compromised, they must be immediately revoked,
replaced, and the systems that relied on those keys
must be re-secured to maintain data protection.
There are several common issues with cryptographic keys
that you should consider, including mismatched keys,
improper key handling, embedded keys,
rekeying, and compromised or exposed keys.
Mismatched keys occur when the wrong public
or private key pair is used to decrypt data,
resulting in errors like "key mismatch"
or "X509_check_private_key."
These errors indicate that the correct key pair
needs to be used to successfully access the data.
Next, improper key handling involves failing to maintain
the secrecy and protection of private or symmetric keys.
If these keys are not properly secured during storage,
they can become exposed, leading to data compromise.
Keys stored in insecure locations
should be assumed compromised,
and must be immediately revoked
and replaced with new keys to restore system security.
Embedded keys are stored on special
read-only cryptographic storage chips
and cannot be easily revoked or replaced if compromised.
These keys, along with the devices that use them,
are part of the encryption solution,
and so they must be carefully protected
from tampering to prevent unauthorized access.
Next, rekeying is the process of renegotiating session keys
during a communication session, often based
on the volume of traffic processed rather than time.
This process ensures that encryption
remains strong over time.
For example, in WPA3,
with the simultaneous authentication of equals,
session keys are frequently renegotiated, or rekeyed,
to maintain the security of the data in transit.
Finally, compromised or exposed keys
present a significant security risk,
as they indicate that unauthorized access
to a private or symmetric key has occurred.
If a private key is exposed,
it and any associated digital certificates
must be immediately revoked,
replaced, and securely destroyed.
Any data previously protected by the compromised key
should be identified, and remediation actions
should be taken to ensure that that data remains secure.
Fifth, we have rotation.
Key rotation is the process of regularly updating
or replacing cryptographic keys, passwords, tokens,
and other sensitive credentials to maintain security.
This practice is essential,
because it reduces the risk of unauthorized access
by limiting the time an attacker
has to exploit compromised credentials.
For example, in a secure system,
cryptographic keys might be rotated every few months
to ensure that even if a key is exposed,
it can't be used for long.
During key rotation,
all active keys are replaced with new ones,
and the old keys are revoked
and securely destroyed to prevent their reuse.
This ensures that any potential vulnerabilities
associated with older keys are eliminated.
By frequently rotating keys,
the window of opportunity for attack is minimized.
Finally, key rotation involves re-encrypting data
with the new keys, updating access controls,
and ensuring all systems using the keys
are synchronized with the latest versions.
For example, in a system using encryption,
key rotation might mean generating a new encryption key
and re-encrypting stored data to match this new key.
Sixth and last, we have deletion.
Deletion is the secure process of destroying secrets
such as passwords, tokens, or cryptographic keys
that are no longer needed to prevent unauthorized access.
One effective method of secure deletion
is cryptographic shredding,
which involves destroying the decryption keys
that protect the data.
When the key is destroyed, the encrypted data
becomes permanently unreadable and essentially deleted
because it can no longer be decrypted.
For example, if a hard drive is encrypted
with the Advanced Encryption Standard, or AES,
which is a strong key, and that key is shredded,
the data on the drive becomes inaccessible.
Without the key,
even if someone gains access to the encrypted data,
it remains secure and unreadable.
This approach is commonly used in cloud storage environments
where simply deleting files is not enough
to ensure data privacy.
By destroying the encryption keys,
organizations can be confident
that the data is permanently secured
and cannot be recovered by anyone.
So, remember, secrets management is the practice
of securely storing, managing, and controlling access
to sensitive information to prevent unauthorized access.
Secrets management includes managing
various types of secrets, like tokens,
certificates, passwords, and cryptographic keys,
as well as processes like rotation and deletion.
Tokens are temporary credentials used for access.
Certificates verify the identity of entities.
Passwords authenticate users.
And keys are used to encrypt and decrypt data.
Regular rotation of these secrets
ensures they are updated frequently,
reducing the risk of unauthorized access
by limiting the time a compromised secret can be exploited.
Secure deletion is used to completely remove secrets
that are no longer needed, ensuring sensitive information
cannot be recovered or misused.
So, proper secrets management helps protect systems,
maintains data integrity,
and supports the secure operation
of applications and networks.