Splunk Search

Finding original URL where the request came from when http_referrer is not available

neerajs_81
Builder

Hello, When analyzing web traffic logs, at times the url field does not have a http_referrer field.  We are interested in finding out which URL did the original request came from ?  There is looping involved.
 THis is similar to the post:  https://community.splunk.com/t5/Getting-Data-In/Loop-through-URL-and-http-referrer-to-find-original-...

In the above post, user makes use of a script which I cannot use in my environment.  How to then use the MAP command or any other command to recursively/loop thru the URL field and find out which was the original domain ?

For example:
index=firewall url =malicious-domain.com
Actual flow of traffic:
abc.com  >>> bcd.com  >>  No Http_Referrer field  >> malicious-domain.com  ( http_referrer is <empty>) 

Expected result:
abc.com

Labels (4)
0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @neerajs_81,

Only filtering URL should be enough. I could only test with your sample data. You may need to adjust according to indexed data.

 

index="firewall" sourcetype="proxy" URL="malicious-domain.com"
| map search="search index="firewall" sourcetype="proxy" http_referrer=$URL$ OR http_referrer="-" | eval finalURL=$URL$ " 
| map search="search index="firewall" sourcetype="proxy" http_referrer=$http_referrer$ | eval finalURL=$finalURL$ " 
| search http_referrer="-" 
| dedup _raw 
| rename URL as originalURL 
| table finalURL originalURL
If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

scelikok
SplunkTrust
SplunkTrust

Hi @neerajs_81,

Only filtering URL should be enough. I could only test with your sample data. You may need to adjust according to indexed data.

 

index="firewall" sourcetype="proxy" URL="malicious-domain.com"
| map search="search index="firewall" sourcetype="proxy" http_referrer=$URL$ OR http_referrer="-" | eval finalURL=$URL$ " 
| map search="search index="firewall" sourcetype="proxy" http_referrer=$http_referrer$ | eval finalURL=$finalURL$ " 
| search http_referrer="-" 
| dedup _raw 
| rename URL as originalURL 
| table finalURL originalURL
If this reply helps you an upvote and "Accept as Solution" is appreciated.

neerajs_81
Builder

Thank you.  I am getting close  but not there yet.  In my case, the original URL shows many different URLs . There is not one specific originalURL in the results.  There is no way microsoft.com would be responsible for triggering that malicious domain.  Anyways,Appreciate your quick response.

My Results:

finalURLoriginalURL
malicious.comoutlook.office365.com
malicious.commicrosoft.com
malicious.comapp.growme.com:443
malicious.comxxxxxx
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @neerajs_81,

I just replied on your previous question in the previous post.

Please try below;

index="firewall" sourcetype="proxy" 
| map search="search index="firewall" sourcetype="proxy" http_referrer=$URL$ OR http_referrer="-" | eval finalURL=$URL$ " 
| map search="search index="firewall" sourcetype="proxy" http_referrer=$http_referrer$ | eval finalURL=$finalURL$ " 
| search http_referrer="-" 
| dedup _raw 
| rename URL as originalURL 
| table finalURL originalURL
If this reply helps you an upvote and "Accept as Solution" is appreciated.
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...