Techniques
Sample rules
Java Base64 Decoder Argument Exceptions
- source: splunk
- technicques:
Description
The analytic finds Java Base64 decoder references and argument exceptions on the same JVM process within one minute. JIT messages add context when present. These logs indicate decoder activity and errors, but do not prove that a native overwrite or code execution occurred.
Detection logic
(`java_hotspot_jit` OR `java_hotspot_exceptions`)
(
"*Input byte array has wrong*"
OR "*IllegalArgumentException*"
OR "*Base64$Decoder*"
OR "*java/util/Base64*"
OR "*OSR invalidation of lower level*"
)
| rex field=_raw "^\[(?<jvm_event_time_raw>[^\]]+)\]\[(?<jvm_pid_raw>\d+)\]\[(?<jvm_level_raw>[^\]]+)\]\[(?<jvm_tags_raw>[^\]]+)\]\s*(?<jvm_message_raw>.*)"
| eval process_id=coalesce(jvm_pid_raw,jvm_pid,process_id),
jvm_message=coalesce(jvm_message_raw,jvm_message),
event_time=_time
| where isnotnull(process_id)
| rex mode=sed field=jvm_message "s/0x[0-9A-Fa-f]{8,16}/0xXXXXXXXXXXXXXXXX/g"
| rex mode=sed field=jvm_message "s/\s+bci\s+\d+\s+/ bci XXX /g"
| rex mode=sed field=jvm_message "s/^\d+\s+/XXXX /g"
| eval has_argument=if(match(jvm_message,"(?i)Input byte array has wrong
|IllegalArgumentException"),1,0),
has_decoder=if(match(jvm_message,"Base64[$]Decoder
|java/util/Base64
|Input byte array has wrong 4-byte ending unit"),1,0)
| eval reason=case(
match(jvm_message,"(?i)Input byte array has wrong"),"Tailing byte exception",
match(jvm_message,"(?i)OSR invalidation of lower level"),"JIT activity",
has_decoder==1,"Base64 decoder reference",
has_argument==1,"Argument exception"
)
| bin _time span=1m
| stats count
min(event_time) AS firstTime
max(event_time) AS lastTime
max(has_argument) AS has_argument
max(has_decoder) AS has_decoder
values(sourcetype) AS sourcetype
dc(sourcetype) AS dc_sourcetype
values(source) AS source
dc(source) AS dc_source
values(reason) AS reason
values(jvm_message) AS jvm_message
BY _time host process_id
| where has_argument==1 AND has_decoder==1
| rename host AS dest
| fields - has_argument has_decoder
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `java_base64_decoder_argument_exceptions_filter`