Compromised UniFi Controller
General pointers on where to look for configuration files and/or logs when investigating a compromised UniFi controller.
Last updated
General pointers on where to look for configuration files and/or logs when investigating a compromised UniFi controller.
Last updated
For tips on acquiring a full disk image via SSH, please see Acquiring Linux VPS via SSH
This page only provides a summary of files of interest, and where you may look for specific information. It doesn't include any information on how to investigate the initial compromise itself (ie username/password bruteforcing over SS
UniFi controller log /var/log/unifi/server.log (and server.log.* for archived/pruned logs)
This contains the following;
Failed and successful authentication attempts (with reason, for example 'Invalid Credential', 'Invalid Username'
Username associated with those attempts
IP address of remote host attempting to authenticate
MAC address of device syncing with controller
WAN & local IP address of devices synced with controller
Logs for system upgrades
INFO/WARN level for API and DEV (device) associations
Controller site identifier (appears to be 8 alpha-numeric character string)
/var/lib/unifi/db/collection-*-*.wt
Appears to be WiredTiger log files before they're committed to the core server logs
(.wt is the file extension associated with the files, WiredTiger appears to be the engine contained within mongoDB)
/backup; meta.json file for time/date when backup was created, 5.x.x.unf for backup itself
/backup/autobackup; autobackup_meta.json for time/date when autobackup was created, and a series of .unf auto backups.
/db; series of WiredTiger collection logs, index logs, version control logs, etc.
/db/diagnostic.data & /db/journal; self-explanatory - journal and diagnostic information.
/sites/*; folder for each site configured on the controller (8 alpha-numeric character identifer, plus a folder for the default site)
/sites/abcd1234/maps; map photograph/layout associated with the site ID
Not strictly a UniFi controller related file as such, but it's part of the Java performance counter which still includes sensitive information (usernames, email addresses, password hash, local performance statistics)
I'm not too sure why this file & hidden directory (.unifi-***) is generated, but nevertheless it still contains sensitive information & database contents relative to an investigation (usernames, emails, IP addresses, etc). It's the contents of the mongoDB (ace) associated with the UniFi controller.
/usr/lib/unifi/logs (symlink to /var/log/unifi)
/usr/lib/unifi/run (symlink to /var/run/unifi)
/usr/lib/unifi/data (symlink to /var/lib/unifi)
/usr/lib/unifi/bin (binaries for ubnt-apttool and unifi.init, including a symlink to /usr/bin/mongod)
/usr/lib/unifi/dl/firmware (bundles.json for different firmware revisions for specific models)
/usr/lib/unifi/lib/* - jar files for specific java archives)
/usr/lib/unifi/webapps/ROOT (root for web interface, including angular & react files)
To list accounts associated with the UniFi controller database (if you suspect a backdoor administrator account has been added), either check through the controller interface itself, or SSH into the host and execute the following command. This will list each account, password hash, epoch time created, email address, name, etc)
mongoDB only listens on the localhost for connections (which is great, it's not exposed to the greater internet like most other mongoDB instances), so if you want to acquire a copy of the database and interrogate it locally, you'll need to export/dump the database first.
/var/lib/unifi/
/tmp/hsperfdata_root/control/0
/tmp/.unifi-********/db.gz/db
/usr/lib/unifi