StamusNetworks / KTS6

Kibana 6 Templates for Suricata IDPS Threat Hunting
GNU General Public License v3.0
25 stars 6 forks source link

java.lang.NullPointerException #8

Open Marshal27 opened 5 years ago

Marshal27 commented 5 years ago

This is an issue with the toLowerCase() method when applied to null values on the doc.

Caused by: java.lang.NullPointerException at org.elasticsearch.painless.DefBootstrap$PIC.checkClass(DefBootstrap.java:143) ~[?:?] at org.elasticsearch.painless.PainlessScript$Script.execute('ip == ' + doc['src_ip.keyword'].value + ' && ...:223) ~[?:?]

The issue is in the FPC script to generate the URL. Would be a good idea to perform a null check on this value before attempting to generate the URL... I made the assumption that if the protocol is not available, you may not want a URL generated...

if(doc['proto.keyword'].value != null){ 'ip == ' + doc['src_ip.keyword'].value + ' && port == ' + doc['src_port'].value + ' && ip == ' + doc['dest_ip.keyword'].value + ' && port == ' + doc['dest_port'].value + ' && protocols == ' + doc['proto.keyword'].value.toLowerCase()}

pevma commented 5 years ago

That seems a good point. In what case is proto.keyword null ? (Was wondering if you have the example from the exception you have triggered)

opoplawski commented 5 years ago

I think the issue may be mixing in other non-suricata log data in the index that does not contain a proto field? Or should that be handled. I'm not sure how to search for null proto.keyword values.

pevma commented 5 years ago

It maybe that mixing diff sources could be the issue but in Kibana (for the FPC links specifically ) they are based out of dashboards that are looking into specific Suricata generated (logs)indexes. Example ‘logstash-alert’, ‘logstash-http’.... etc. So an example of the log that recreates the issue would be interested to look at and investigate.

-- Regards, Peter Manev

On 25 Jan 2019, at 21:18, Orion Poplawski notifications@github.com wrote:

I think the issue may be mixing in other non-suricata log data in the index that does not contain a proto field? Or should that be handled. I'm not sure how to search for null proto.keyword values.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.