DEV Community

Cover image for Secure your enterprise critical assets from secret sprawl
Siranjeevi Dheenadhayalan
Siranjeevi Dheenadhayalan

Posted on

Secure your enterprise critical assets from secret sprawl

Understand the risks of secret sprawl, embracing shift-left and strategies to secure secret leaks in the modern software development lifecycle.


Secret sprawl:

Enterprises often need help with the uncontrolled proliferation of secrets across their IT infrastructure. The unchecked proliferation is called a secret sprawl, and usually, secrets get scattered across server systems, repositories, configuration files, applications, and other storage locations. The risk from secret sprawl can compromise security and enable unauthorized access, thus making it essential for organizations to address the issue.

Risks:

High Blast radius: When sensitive secrets get dispersed across multiple locations, the attack surface for possible data breaches multiplies. When attackers gain access to the secret, it can lead to unauthorized access and breaches.

Insider threat: Even if the sprawled secret exists within the enterprise VPC, unauthorized employees can access sensitive assets violating least privilege access. This insider threat can lead to compromised security posture and the theft of sensitive data.

Application downtime: When a sprawled secret expires or reaches the end of life due to a set TTL, determining the side effects is often complex and time-consuming. The effort is high to estimate the number of applications using the hardcoded secret and the importance of those applications to business operations. Hence, rotation or expiration of such secrets without proper usage analysis can lead to application downtime, affecting users and other applications.

Lack of visibility: Since SecOps cannot monitor hardcoded secret usage, it isn't easy to track the entities accessing the secret - making audit and access control challenging.

Compliance: Regulatory compliance policies such as GDPR, PCI DSS, HIPAA, NIST, etc… require enterprises to safeguard secrets that can access sensitive user information. Exposure of these secrets internally within the organization or externally in public repositories can lead to hefty fines and distrust among users.

Prevent Secret Sprawl Proactively

Enterprises often adopt the following best practices to prevent sprawl from happening and maintain governance:

Centralized secrets management: As organizations adopt a multi-cloud approach, developers store secrets in native secret managers like AWS Secrets Manager, Azure Key Vault, GCP Secrets Manager, etc. While this is convenient for developers, it creates multiple secret store hotspots and complicates audit and visibility for security operations. Hence, a centralized secrets management experience is essential.

Dynamic secrets: When an application requests a secret, creating a just-in-time secret with role-based access policies can remove secrets with a long lifetime and thus prevent any sprawl. It is essential to understand the required secret TTL based on application needs.

Secret Scanners: Secret scanners can scan to detect sprawled secrets from popular hotspots such as repositories, container images, applications, server system files, etc. While scanning leaked secrets seems essential, the secret scanners can also help prevent future secret sprawls by preemptively guiding developers and security teams in the right direction.

Education and Training: Enterprises should train and create security awareness programs to educate developers and security operations about the importance of collaboration and the risks associated with sprawl. Educated users are more likely to adhere to best practices and contribute to preventing sprawl.

Shift-Left in Security

To proactively reduce secret sprawl, enterprises are moving from the operational utopia of siloed security and development teams to an integrated, developer-first security approach. The main reasons that drive the integrated approach are the following:

Agility and faster time to market: Enterprise products aim to stay relevant and competitive in a fast-paced software market. Thus, constant business requirement changes require rapid development and release processes often hindered by a siloed security team. Therefore, an integrated security team can aid rapid release without compromising security.

Early Issue Identification and Remediation: Teams can identify and address issues sooner by shifting tasks such as testing, security reviews, and code analysis to earlier stages of the SDLC. Doing so reduces the cost and effort required to fix issues discovered later in the development process and minimizes the impact on project timelines.

Risk Reduction: Independent security and development teams may need to pay more attention to address security vulnerabilities promptly. The integrated team can proactively identify and address security threats on time.

Embracing the trend emphasizes that security is no longer a dedicated security team's concern; instead, there is a shared responsibility with the development teams. The approach is often termed "shift-left," enterprises that adopt this paradigm constantly seek to integrate security practices early in the software development lifecycle (SDLC) to address vulnerabilities.

With a shift-left paradigm, the developers refrain from embedding secrets such as API tokens, passwords, and encryption keys in their source code. While this is ideal in theory, the SDLC has multiple checkpoints; thus, more than developer education is needed to help maintain compliance. So, how can enterprises preserve developer productivity while ensuring security best practices in program files? This uncertainty has led to the production of security collaboration products that can centrally manage and provide visibility into secrets embedded in source code.

Attack Vectors

As we discuss the importance of shit-left and security in source code, it is imperative to understand how modern development practices can introduce attack vectors that increase risk. Attack vectors refer to the various points within the development process where malicious actors can exploit vulnerabilities to gain unauthorized access. Here are some common attack vectors that attackers look for:

OSS/3rd party library usage: To save time, developers often use OSS/3rd party libraries to extend the application's functionality. When such libraries have a security vulnerability, it is easier for attackers to target products that use it to exploit the vulnerability.

Configuration files: For modularity and portability, developers often use configuration files to store API endpoints and secrets. IaC tools like Terraform and containerization tools like docker also contain configuration files. Secrets in configuration files can lead to unauthorized access, service impacts, and many other possible threats.

Log files: While logging is helpful for debugging, developers may accidentally log sensitive information to logs/console outputs/ error messages, leading to unauthorized access.

Comments: Developers may inadvertently include secrets as comments during debugging or documentation. While comments are not executed, they are still visible in the source code.

Developers manage their source code using version control software like GitHub, GitLab, and BitBucket. These repositories often become central repositories for sensitive information. Recognizing all potential attack vectors, evaluating each checkpoint in the Software Development Life Cycle (SDLC), and implementing strategies to ensure developers adhere to security best practices throughout the process are crucial.

Top comments (0)