Splunk Search

Base64 Search decoder Not Working on all fields

SD-SPL-4498
Observer

Hi All,

So I've created the logic below to decode base64. Other discussions on this topic give possible solutions but only work when what has been encoded is smaller in size because of use of list in their stats command.

My Logic Looks like this:

 

 

| eval time=_time | appendpipe [ | eval converts=split(encoded,"") | mvexpand converts | lookup base64conversion.csv index as converts OUTPUT value as base64bin | table encoded, base64bin, time | mvcombine base64bin | eval combined=mvjoin(base64bin,"") | rex field=combined "(?<asciibin>.{8})" max_match=0 | mvexpand asciibin | lookup base64conversion.csv index as asciibin OUTPUT value as outputs | table encoded, outputs, time | mvcombine outputs | eval decoded=mvjoin(outputs,"") | table encoded, decoded, time ] | selfjoin time 

 

 

And looks like this in a test environment:

SDSPL4498_0-1701355710054.png

This is partially taken from other people's work but so some of it may be familiar to other discussions.

My issue is when put into a larger search, it doesn't work for all values, especially the seemingly longer ones. I can't show it in action unfortunately but if you have a number of encoded commands to run it against it will only do it for one of them. I thought this might be because the self join for time is not entirely unique but I'm starting to think it's because I'm not using a stats command before the appendpipe to group by encoded, even when I do that though it still doesn't work.

The lookup I'm using is based on the one discussed here:
https://community.splunk.com/t5/Splunk-Search/base64-decoding-in-search/m-p/27572
At this point I will likely just install an app if no one can resolve this.

I thought I'd ask to get other people's points of view, any help would be much appreciated.

Labels (3)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

any reason why you don't want to use this https://splunkbase.splunk.com/app/5565 ?

r. Ismo

0 Karma

SD-SPL-4498
Observer

Ah interesting, I hadn't seen that specific one before but had seen others in a similar vein.

My main hope was to not have to install any new apps as I'm working for a client and it'd create more work keeping it up to date, plus I thought a macro (what I was hoping to turn it into) could be easily transferred anywhere.

But I think maybe using python/apps is the best bet, has a lot more features and just works better, with a lot more error checking possible.

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...