Canary files against infostealers
A canary file (also called a decoy file, honeyfile or honeytoken) looks valuable, but nothing legitimate has a reason to open it. If a program opens it, that is the signal. Infostealers are a good match: they go through the same known places on every PC, and they open everything they find there.
Updated
Why canary files work against infostealers
- Stealers read known places. Their job is to collect from fixed locations: each browser's profile folders, wallet folders, Discord's storage, the Desktop1.
- They take everything there. A stealer can't tell a real wallet from a fake one without opening it, so it opens them all.
- Your own software doesn't. A fake Exodus wallet on a PC without Exodus, or a browser profile the browser doesn't know about, is never opened by anything you use. So false alarms are rare.
- It doesn't matter what the malware looks like. It's caught by what it does, so a brand-new build that no antivirus recognises yet trips it the same way.
What makes a good canary file
- It's where stealers look. A fake
passwords.txton the Desktop, a fake wallet in that wallet's own folder, a fake browser profile next to the real ones. A decoy in a random folder is never touched. - It holds up to a look. A fake browser profile should be a real database with logins in it. A stealer that checks the format shouldn't be able to tell.
- Its name isn't fixed. If every install used the same file names, a stealer could be written to skip them.
- You learn who opened it. “The file was opened” isn't enough. You need the program, where it ran from and what started it.
- The answer is fast. A stealer uploads within seconds. An alert you read tomorrow tells you what was lost; a response within a second can stop it before it sends.
- You don't open it yourself. That counts as a read too.
Canary tokens and local canary files
Canary tokens, such as the free ones from canarytokens.org, are fake credentials, links and documents that alert you when someone uses them2. A local canary file alerts on the PC itself, the moment a program opens it. They catch different moments:
| Canary tokens | Local canary files (ABA) | |
|---|---|---|
| When you find out | When someone uses the stolen token, which can be days later | When a program opens a bait, about 0.1 s after the open |
| What happens to the stealer | Nothing on your PC | Frozen, cut off from the internet, killed if you choose |
| What you learn | That a token was used, and from where | Which program, what started it, what it read and sent |
| Works if the PC is offline or wiped later | Yes | Only while ABA runs on the PC |
They work well together. ABA can use both: with canary tokens turned on in setup, its fake AWS keys and a link in its fake password list are real canarytokens.org tokens.
Set one up yourself on Windows
Windows' own file auditing can make a basic canary file. It records which program opened the file in the Security event log. It doesn't stop anything. You need an administrator account.
- Make a believable file, for example
passwords.txton your Desktop, with a few made-up logins in it. - Turn on file system auditing. In a terminal opened as administrator (on Windows in another language, the subcategory has that language's name):
auditpol /set /subcategory:"File System" /success:enable - Add an audit entry to the file: right-click it › Properties › Security › Advanced, open the Auditing tab (Continue if asked), then Add. Select Everyone as the principal, type Success, and tick the read permissions3.
- Read the log: each time a program opens the file, Windows writes event 4663 (“An attempt was made to access an object”) to Event Viewer › Windows Logs › Security, with the program's full path as the process name4.
What this doesn't do: nothing happens on its own, so by the time you read the log, the stealer is long done. Explorer, search and your antivirus may show up too, and you have to tell them apart yourself. On Linux, fanotify can report opens and even hold them; on macOS, Apple's eslogger reports them.
How ABA does it
ABA is a set of canary files with the rest built around them:
- Baits where stealers look: password lists, a wallet recovery phrase and 2FA backup codes; fake data for apps you don't use (browser profiles that are real databases, MetaMask, Exodus, Electrum and Atomic wallets, Telegram sessions, Discord tokens, FileZilla, AWS keys, SSH keys); and a fake profile inside the browsers you do use. Names differ on every install, and ABA never fakes data for an app you have.
- It hears about an open right away. On Windows, a lock on each bait tells ABA the moment it's opened, with Windows' file auditing (the event above) as a backup. On Linux, the kernel holds the program inside its open until ABA has judged it. On macOS,
esloggerreports it within a few milliseconds. - It judges the program: its signature, the folder it runs from, what started it, and whether it's going through several apps' data at once.
- It acts: freezes the program and what started it, usually within 0.1 s, cuts its internet and shows you what it touched, and whether anything left the PC.
It works next to your antivirus, not instead of it. It only catches a stealer that opens a bait: the limits, in plain words.
Sources
- MITRE ATT&CK, Credentials from Web Browsers (T1555.003).
- Thinkst, Canarytokens documentation.
- Microsoft Learn, Apply a basic audit policy on a file or folder.
- Microsoft Learn, 4663(S): An attempt was made to access an object.
More guides
- What is an infostealer?What they take, how they get in, and why a stolen cookie gets past your password and 2FA.
- How to check your PC for an infostealerThe signs, the scans to run, and what to change first, from another device.
- ABA vs antivirusWhat Windows Defender does, what ABA does, and why you want both.