Credentials in Configuration Files
Credentials in Configuration Files [T1552.006]
Information
Introduction
Credentials in Configuration Files (T1552.006) is a sub-technique of MITRE ATT&CK's "Unsecured Credentials" (T1552) tactic, falling under the "Credential Access" category. Attackers exploit this sub-technique by locating and extracting credentials stored insecurely within configuration files. These files often contain sensitive information such as usernames, passwords, API keys, authentication tokens, or other secrets that allow adversaries to escalate privileges, move laterally, or maintain persistence within compromised systems or networks.
Deep Dive Into Technique
Attackers utilizing this sub-technique typically look for configuration files containing plaintext or weakly encrypted credentials. Configuration files may include:
Application configuration files (e.g.,
.ini
,.cfg
,.conf
,.properties
,.xml
,.json
,.yaml
,.yml
files)Web application configuration files (e.g.,
web.config
,.htaccess
,.env
)System or user-specific configuration files (e.g.,
.bashrc
,.bash_profile
,.gitconfig
)Database configuration files (e.g.,
my.cnf
,postgresql.conf
)Cloud service configuration files (e.g., AWS credentials files)
Attackers typically perform the following steps:
Discovery: Scanning file systems, repositories, and cloud storage for configuration files.
Extraction and Parsing: Using scripts and automated tools to extract credentials from discovered files.
Credential Abuse: Leveraging the credentials to authenticate, escalate privileges, or pivot to additional systems.
Common tools and techniques attackers may use include:
Command-line utilities (
grep
,find
,strings
)Automated credential harvesting scripts (e.g., custom Python or PowerShell scripts)
Open-source reconnaissance tools (e.g., Gitrob, truffleHog, Git-secrets)
Cloud enumeration tools (e.g., Pacu, ScoutSuite)
Real-world attackers frequently exploit credentials found in version control repositories, publicly exposed web directories, backups, and improperly secured cloud storage buckets.
When this Technique is Usually Used
This sub-technique can appear at various stages throughout an attack lifecycle, including:
Initial Access:
Attackers discover publicly exposed configuration files through misconfigured web servers, repositories, or cloud storage.
Credential Access and Privilege Escalation:
Attackers search local file systems for stored credentials after initial compromise to escalate privileges or access higher-value targets.
Lateral Movement:
Credentials obtained from configuration files may allow attackers to move laterally to other systems or services within the network.
Persistence:
Attackers reuse extracted credentials to maintain persistent access to compromised systems or cloud environments.
Attackers frequently rely on this technique when:
Configuration files are poorly secured or misconfigured.
Credentials are stored in plaintext or weakly encrypted formats.
Version control repositories inadvertently include sensitive configuration files.
Cloud environments are misconfigured, exposing configuration files or environment variables publicly.
How this Technique is Usually Detected
Detection methods for credentials stored in configuration files include:
File Integrity Monitoring (FIM):
Monitoring critical configuration files for unauthorized changes or access.
Endpoint Detection and Response (EDR):
Monitoring file access patterns and suspicious file searches on endpoints.
Security Information and Event Management (SIEM):
Aggregating logs from file system events, access logs, and audit trails to detect unusual file access or enumeration patterns.
Data Loss Prevention (DLP):
Identifying and alerting on sensitive credential data leaving the organization perimeter or being accessed improperly.
Configuration Auditing and Scanning Tools:
Regularly scanning file systems and repositories for credentials stored in plaintext or insecure formats (e.g., truffleHog, Git-secrets, AWS Config Rules, ScoutSuite).
Cloud Access Security Brokers (CASB):
Monitoring cloud environments for misconfigured storage buckets or exposed configuration files containing credentials.
Indicators of Compromise (IoCs) associated with this sub-technique include:
Unusual file access or modification patterns on critical or sensitive configuration files.
Access logs indicating suspicious enumeration attempts (e.g., repetitive access to
.env
,.config
,.conf
,.json
,.yml
files).Detection of credential harvesting scripts or tools (e.g., Gitrob, truffleHog) on endpoints.
Alerts from DLP or CASB tools indicating sensitive data exposure.
Why it is Important to Detect This Technique
Early detection of credentials stored in configuration files is crucial due to the following potential impacts:
Privilege Escalation:
Attackers use discovered credentials to escalate privileges, gaining administrative or root-level access.
Lateral Movement:
Stolen credentials enable attackers to move laterally, compromising additional systems and services within the network.
Data Breaches:
Compromised credentials can lead directly to unauthorized access, exfiltration, or destruction of sensitive data.
Operational Disruption:
Attackers with valid credentials can disrupt business operations, disable services, or cause downtime.
Persistence and Long-term Compromise:
Attackers may leverage compromised credentials to establish persistent footholds, making remediation challenging and costly.
Early detection and remediation prevent attackers from establishing persistence, limit the scope of lateral movement, and significantly reduce the potential damage and cost associated with a breach.
Examples
Real-world examples of attacks leveraging credentials in configuration files include:
Uber Data Breach (2016):
Attackers discovered AWS credentials stored in plaintext within source code repositories hosted on GitHub. The compromised credentials allowed attackers to access sensitive data from Uber's AWS storage, exposing millions of user records.
Capital One Breach (2019):
An attacker exploited misconfigured AWS resources and extracted credentials stored in configuration files. These credentials provided access to Capital One's cloud storage, resulting in exposure of sensitive customer data.
SolarWinds Supply Chain Attack (2020):
Attackers compromised SolarWinds Orion software, embedding malicious code that leveraged stored credentials in configuration files on victim systems. This allowed attackers to escalate privileges and move laterally across multiple affected organizations.
Imperva Data Exposure (2019):
Imperva disclosed a data breach resulting from unauthorized access to a database. Investigation revealed credentials stored insecurely in configuration files, allowing attackers to gain access to sensitive customer data.
Common tools and methods attackers used in these incidents:
Automated scripts (Python, Bash, PowerShell) to parse and extract credentials from configuration files.
Publicly available reconnaissance tools (e.g., Gitrob, truffleHog) to scan repositories for credentials.
Exploiting misconfigured cloud storage buckets or repositories inadvertently exposing sensitive configuration files.
Impacts of these attacks included financial losses, reputational harm, regulatory penalties, and significant remediation efforts.
Last updated
Was this helpful?