Understanding Secrets vs. Sensitive Data
Secrets and sensitive data are similar in nature, but differ in their scope. All secrets can be considered sensitive data, however not all sensitive data are secrets.
Secrets are any sort of information that must be kept confidential to protect data integrity and security. Secrets are privileged information, and are used to grant access into an organization’s restricted systems or services. The most common form of secrets are credentials – usernames and passwords. Other types of secrets include encryption keys, security certificates, or API tokens.
Sensitive data, on the other hand, usually belongs to end users or customers. This data includes items like social security numbers, employment identification numbers, personally identifiable information (PII), or credit card numbers. Storage of sensitive information commonly necessitates that organizations maintain compliance with certain data privacy laws or industry standards.
The following example demonstrates the differences between these two types of information: a database credential is exposed to a hacker through a breach, and it’s used to execute a wider attack within the organization. The malicious actor uses the secret to gain access to the database and exfiltrate sensitive data stored within, such as customer credit card numbers and other PII.
How Secret Scanning Works
Secret scanning may be broken down into several clearly defined steps:
- Scanning Phase: The scanner performs scans against all relevant targets within the IT stack. Scanning capabilities fall into two categories: real-time scans monitor events such as pull requests, code changes, and modifications to configuration files. They may also help ensure container security with respect to secrets, analyze build systems, logs, and data stores. On the other hand, at-rest scans are scheduled to periodically check historical, static, or infrequently updated items like documentation, archive files, artifact repositories, and long-term blob storage containers for secrets.
- Secret Identification: Once a potential secret is detected, the pattern is checked by extracting and comparing metadata from the environment, or communication is established with a service provider to pinpoint the service that matches the secret. Additional tests are executed to confirm whether the secret is still valid and active.
- Automated Remediation: If applicable, automated remediation or redaction of the exposed secret is attempted. Processes communicate with all impacted components or systems to remove the secret from circulation.
- Reporting and Alerting: After the match is confirmed and any automated remediation is executed, the scanner notifies authorized staff of the incident, and a report is generated that details the secret identified and measures taken.
- Manual Remediation: If automated scanning is either not feasible or fails for some reason, manual action by authorized staff is necessary to redact or remove the exposed secret. Ensure that the scanning device continues to monitor for the secret until the situation is resolved successfully.
Key Considerations when Choosing a Scanning Tool
Secret scanning is carried out by automated tools that can scan infrastructure for inappropriately stored secrets. Consider these factors in choosing a secret scanning tool:
- CI/CD Integration: Secret scanning tools should work within existing CI/CD (continuous integration / continuous delivery) pipelines, integrating within the workflow to automate scanning of code and other artifacts as part of the development process. The tool should support the most popular CI/CD platforms. Furthermore, it should generally be compatible with security as code (SaC) practices, and should not require significant changes or cause disruptions to the developer experience.
- Scan Accuracy: The tool should have a high degree of accuracy, minimizing incidents of time-wasting false positives, and overlooked vulnerabilities in false negatives. Tools typically operate based on pattern-matching capabilities, while some advanced offerings leverage artificial intelligence or machine learning algorithms to enhance secret detection accuracy.
- Scan Coverage: The secret scanner should provide coverage across all relevant assets, including code repositories, container image scanning, filesystems, configurations, data stores, and backups. This ensures that exposed secrets are found and remediated in all areas of the organization.
- Monitoring and Alerting: Choose secret scanning tools that are able to provide real-time alerts and notifications upon secret detection. The tools should integrate well with existing processes, such as Security Information and Event Management (SIEM) system compatibility and incident response procedures.
When selecting a secret scanning tool, the highest priority items are smooth integration with existing processes, strong detection accuracy, and scanning capabilities.
Best Practices for Secret Management
Implement the following best practices for secure secret management:
- Secure Storage: Secret scanning is a component of secret management, an approach that ensures the secure storage and access of secrets by users and administrators alike. Ensure that secrets are securely stored and encrypted in a dedicated secrets management tool to prevent unauthorized access.
- Restrict Access: The principle of least privilege (PoLP) dictates that users (and services) should only have the minimum access required to complete work tasks. The PoLP directly applies to secrets. Limit user and application access to secrets on a need-to-use basis, and educate staff on secure secret handling procedures.
- Secret Rotation: Implement automated secret rotation procedures which change the secrets on some predefined schedule, or manually upon request. Rotating secrets ensures they have an expiration date, and that damage is limited from accidental exposure.
- Dynamic Secrets: Instead of hardcoding secrets, use environment variables or a secret management system to dynamically swap in secrets. This is an aspect of secure coding practices. Applications can be configured to request secrets from a secure vault through an API call, and the secret is injected into the environment or configuration file at runtime.
- Secret Lifecycle Control: Track the lifecycle of all secrets used within the organization, revoking them when no longer needed or if compromised. Record secret access events and have an easily accessible log for audits.
Meticulous management, access, and control practices are examples of an effective approach to securing secrets in the organization.
Maximize Security with Check Point
Secret scanning automates the identification, classification, and protection of secrets across the organization’s code bases, infrastructure, and assets. Secret scanners are used to ensure that organizations balance strong security measures without interfering with developer workflows or business operations.
CloudGuard Code Security protects code, assets, and infrastructure from pre-production to deployment. It easily integrates with existing development tools, allowing for continuous monitoring and analysis of your codebase for vulnerabilities, misconfigurations, and exposed secrets. See how CloudGuard can safeguard your organization: request a free demo today.
Furthermore, Check Point Spectral makes it easy to protect code from accidental secret exposure. Spectral’s advanced scanning technology prevents breaches by identifying hardcoded API keys, tokens, and credentials. To learn more download the Spectral Product Brief white paper today.