---
title: "4. Credential hunting"
date: 2025-01-24
draft: false
---

Always note credentials
- `.conf`
- `.config`
- `.xml` 
- `.bak` 

Within database files, text files etc. creds can always be found. 
`/var` typically contains web root for whatever webserver is running on the host. Web root can frequently contain database credentials 

Example wordpress for mysql: 
```shell-session
cat wp-config.php | grep 'DB_USER\|DB_PASSWORD'

define( 'DB_USER', 'wordpressuser' );
define( 'DB_PASSWORD', 'WPadmin123!' );
```

**Spool** and **Mail** directories if accessible can contain valuable information or even credentials. Common to find creds stored in web root. 
```shell-session
find / ! -path "*/proc/*" -iname "*config*" -type f 2>/dev/null
```

**SSH Keys**
Search around for accessible ssh private keys. We may locate a priv key for another more privileged user. May also find SSH keys that can be used to access other hosts in the environment. 
Whenever finding SSH keys check `known_hosts` file to find targets. Self explanatory. 
