Detection rule
File Decoded From Base64/Hex Via Certutil.EXE
Overview
Detects the execution of certutil with either the "decode" or "decodehex" flags to decode base64 or hex encoded files. This can be abused by attackers to decode an encoded payload before execution
- Rule id
cc9cbe82-7bc0-4ef5-bc23-bbfb83947be7- ATT&CK techniques
- T1027 Obfuscated Files or Information
- Severity
- High
- Confidence
- Low
- Origin
- SigmaHQ (community)
- SigmaHQ status
test- Used in defense packs
- n0n, The Gentlemen, qilin, safepay, rhysida, Play, everest, nightspire
Validation
- ExperimentalSyntax checked only. Not yet tested on events.
- Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
- SIEM-validatedRun in a real SIEM, with a recorded result.
2 of 2 positive test events matched; 1 of 1 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.
Detection logic and queries
Queries are shown exactly as generated. Test them in your environment before you deploy them.
Sigma
Sigma (YAML) · cc9cbe82-7bc0-4ef5-bc23-bbfb83947be7
title: File Decoded From Base64/Hex Via Certutil.EXE
id: cc9cbe82-7bc0-4ef5-bc23-bbfb83947be7
status: test
description: Detects the execution of certutil with either the "decode" or "decodehex" flags to decode base64 or hex encoded files. This can be abused by attackers to decode an encoded payload before execution
references:
- https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/certutil
- https://unit42.paloaltonetworks.com/new-babyshark-malware-targets-u-s-national-security-think-tanks/
- https://news.sophos.com/en-us/2021/04/13/compromised-exchange-server-hosting-cryptojacker-targeting-other-exchange-servers/
- https://twitter.com/JohnLaTwC/status/835149808817991680
- https://learn.microsoft.com/en-us/archive/blogs/pki/basic-crl-checking-with-certutil
- https://lolbas-project.github.io/lolbas/Binaries/Certutil/
author: Florian Roth (Nextron Systems), Jonhnathan Ribeiro, oscd.community
date: 2023-02-15
modified: 2025-06-04
tags:
- attack.stealth
- attack.t1027
logsource:
category: process_creation
product: windows
detection:
selection_img:
- Image|endswith: '\certutil.exe'
- OriginalFileName: 'CertUtil.exe'
selection_cli:
CommandLine|contains|windash:
- '-decode ' # Decode Base64
- '-decodehex ' # Decode Hex
condition: all of selection_*
falsepositives:
- Unknown
level: high
regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_certutil_decode/info.ymlQRadar AQL
IBM QRadar AQL (hunting query)Hunting query
Hunting search for the Log Activity tab or the API. It is not a QRadar rule.
AQL search for the Log Activity tab or the API. It is NOT a deployable QRadar rule: real-time detection in QRadar is a CRE (Custom Rule Engine) rule, for which this build only writes a design specification (qradar_cre).
SELECT * FROM events WHERE devicetype=12 AND ((LOWER("Process Path") LIKE '%\certutil.exe' OR LOWER("Process Name") LIKE '%\certutil.exe') OR Filename='CertUtil.exe') AND (LOWER(Command) LIKE '%-decode %' OR LOWER(Command) LIKE '%/decode %' OR LOWER(Command) LIKE '%–decode %' OR LOWER(Command) LIKE '%—decode %' OR LOWER(Command) LIKE '%―decode %' OR LOWER(Command) LIKE '%-decodehex %' OR LOWER(Command) LIKE '%/decodehex %' OR LOWER(Command) LIKE '%–decodehex %' OR LOWER(Command) LIKE '%—decodehex %' OR LOWER(Command) LIKE '%―decodehex %')QRadar CRE
Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.
- Rule name
OffSet7: File Decoded From Base64/Hex Via Certutil.EXE- Rule type
- Event rule (Local)
- Log source types
- Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1
Building blocks
BB:OffSet7:File Decoded From Base64 Hex Via Certutil EXE:selection_img(match)Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.Process Path / Process Nameends with:\certutil.exeFilenameis equal to (case-insensitive):CertUtil.exe
BB:OffSet7:File Decoded From Base64 Hex Via Certutil EXE:selection_cli(match)All test lines must match (AND).Commandcontains:-decode,-decodehex
Main rule, option A (building blocks)
- when the event(s) were detected by one or more of these log source types:
Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1 - when an event matches the condition built from these building blocks:
(ALL of [BB:OffSet7:File Decoded From Base64 Hex Via Certutil EXE:selection_img, BB:OffSet7:File Decoded From Base64 Hex Via Certutil EXE:selection_cli])
Main rule, option B (AQL filter test)
- when the event matches this AQL filter query:
devicetype=12 AND ((LOWER("Process Path") LIKE '%\certutil.exe' OR LOWER("Process Name") LIKE '%\certutil.exe') OR Filename='CertUtil.exe') AND (LOWER(Command) LIKE '%-decode %' OR LOWER(Command) LIKE '%/decode %' OR LOWER(Command) LIKE '%–decode %' OR LOWER(Command) LIKE '%—decode %' OR LOWER(Command) LIKE '%―decode %' OR LOWER(Command) LIKE '%-decodehex %' OR LOWER(Command) LIKE '%/decodehex %' OR LOWER(Command) LIKE '%–decodehex %' OR LOWER(Command) LIKE '%—decodehex %' OR LOWER(Command) LIKE '%―decodehex %')
Rule response
- Severity 7, credibility 6, relevance 7
- Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
- Respond no more than once per 30 minutes per Log Source (tune per environment)
Limitations
- QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.
Splunk
Splunk SPLSearch
Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.
(Image="*\\certutil.exe" OR OriginalFileName="CertUtil.exe") (CommandLine="*-decode *" OR CommandLine="*/decode *" OR CommandLine="*–decode *" OR CommandLine="*—decode *" OR CommandLine="*―decode *" OR CommandLine="*-decodehex *" OR CommandLine="*/decodehex *" OR CommandLine="*–decodehex *" OR CommandLine="*—decodehex *" OR CommandLine="*―decodehex *")Splunk savedsearches.conf stanzaScheduled search template
Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.
[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now
[File Decoded From Base64/Hex Via Certutil.EXE]
description = Detects the execution of certutil with either the "decode" or "decodehex" flags to decode base64 or hex encoded files. This can be abused by attackers to decode an encoded payload before execution
search = (Image="*\\certutil.exe" OR OriginalFileName="CertUtil.exe") (CommandLine="*-decode *" OR CommandLine="*/decode *" OR CommandLine="*–decode *" OR CommandLine="*—decode *" OR CommandLine="*―decode *" OR CommandLine="*-decodehex *" OR CommandLine="*/decodehex *" OR CommandLine="*–decodehex *" OR CommandLine="*—decodehex *" OR CommandLine="*―decodehex *")Microsoft Sentinel
Microsoft Sentinel KQL (ASIM)Hunting query
Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.
imProcessCreate
| where (TargetProcessName endswith "\\certutil.exe" or TargetProcessFileOriginalName =~ "CertUtil.exe") and (TargetProcessCommandLine contains "-decode " or TargetProcessCommandLine contains "/decode " or TargetProcessCommandLine contains "–decode " or TargetProcessCommandLine contains "—decode " or TargetProcessCommandLine contains "―decode " or TargetProcessCommandLine contains "-decodehex " or TargetProcessCommandLine contains "/decodehex " or TargetProcessCommandLine contains "–decodehex " or TargetProcessCommandLine contains "—decodehex " or TargetProcessCommandLine contains "―decodehex ")Defender XDR
Microsoft Defender XDR KQLHunting query
Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.
DeviceProcessEvents
| where (FolderPath endswith "\\certutil.exe" or ProcessVersionInfoOriginalFileName =~ "CertUtil.exe") and (ProcessCommandLine contains "-decode " or ProcessCommandLine contains "/decode " or ProcessCommandLine contains "–decode " or ProcessCommandLine contains "—decode " or ProcessCommandLine contains "―decode " or ProcessCommandLine contains "-decodehex " or ProcessCommandLine contains "/decodehex " or ProcessCommandLine contains "–decodehex " or ProcessCommandLine contains "—decodehex " or ProcessCommandLine contains "―decodehex ")Elastic
Elastic Lucene (ECS)Hunting query
Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.
(process.executable:*\\certutil.exe OR process.pe.original_file_name:CertUtil.exe) AND (process.command_line:(*\-decode\ * OR *\/decode\ * OR *–decode\ * OR *—decode\ * OR *―decode\ *) OR process.command_line:(*\-decodehex\ * OR *\/decodehex\ * OR *–decodehex\ * OR *—decodehex\ * OR *―decodehex\ *))Elastic EQL (ECS)Hunting query
EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.
any where (process.executable:"*\\certutil.exe" or process.pe.original_file_name:"CertUtil.exe") and (process.command_line like~ ("*-decode *", "*/decode *", "*–decode *", "*—decode *", "*―decode *") or process.command_line like~ ("*-decodehex *", "*/decodehex *", "*–decodehex *", "*—decodehex *", "*―decodehex *"))Elastic ES|QL (ECS)Hunting query
ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.
from * metadata _id, _index, _version | where (ends_with(process.executable, "\\certutil.exe") or process.pe.original_file_name=="CertUtil.exe") and (process.command_line like "*-decode *" or process.command_line like "*/decode *" or process.command_line like "*–decode *" or process.command_line like "*—decode *" or process.command_line like "*―decode *" or process.command_line like "*-decodehex *" or process.command_line like "*/decodehex *" or process.command_line like "*–decodehex *" or process.command_line like "*—decodehex *" or process.command_line like "*―decodehex *")Required telemetry
- Log source
product: windows · category: process_creation- Fields used
CommandLineImageOriginalFileName
False positives
- Unknown
Investigation and response
No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.
References
- https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/certutil
- https://unit42.paloaltonetworks.com/new-babyshark-malware-targets-u-s-national-security-think-tanks/
- https://news.sophos.com/en-us/2021/04/13/compromised-exchange-server-hosting-cryptojacker-targeting-other-exchange-servers/
- https://twitter.com/JohnLaTwC/status/835149808817991680
- https://learn.microsoft.com/en-us/archive/blogs/pki/basic-crl-checking-with-certutil
- https://lolbas-project.github.io/lolbas/Binaries/Certutil/
Author and attribution
- Author
- Florian Roth (Nextron Systems), Jonhnathan Ribeiro, oscd.community
- Source
- SigmaHQ ·
rules/windows/process_creation/proc_creation_win_certutil_decode.yml - Upstream commit
9688134317a2- Licence
- Detection Rule License (DRL) 1.1
Version history
- Version 1Imported from SigmaHQ
- OffSet7 build · SigmaHQ
9688134317a2