Identity

Nine best practices for secrets management in the cloud

Share
Managing secrets in the cloud

In cloud and on-premises environments, managing secrets — such as passwords, API keys, encryption keys, and certificates — has become essential for maintaining security. These secrets are sensitive pieces of information used to authenticate and authorize access for users or machines to various resources.

Secrets can take various forms and are managed by different teams depending on the type of use assigned to that key. Passwords are the most common type of secret used to authenticate users and systems. They are often required to access databases, services, and applications. Given that they are typically associated with usernames — and considering many users tend to reuse passwords — these types of secrets are particularly vulnerable. Malicious actors can easily attempt to guess or reuse previously leaked passwords.

A second form of secret, API keys, authenticate applications or systems accessing APIs. These keys are usually long strings of characters that offer a way to track and control API usage. A common bad practice is hard-coding API keys into applications, making them difficult to rotate and easy to detect if the code repository becomes public.

Security teams also use encryption keys, which are essential for securing data both in transit and at rest. They are used to encrypt and decrypt data, ensuring that only authorized parties can access the information. Despite the importance of encryption, key management is often seen as a challenging task, leading some users to handle it improperly or neglect it altogether.

Teams can also deploy digital certificates that authenticate the identity of users, devices, or servers. Certificates are widely used in SSL/TLS protocols to secure internet communications. Unfortunately, users often forget to renew certificates before they expire, only realizing the issue when services are disrupted. Like passwords, certificates should be rotated regularly. Finally, tokens are frequently used in OAuth and other authorization frameworks to grant temporary access to resources. These tokens are often time-limited and part of multi-step authentication processes. A poor understanding of these protocols can lead to flawed designs and inherent security weaknesses.

How secrets get exploited

As their name suggests, security teams should keep secrets confidential. This requires restricting access, securing them properly, and maintaining an up-to-date inventory of all secrets. Naturally, secrets are prime targets for attackers. Here are some common ways hackers can exploit secrets:

Hardcoded secrets: When secrets are hardcoded in source code, they become easy targets. Attackers can use static code analysis tools or simply inspect the codebase to find these secrets.

Unencrypted storage: Storing secrets in plain text, whether in configuration files or databases, makes them vulnerable to theft if the storage location gets compromised.

Insufficient access controls: Without proper access controls, unauthorized users or systems can gain access to secrets, increasing the risk of misuse.

Poor rotation practices: Failing to rotate secrets regularly can lead to prolonged exposure if a secret becomes compromised. Attackers can exploit the same secret repeatedly until it gets changed.

Insufficient monitoring: A lack of monitoring for access and use of secrets can delay the detection of unauthorized access, allowing attackers to operate undetected for extended periods.

Secrets management best practices

Follow these nine best practices to mitigate the risks associated with secrets management:

  • Centralized secrets management: Use a centralized secrets management offering, such as AWS Secrets Manager, HashiCorp Vault, or Azure Key Vault. These tools feature secure storage, access controls, and audit logging for secrets.
  • Encryption: Always encrypt secrets both at rest and in transit. Use strong encryption standards to ensure that even if the storage medium becomes compromised, the secrets remain protected.
  • Least privilege access: Implement the principle of least privilege by granting access to secrets only to those who absolutely need it. Use role-based access control (RBAC) and manage identity and access management (IAM) properly to control permissions effectively.
  • Regular rotation: Rotate secrets regularly to minimize the window of opportunity for attackers. Automated rotation mechanisms offered by secrets management tools can simplify this process.
  • Audit and monitor: Implement comprehensive auditing and monitoring to track access to secrets. Regularly review audit logs to detect suspicious activity and respond promptly.
  • Avoid hardcoding secrets: Never hardcode secrets in source code. Use environment variables or secrets management tools to inject secrets at runtime.
  • Use strong authentication: Protect access to secrets management systems with strong authentication mechanisms, such as multi-factor authentication (MFA) and single sign-on (SSO).
  • Secure development practices: Educate developers on secure coding practices and the importance of secrets management. Conduct regular code reviews and security assessments to identify and address vulnerabilities.
  • Backup and recovery: Ensure that the company’s secrets management system gets backed up regularly and that the team has a robust recovery plan in place. This ensures continuity in the event of system failures or breaches.

Teams need to think of secrets management as a critical component of cloud security. By understanding the types of secrets, their importance, and how attackers can exploit them, organizations can implement effective strategies to protect their sensitive information.

Adopting best practices, along with proper education across all engineering teams, can significantly reduce the risk of security incidents and enhance overall operational resilience. As cloud environments continue to evolve, robust secrets management will remain a cornerstone of secure and efficient operations.

Shira Shamban, co-founder and CEO, Solvo

Shira Shamban

Shira Shambam, co-founder and CEO at Solvo, a software company focused on automating cloud and data security, started her career in security as a military officer in Israel’s intelligence Unit 8200. Specializing in cloud security, Shira works to empower women and underrepresented groups in technology, volunteering as a lecturer and mentor for organizations such as SheCodes, Cyber Ladies, and Women in AppSec. She also spearheaded the local mentoring initiative Security Diva and holds the position of co-chair at OWASP Israel.

LinkedIn: https://www.linkedin.com/in/shira-shamban/

Twitter: https://twitter.com/ShambanIT

Get daily email updates

SC Media's daily must-read of the most current and pressing daily news

By clicking the Subscribe button below, you agree to SC Media Terms and Conditions and Privacy Policy.