Techniques
Sample rules
Zeek HTTP Malformed Base64 Padding
- source: splunk
- technicques:
Description
The analytic hunts for an HTTP header, POST body, or URI containing at least one 64-character Base64 block followed by a short padded fragment. This malformed shape can reach a vulnerable Java Base64 decoder, but its presence in traffic alone does not prove that the server decoded it.
Detection logic
(
`zeek_http_request_headers`
header_value="*=*"
truncated=false
)
OR
(
`zeek_http_post_body`
body="*=*"
truncated=false
)
OR
(
`zeek_http_uri`
uri IN ("*=*","*%3D*","*%3d*")
)
| eval request_value=case(
isnotnull(header_value),header_value,
isnotnull(body),body,
isnotnull(uri),urldecode(uri)
),
carrier=case(
isnotnull(header_value),header_name,
isnotnull(body),"POST body",
isnotnull(uri),"URI"
),
dest_port=coalesce(dest_port,'id.resp_p'),
dest=coalesce(dest,dest_ip,'id.resp_h'),
src=coalesce(src,src_ip,'id.orig_h')
| rex field=request_value "(?<![A-Za-z0-9+/_-])(?<malformed_base64>(?:(?:[A-Za-z0-9+/]{64})+(?:[A-Za-z0-9+/]{0,2}=
|[A-Za-z0-9+/]?==)
|(?:[A-Za-z0-9_-]{64})+(?:[A-Za-z0-9_-]{0,2}=
|[A-Za-z0-9_-]?==)))(?![A-Za-z0-9+/_=-])"
| where isnotnull(malformed_base64)
| stats count
min(_time) AS firstTime
max(_time) AS lastTime
values(carrier) AS carrier
values(uid) AS zeek_uid
values(uri) AS uri
values(body) AS body
BY src dest dest_port method malformed_base64
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `zeek_http_malformed_base64_padding_filter`