Home
%3CLINGO-SUB%20id%3D%22lingo-sub-666344%22%20slang%3D%22en-US%22%3ETime%20Series%20visualization%20of%20Palo%20Alto%20logs%20to%20detect%20data%20exfiltration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-666344%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20article%20will%20continue%20discussion%20on%20practical%20time%20series%20analysis%20applications%20in%20security%20with%20another%20use%20case%20focusing%20on%20visualizing%20the%20anomalies%20and%20how%20to%20interpret%20results%20of%20time%20series%20decomposition%20in%20Azure%20Sentinel.%20Please%20refer%20to%20previous%20introductory%20article%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Sentinel%2FLooking-for-unknown-anomalies-what-is-normal-Time-Series%2Fba-p%2F555052%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3ELooking%20for%20unknown%20anomalies%20%E2%80%93%20what%20is%20normal%20%3F%3C%2FA%3E%20for%20high%20level%20overview%20on%20time%20series%20analysis%20and%20step%20by%20step%20guide%20on%20how%20to%20compile%20queries%20to%20detect%20unknown%20anomalies.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3EScenario%3A%20Time%20series%20anomaly%20of%20Palo%20Alto%20Logs%20to%20detect%20data%20exfiltration%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EData%20exfiltration%20is%20common%20tactic%20used%20by%20an%20adversary%20after%20compromising%20system%20for%20movement%20of%20sensitive%20data%20outside%20the%20company%20network.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20read%20more%20about%20various%20techniques%20of%20it%20on%20MITRE%20ATT%26amp%3BCK%20Tactic%20TA0010%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fattack.mitre.org%2Ftactics%2FTA0010%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20this%20detection%20scenario%2C%20we%20are%20focusing%20on%20outbound%20data%20transfer%20size%20attribute%20generally%20logged%20by%20network%20sensor%20logs%20such%20as%20Firewalls%2C%20IDS%2FIPS%20etc%20specifically%20focused%20for%20internal%20networks%20to%20outside%20public%20networks.%20The%20network%20device%20logs%20are%20voluminous%20in%20nature%20and%20in%20a%20vast%20and%20dynamic%20environment%20identifying%20common%20patterns%20and%20deviation%20from%20normal%20baseline%20can%20become%20challenging.%26nbsp%3B%20Time%20Series%20analysis%20will%20help%20us%20in%20identifying%20seasonal%20trends%2C%20baseline%20patterns%20from%20the%20data.%20These%20techniques%20can%20help%20in%20detecting%20anomalies%20which%20are%20deviations%20from%20normal%20baseline%20patterns%20with%20considering%20seasonal%20trends.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EThe%20original%20query%20in%20github%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%2Fblob%2Fmaster%2FDetections%2FMultipleDataSources%2FTimeSeriesAnomaly-MultiVendor_DataExfiltration.txt%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ETimeSeriesAnomaly-MultiVendor_DataExfiltration%3C%2FA%3E%20applies%20for%20multiple%20network%20vendors%20from%20the%3CCODE%3ECommonSecurityLog%3C%2FCODE%3E%20table%2C%20however%20for%20the%20scope%20of%20this%20article%20I%20am%20limiting%20it%20to%20traffic%20logs%20of%20single%20vendor%20Palo%20Alto.%26nbsp%3B%20As%20detailed%20in%20earlier%20blog%2C%20detection%20query%20has%20various%20section%20starting%20with%20preparation%20of%20time%20series%20data%20by%20transforming%20it%20into%20vector%20of%20multi-value%20array%20which%20are%20then%20used%20with%20time%20series%20analysis%20functions%20such%20as%20%3CCODE%3E%3CEM%3Eseries_decompose%3C%2FEM%3E%3C%2FCODE%3E%20and%20%3CCODE%3E%3CEM%3Eseries_decompose_anomalies%3C%2FEM%3E%3C%2FCODE%3E%20to%20detect%20anomalies.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH5%20id%3D%22toc-hId-1175280123%22%20id%3D%22toc-hId-1175280123%22%20id%3D%22toc-hId-1175280123%22%3E%3CFONT%20size%3D%224%22%3E%3CU%3E%3CFONT%20color%3D%22%230000FF%22%3EPreparing%20Time%20Series%20Data%3C%2FFONT%3E%3C%2FU%3E%3C%2FFONT%3E%3C%2FH5%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EQuery%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EThe%20query%20filters%20for%20Traffic%20logs%20for%20vendor%20Palo%20Alto%20Networks.%20The%20PrivateIP%20regex%20pattern%20is%20used%20to%20categorize%20the%20destination%20IP%20into%20Private%20and%20Public%20and%20later%20only%20filter%20the%20events%20with%20Public%20IP%20addresses%20as%20destination.%20For%20this%20table%2C%20%3CCODE%3ESentBytes%3C%2FCODE%3E%20field%20in%20the%20schema%20captures%20the%20outbound%20data%20transfer%20size%20in%20Bytes.%20Make-series%20operator%20used%20to%20prepare%20timeseriesdata%20to%20use%20with%20time%20series%20analysis%20functions%20to%20visualize%20and%20find%20the%20anomalies.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CFONT%20color%3D%22%230000FF%22%3Elet%3C%2FFONT%3E%20starttime%20%3D%2030d%3B%0A%3CFONT%20color%3D%22%230000FF%22%3Elet%3C%2FFONT%3E%20endtime%20%3D%201d%3B%0A%3CFONT%20color%3D%22%230000FF%22%3Elet%3C%2FFONT%3E%20timeframe%20%3D%201h%3B%0A%3CFONT%20color%3D%22%230000FF%22%3Elet%3C%2FFONT%3E%20PrivateIPregex%20%3D%20%40%3CFONT%20color%3D%22%23993300%22%3E'%5E127%5C.%7C%5E10%5C.%7C%5E172%5C.1%5B6-9%5D%5C.%7C%5E172%5C.2%5B0-9%5D%5C.%7C%5E172%5C.3%5B0-1%5D%5C.%7C%5E192%5C.168%5C.'%3C%2FFONT%3E%3B%0A%3CFONT%20color%3D%22%230000FF%22%3Elet%3C%2FFONT%3E%20TimeSeriesData%20%3D%20CommonSecurityLog%20%0A%7C%20%3CFONT%20color%3D%22%23800080%22%3E%3CFONT%20color%3D%22%23FF00FF%22%3Ewhere%3C%2FFONT%3E%20%3C%2FFONT%3ETimeGenerated%20%3CFONT%20color%3D%22%230000FF%22%3Ebetween%3C%2FFONT%3E%20(%3CFONT%20color%3D%22%230000FF%22%3Estartofday%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3Eago%3C%2FFONT%3E(starttime))..%3CFONT%20color%3D%22%230000FF%22%3Estartofday%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3Eago%3C%2FFONT%3E(endtime)))%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Ewhere%3C%2FFONT%3E%20DeviceVendor%20%3D%3D%3CFONT%20color%3D%22%23993300%22%3E%22Palo%20Alto%20Networks%22%3C%2FFONT%3E%20and%20Activity%20%20%3D%3D%20%3CFONT%20color%3D%22%23993300%22%3E%22TRAFFIC%22%3C%2FFONT%3E%20%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Ewhere%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Eisnotempty%3C%2FFONT%3E(DestinationIP)%20and%20%3CFONT%20color%3D%22%230000FF%22%3Eisnotempty%3C%2FFONT%3E(SourceIP)%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Eextend%3C%2FFONT%3E%20DestinationIpType%20%3D%20%3CFONT%20color%3D%22%230000FF%22%3Eiff%3C%2FFONT%3E(DestinationIP%20matches%20regex%20PrivateIPregex%2C%3CFONT%20color%3D%22%23993300%22%3E%22private%22%3C%2FFONT%3E%20%2C%3CFONT%20color%3D%22%23993300%22%3E%22public%22%3C%2FFONT%3E%20)%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Ewhere%3C%2FFONT%3E%20DestinationIpType%20%3D%3D%3CFONT%20color%3D%22%23993300%22%3E%22public%22%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Eproject%3C%2FFONT%3E%20TimeGenerated%2C%20SentBytes%2CDeviceVendor%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Emake-series%3C%2FFONT%3E%20TotalBytesSent%3D%3CFONT%20color%3D%22%230000FF%22%3Esum%3C%2FFONT%3E(SentBytes)%20on%20TimeGenerated%20from%20%3CFONT%20color%3D%22%230000FF%22%3Estartofday%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3Eago%3C%2FFONT%3E(starttime))%20to%20%3CFONT%20color%3D%22%230000FF%22%3Estartofday%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3Eago%3C%2FFONT%3E(endtime))%20%3CFONT%20color%3D%22%230000FF%22%3Estep%3C%2FFONT%3E%20timeframe%20%3CFONT%20color%3D%22%230000FF%22%3Eby%3C%2FFONT%3E%20DeviceVendor%3B%0ATimeSeriesData%3C%2FPRE%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EResults%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EBelow%20result%20indicates%20outbound%20data%20transfer%20in%20bytes%20towards%20Public%20IP%20addresses.%20%3CCODE%3ETimeGenerated%3C%2FCODE%3E%20and%20%3CCODE%3ETotalBytesSent%3C%2FCODE%3E%20columns%20are%20vector%20of%20multi-value%20array%20resulting%20from%20%3CCODE%3E%3CEM%3Emake-series%3C%2FEM%3E%3C%2FCODE%3E%20operator.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117484i8C3C06A47412EAD2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%221-data%20preparation.PNG%22%20title%3D%221-data%20preparation.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH5%20id%3D%22toc-hId--1376876838%22%20id%3D%22toc-hId--1376876838%22%20id%3D%22toc-hId--1376876838%22%3E%3CFONT%20size%3D%224%22%3E%3CU%3E%3CFONT%20color%3D%22%230000FF%22%3EVisualizing%20Time%20Series%20Decomposition%3C%2FFONT%3E%3C%2FU%3E%3C%2FFONT%3E%3C%2FH5%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EQuery%3C%2FSTRONG%3E%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EBelow%20query%20will%20use%20TimeSeriesData%20as%20input%20and%20visualize%20its%20decomposition%20into%20baseline%2C%20seasonal%2C%20trend%20and%20residual%20components.%3C%2FP%3E%0A%3CPRE%3ETimeSeriesData%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Eextend%3C%2FFONT%3E%20(baseline%2Cseasonal%2Ctrend%2Cresidual)%20%3D%20%3CFONT%20color%3D%22%230000FF%22%3Eseries_decompose%3C%2FFONT%3E(TotalBytesSent)%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Erender%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Etimechart%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Ewith%3C%2FFONT%3E%20(title%3D%3CFONT%20color%3D%22%23993300%22%3E%22Palo%20Alto%20Time%20Series%20decomposition%22%3C%2FFONT%3E)%3C%2FPRE%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EResults%3C%2FSTRONG%3E%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EBelow%20figure%20displays%20the%20time%20chart%20decomposition%20of%20hourly%20outbound%20data%20transfer%20size%20observed%20in%20the%2030%20days.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117490i01935B0AD4032B92%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%222-visualization%20decomposition.PNG%22%20title%3D%222-visualization%20decomposition.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDefault%20view%20is%20filtered%20to%20show%20the%20actual%20data%20transfer%2C%20but%20you%20can%20filter%20it%20to%20display%20one%20or%20multi%20views%20(baseline%2C%20seasonal%20%2C%20trend%2C%20residual)%20of%20the%20decomposition%20from%20the%20chart.%3C%2FP%3E%0A%3CP%3EMenu%20options%20for%20%3CCODE%3ETotalBytesSent%3C%2FCODE%3E%20to%20visualize%20charts.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20868px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117489iE48C7DEE457D24E7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%223-menu%20filtering.png%22%20title%3D%223-menu%20filtering.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMenu%20options%20for%20%3CCODE%3EDeviceVendor%3C%2FCODE%3E%20to%20select%20split%20or%20Don%E2%80%99t%20split%20time%20series.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20741px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117491i7D809DDBD2182AFC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%225-menu%20dont%20split.png%22%20title%3D%225-menu%20dont%20split.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eif%20you%20click%20on%20%3CCODE%3EDeviceVendor%3C%2FCODE%3E%20and%20select%20Don%E2%80%99t%20Split%20as%20shown%20in%20above%20screenshot%2C%20you%20will%20get%20check%20box%20to%20multi%20select%20charts.%3C%2FP%3E%0A%3CP%3EBelow%20Menu%20options%20after%20selecting%20Don%E2%80%99t%20Split.%20(Multi%20select%20vs%20radio%20buttons).%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20700px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117492iD8C8C871DE375EBA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%226-menu%20multi%20options.png%22%20title%3D%226-menu%20multi%20options.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBelow%20chart%20displays%20%3CCODE%3ETotalBytesSent%3C%2FCODE%3E%20(Actual)%20vs%20Baseline%20pattern%20overlaying%20each%20other.%20As%20you%20could%20notice%20visually%2C%20we%20have%20some%20spikes%20and%20dips%20in%20actual%20data%20as%20compared%20to%20baseline%20pattern.%20However%2C%20for%20this%20particular%20use%20case%2C%20we%20are%20interested%20only%20in%20spikes%20for%20outbound%20data%20transfer%20which%20are%20highlighted%20with%20arrows%20and%20marked%20as%20anomalies.%20%26nbsp%3BFirst%20anomaly%20specifically%20is%20within%20seasonal%20dip%20patterns%20which%20is%20far%20from%20baseline%20pattern%20hence%20flagged%20with%20score%20above%203.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117493i87A3CC25E6EB9D9D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%227-visualization%20arrows.png%22%20title%3D%227-visualization%20arrows.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH5%20id%3D%22toc-hId-365933497%22%20id%3D%22toc-hId-365933497%22%20id%3D%22toc-hId-365933497%22%3E%3CFONT%20size%3D%224%22%20color%3D%22%230000FF%22%3E%3CU%3EVisualizing%20Time%20Series%20Decomposition%20Anomalies%3C%2FU%3E%3C%2FFONT%3E%3C%2FH5%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EQuery%3C%2FSTRONG%3E%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3ENext%20part%20of%20the%20query%20will%20use%20%3CCODE%3E%3CEM%3Eseries_decompose_anomalies%3C%2FEM%3E%3C%2FCODE%3E%20function%20to%20visualize%20the%20anomalies.%3C%2FP%3E%0A%3CPRE%3ETimeSeriesData%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Eextend%3C%2FFONT%3E%20(anomalies%2C%20score%2C%20baseline)%20%3D%20%3CFONT%20color%3D%22%230000FF%22%3Eseries_decompose_anomalies%3C%2FFONT%3E(TotalBytesSent%2C3%2C%20-1%2C%20%3CFONT%20color%3D%22%23993300%22%3E'linefit'%3C%2FFONT%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Erender%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Etimechart%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Ewith%3C%2FFONT%3E%20(title%3D%3CFONT%20color%3D%22%23993300%22%3E%22Palo%20Alto%20Time%20Series%20anomalies%22%3C%2FFONT%3E)%3C%2FPRE%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EResults%3C%2FSTRONG%3E%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EBelow%20chart%20shows%20timechart%20filtered%20to%20score%20attribute%20calculated%20against%20hourly%20trend%20of%20outbound%20data%20transfer%20after%20comparing%20with%20baseline%20pattern.%20%26nbsp%3BThe%20chart%20shows%20both%20positive%20as%20well%20as%20negative%20anomalies%2C%20but%20we%20are%20only%20interested%20in%20flagging%20positive%20anomalies%20for%20this%20use%20case%20which%20are%20shown%20above%200%20line%20and%20anything%20above%20score%203%20is%20flagged%20as%20anomalies.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117494i6DAB4FAC8F577C82%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%228-score%20visualization.png%22%20title%3D%228-score%20visualization.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH5%20id%3D%22toc-hId-2108743832%22%20id%3D%22toc-hId-2108743832%22%20id%3D%22toc-hId-2108743832%22%3E%3CU%3E%3CFONT%20size%3D%224%22%20color%3D%22%230000FF%22%3EFiltering%20specific%20positive%20anomalies%3C%2FFONT%3E%3C%2FU%3E%3C%2FH5%3E%0A%3CP%3ETabular%20version%20of%20the%20anomalies%20can%20be%20retrieved%20with%20below%20query.%20Note%2C%20since%20network%20data%20sources%20can%20have%20large%20data%20size%20ranges%2C%20we%20are%20keeping%203%20as%20custom%20score%20threshold.%20You%20can%20adjust%20it%20based%20on%20your%20environments%20and%20false%20positive%20acceptance%20criteria.%3C%2FP%3E%0A%3CPRE%3E%3CFONT%20color%3D%22%23FF00FF%22%3Elet%3C%2FFONT%3E%20TimeSeriesAlerts%20%3D%20TimeSeriesData%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Eextend%3C%2FFONT%3E%20(anomalies%2C%20score%2C%20baseline)%20%3D%20%3CFONT%20color%3D%22%230000FF%22%3Eseries_decompose_anomalies%3C%2FFONT%3E(TotalBytesSent%2C3%2C%20-1%2C%20%3CFONT%20color%3D%22%23993300%22%3E'linefit'%3C%2FFONT%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Emv-expand%3C%2FFONT%3E%20TotalBytesSent%20%3CFONT%20color%3D%22%230000FF%22%3Eto%20typeof%3C%2FFONT%3E(double)%2C%20TimeGenerated%20%3CFONT%20color%3D%22%230000FF%22%3Eto%20typeof%3C%2FFONT%3E(datetime)%2C%20anomalies%20%3CFONT%20color%3D%22%230000FF%22%3Eto%20typeof%3C%2FFONT%3E(double)%2Cscore%20%3CFONT%20color%3D%22%230000FF%22%3Eto%20typeof%3C%2FFONT%3E(double)%2C%20baseline%20%3CFONT%20color%3D%22%230000FF%22%3Eto%20typeof%3C%2FFONT%3E(long)%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Ewhere%3C%2FFONT%3E%20anomalies%20%26gt%3B%200%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Eproject%3C%2FFONT%3E%20TimeGenerated%2C%20TotalBytesSent%2C%20baseline%2Cscore%2Canomalies%2C%20deviceVendor%3B%3CBR%20%2F%3ETimeSeriesAlerts%3C%2FPRE%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EResults%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EBelow%20results%20indicates%20anomalies%20which%20are%20greater%20than%20score%20threshold%203.%20You%20can%20also%20notice%2C%20even%20though%20first%20record%20has%20low%20number%20%2C%20it%20is%20still%20far%20from%20the%20baseline%20count%20observed%20in%20seasonal%20dip%20pattern.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117495i78E5BFAB758F7B3F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%229-anomalies%20table.png%22%20title%3D%229-anomalies%20table.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH5%20id%3D%22toc-hId--443413129%22%20id%3D%22toc-hId--443413129%22%20id%3D%22toc-hId--443413129%22%3E%26nbsp%3B%3C%2FH5%3E%0A%3CH5%20id%3D%22toc-hId-1299397206%22%20id%3D%22toc-hId-1299397206%22%20id%3D%22toc-hId-1299397206%22%3E%3CU%3E%3CFONT%20size%3D%224%22%20color%3D%22%230000FF%22%3EInvestigating%20the%20anomalies%3C%2FFONT%3E%3C%2FU%3E%3C%2FH5%3E%0A%3CP%3ETo%20investigate%20the%20anomalies%2C%20we%20need%20to%20query%20respective%20time%20hour%20%2Creview%20all%20the%20events%20and%20identify%20cause%20of%20the%20spike%20as%20compared%20to%20baseline.%20Since%20this%20data%20was%20generated%20for%20demonstration%2C%20I%20will%20just%20list%20the%20investigation%20query%20and%20not%20display%20any%20results.%20The%20result%20of%20this%20query%20will%20be%20dataset%20with%20traffic%20details%20grouped%20by%20source%20to%20destination%20along%20with%20unique%20list%20of%20ports%20and%20services%20for%20it.%20The%20results%20are%20also%20sorted%20by%20%3CCODE%3Escore%3C%2FCODE%3E%20and%20%3CCODE%3ETotalBytesSent%3C%2FCODE%3E%20so%20the%20higher%20results%20bubble%20up%20towards%20top.%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3EQuery%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CPRE%3ETimeSeriesAlerts%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Ejoin%3C%2FFONT%3E%20(%20%0ACommonSecurityLog%20%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Ewhere%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Eisnotempty%3C%2FFONT%3E(DestinationIP)%20%3CFONT%20color%3D%22%230000FF%22%3Eand%20isnotempty%3C%2FFONT%3E(SourceIP)%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Ewhere%3C%2FFONT%3E%20TimeGenerated%20%3CFONT%20color%3D%22%230000FF%22%3Ebetween%3C%2FFONT%3E%20(%3CFONT%20color%3D%22%230000FF%22%3Estartofday%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3Eago%3C%2FFONT%3E(starttime))..%3CFONT%20color%3D%22%230000FF%22%3Estartofday%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3Eago%3C%2FFONT%3E(endtime)))%20%0A%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Esummarize%3C%2FFONT%3E%20HourlyCount%3D%3CFONT%20color%3D%22%230000FF%22%3Ecount%3C%2FFONT%3E()%2C%20ListOfDestPorts%3D%3CFONT%20color%3D%22%230000FF%22%3Emake_set%3C%2FFONT%3E(DestinationPort)%2C%20TotalBytesSent%3D%3CFONT%20color%3D%22%230000FF%22%3Esum%3C%2FFONT%3E(SentBytes)%2CTotalBytesReceived%3D%3CFONT%20color%3D%22%230000FF%22%3Esum%3C%2FFONT%3E(ReceivedBytes)%20%3CFONT%20color%3D%22%230000FF%22%3Eby%3C%2FFONT%3E%20SourceIP%2C%20DestinationIP%2CDeviceVendor%2C%20TimeGenerated%3D%3CFONT%20color%3D%22%230000FF%22%3Ebin%3C%2FFONT%3E(TimeGenerated%2C1h)%0A)%20on%20DeviceVendor%2CTimeGenerated%20%7C%20%3CFONT%20color%3D%22%23FF00FF%22%3Esort%20%3C%2FFONT%3Eby%20score%20%3CFONT%20color%3D%22%230000FF%22%3Edesc%3C%2FFONT%3E%2CTotalBytesSent%20%3CFONT%20color%3D%22%230000FF%22%3Edesc%3C%2FFONT%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%20color%3D%22%23000000%22%3E%3CSTRONG%3EConclusion%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIn%20this%20article%2C%20we%20looked%20into%20another%20example%20analyzing%20hourly%20trend%20of%20outbound%20data%20transfer%20towards%20Public%20IP%20addresses.%20By%20analyzing%20trend%20of%20outbound%20data%20transfer%20over%2030%20days%2C%20we%20detected%20seasonality%20and%20trend%20in%20the%20data%20which%20helped%20to%20identify%20three%20positive%20anomalies%20on%2013%3CSUP%3Eth%3C%2FSUP%3E%20Apr%2017%3A00%20UTC%20%2C17%3CSUP%3Eth%3C%2FSUP%3E%20Apr%2021%3A00%20UTC%20and%2026%3CSUP%3Eth%3C%2FSUP%3E%20Apr%2005%3A00%20UTC.%20%26nbsp%3BThe%20first%20anomaly%20is%20specifically%20detected%20in%20the%20seasonal%20dip%20associated%20with%20weekend.%20With%20the%20traditional%20static%20threshold-based%20approaches%2C%20we%20could%20have%20missed%20flagging%20this%20anomaly.%3C%2FP%3E%0A%3CP%3ERemember%2C%20the%20deviation%20from%20the%20baseline%20count%20alone%20are%20not%20necessarily%20an%20indication%20of%20malicious%20activity%20but%20gathering%20more%20context%20around%20the%20timestamp%20of%20anomaly%20and%20identifying%20the%20cause%20of%20the%20spike%20along%20with%20the%20gathering%20more%20details%20around%20behavior%20of%20traffic%20and%20destination%20addresses%20will%20help%20analyst%20to%20categorize%20it%20as%20malicious%20or%20non-malicious%20which%20is%20what%20investigate%20query%20results%20will%20provide.%20The%20charting%20function%20in%20Sentinel%20gives%20various%20options%20to%20visualize%20the%20data%20and%20analyst%20can%20interpret%20the%20anomalies%20visually.%20%26nbsp%3BAs%20detailed%20in%20previous%20article%2C%20the%20score%20threshold%20value%20provided%20in%20time%20series%20function%20can%20be%20tweaked%20to%20effectively%20flag%20outliers%20which%20are%20actionable%20in%20your%20environments.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EFeel%20free%20to%20submit%20pull%20requests%20on%20other%20time%20series%20analysis%20based%20queries%20on%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Sentinel%20Github%20Repo%3C%2FA%3E%3CSPAN%3E.%20%26nbsp%3BHappy%20Hunting.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%20color%3D%22%23000000%22%3E%3CSTRONG%3EReferences%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ELooking%20for%20unknown%20anomalies%20-%20what%20is%20normal%3F%20Time%20Series%20analysis%20%26amp%3B%20its%20applications%20in%20Security%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CA%20style%3D%22font-family%3A%20inherit%3B%20background-color%3A%20%23ffffff%3B%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Sentinel%2FLooking-for-unknown-anomalies-what-is-normal-Time-Series%2Fba-p%2F555052%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Sentinel%2FLooking-for-unknown-anomalies-what-is-normal-Time-Series%2Fba-p%2F555052%3C%2FA%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EMITRE%20ATT%26amp%3BCK%20Tactic%20TA0010%20%E2%80%93%20Exfiltration.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fattack.mitre.org%2Ftactics%2FTA0010%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fattack.mitre.org%2Ftactics%2FTA0010%2F%3C%2FA%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EKQL%20operators%20syntax%20and%20example%20usage%20documentation.%0A%3CUL%3E%0A%3CLI%3Emake-series%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fmake-seriesoperator%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fmake-seriesoperator%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3Eseries_decompose()%20%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fseries-decomposefunction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fseries-decomposefunction%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3Eseries_decompose_anomalies()%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fseries-decompose-anomaliesfunction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fseries-decompose-anomaliesfunction%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3Emv-expand%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fmvexpandoperator%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fmvexpandoperator%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3Erender%20%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Frenderoperator%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Frenderoperator%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-666344%22%20slang%3D%22en-US%22%3E%3CP%3E%3CFONT%20size%3D%222%22%3EThis%20article%20will%20continue%20discussion%20on%20practical%20time%20series%20analysis%20applications%20in%20security%20with%20another%20use%20case%20focusing%20on%20visualizing%20the%20anomalies%20and%20how%20to%20interpret%20results%20of%20time%20series%20decomposition%20in%20Azure%20Sentinel.%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117483i2FD2193A9D59818C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%227-visualization%20arrows.png%22%20title%3D%227-visualization%20arrows.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-666344%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDetection%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMachine%20Learning%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-746766%22%20slang%3D%22en-US%22%3ERe%3A%20Time%20Series%20visualization%20of%20Palo%20Alto%20logs%20to%20detect%20data%20exfiltration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-746766%22%20slang%3D%22en-US%22%3E%3CP%3EGreat%20article%2C%20Thank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

This article will continue discussion on practical time series analysis applications in security with another use case focusing on visualizing the anomalies and how to interpret results of time series decomposition in Azure Sentinel. Please refer to previous introductory article Looking for unknown anomalies – what is normal ? for high level overview on time series analysis and step by step guide on how to compile queries to detect unknown anomalies.

 

Scenario: Time series anomaly of Palo Alto Logs to detect data exfiltration

Data exfiltration is common tactic used by an adversary after compromising system for movement of sensitive data outside the company network.  

You can read more about various techniques of it on MITRE ATT&CK Tactic TA0010  here.

 

For this detection scenario, we are focusing on outbound data transfer size attribute generally logged by network sensor logs such as Firewalls, IDS/IPS etc specifically focused for internal networks to outside public networks. The network device logs are voluminous in nature and in a vast and dynamic environment identifying common patterns and deviation from normal baseline can become challenging.  Time Series analysis will help us in identifying seasonal trends, baseline patterns from the data. These techniques can help in detecting anomalies which are deviations from normal baseline patterns with considering seasonal trends.

 

The original query in github TimeSeriesAnomaly-MultiVendor_DataExfiltration applies for multiple network vendors from the CommonSecurityLog table, however for the scope of this article I am limiting it to traffic logs of single vendor Palo Alto.  As detailed in earlier blog, detection query has various section starting with preparation of time series data by transforming it into vector of multi-value array which are then used with time series analysis functions such as series_decompose and series_decompose_anomalies to detect anomalies.

 

Preparing Time Series Data

Query:

The query filters for Traffic logs for vendor Palo Alto Networks. The PrivateIP regex pattern is used to categorize the destination IP into Private and Public and later only filter the events with Public IP addresses as destination. For this table, SentBytes field in the schema captures the outbound data transfer size in Bytes. Make-series operator used to prepare timeseriesdata to use with time series analysis functions to visualize and find the anomalies.

 

let starttime = 30d;
let endtime = 1d;
let timeframe = 1h;
let PrivateIPregex = @'^127\.|^10\.|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-1]\.|^192\.168\.';
let TimeSeriesData = CommonSecurityLog 
| where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime)))
| where DeviceVendor =="Palo Alto Networks" and Activity  == "TRAFFIC" 
| where isnotempty(DestinationIP) and isnotempty(SourceIP)
| extend DestinationIpType = iff(DestinationIP matches regex PrivateIPregex,"private" ,"public" )
| where DestinationIpType =="public"
| project TimeGenerated, SentBytes,DeviceVendor
| make-series TotalBytesSent=sum(SentBytes) on TimeGenerated from startofday(ago(starttime)) to startofday(ago(endtime)) step timeframe by DeviceVendor;
TimeSeriesData

Results:

Below result indicates outbound data transfer in bytes towards Public IP addresses. TimeGenerated and TotalBytesSent columns are vector of multi-value array resulting from make-series operator.

 

1-data preparation.PNG

 

Visualizing Time Series Decomposition

Query:

Below query will use TimeSeriesData as input and visualize its decomposition into baseline, seasonal, trend and residual components.

TimeSeriesData
| extend (baseline,seasonal,trend,residual) = series_decompose(TotalBytesSent)
| render timechart with (title="Palo Alto Time Series decomposition")

Results:

Below figure displays the time chart decomposition of hourly outbound data transfer size observed in the 30 days. 

 

2-visualization decomposition.PNG

 

Default view is filtered to show the actual data transfer, but you can filter it to display one or multi views (baseline, seasonal , trend, residual) of the decomposition from the chart.

Menu options for TotalBytesSent to visualize charts.

3-menu filtering.png

 

Menu options for DeviceVendor to select split or Don’t split time series.

5-menu dont split.png

if you click on DeviceVendor and select Don’t Split as shown in above screenshot, you will get check box to multi select charts.

Below Menu options after selecting Don’t Split. (Multi select vs radio buttons).

6-menu multi options.png

 

Below chart displays TotalBytesSent (Actual) vs Baseline pattern overlaying each other. As you could notice visually, we have some spikes and dips in actual data as compared to baseline pattern. However, for this particular use case, we are interested only in spikes for outbound data transfer which are highlighted with arrows and marked as anomalies.  First anomaly specifically is within seasonal dip patterns which is far from baseline pattern hence flagged with score above 3.

7-visualization arrows.png

 

Visualizing Time Series Decomposition Anomalies

Query:

Next part of the query will use series_decompose_anomalies function to visualize the anomalies.

TimeSeriesData
| extend (anomalies, score, baseline) = series_decompose_anomalies(TotalBytesSent,3, -1, 'linefit')
| render timechart with (title="Palo Alto Time Series anomalies")

Results:

Below chart shows timechart filtered to score attribute calculated against hourly trend of outbound data transfer after comparing with baseline pattern.  The chart shows both positive as well as negative anomalies, but we are only interested in flagging positive anomalies for this use case which are shown above 0 line and anything above score 3 is flagged as anomalies.

8-score visualization.png

 

Filtering specific positive anomalies

Tabular version of the anomalies can be retrieved with below query. Note, since network data sources can have large data size ranges, we are keeping 3 as custom score threshold. You can adjust it based on your environments and false positive acceptance criteria.

let TimeSeriesAlerts = TimeSeriesData
| extend (anomalies, score, baseline) = series_decompose_anomalies(TotalBytesSent,3, -1, 'linefit')
| mv-expand TotalBytesSent to typeof(double), TimeGenerated to typeof(datetime), anomalies to typeof(double),score to typeof(double), baseline to typeof(long)
| where anomalies > 0
| project TimeGenerated, TotalBytesSent, baseline,score,anomalies, deviceVendor;
TimeSeriesAlerts

Results:

Below results indicates anomalies which are greater than score threshold 3. You can also notice, even though first record has low number , it is still far from the baseline count observed in seasonal dip pattern.

9-anomalies table.png

 
Investigating the anomalies

To investigate the anomalies, we need to query respective time hour ,review all the events and identify cause of the spike as compared to baseline. Since this data was generated for demonstration, I will just list the investigation query and not display any results. The result of this query will be dataset with traffic details grouped by source to destination along with unique list of ports and services for it. The results are also sorted by score and TotalBytesSent so the higher results bubble up towards top.

Query:

TimeSeriesAlerts
| join ( 
CommonSecurityLog 
| where isnotempty(DestinationIP) and isnotempty(SourceIP)
| where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime))) 
| summarize HourlyCount=count(), ListOfDestPorts=make_set(DestinationPort), TotalBytesSent=sum(SentBytes),TotalBytesReceived=sum(ReceivedBytes) by SourceIP, DestinationIP,DeviceVendor, TimeGenerated=bin(TimeGenerated,1h)
) on DeviceVendor,TimeGenerated | sort by score desc,TotalBytesSent desc

 

Conclusion:

In this article, we looked into another example analyzing hourly trend of outbound data transfer towards Public IP addresses. By analyzing trend of outbound data transfer over 30 days, we detected seasonality and trend in the data which helped to identify three positive anomalies on 13th Apr 17:00 UTC ,17th Apr 21:00 UTC and 26th Apr 05:00 UTC.  The first anomaly is specifically detected in the seasonal dip associated with weekend. With the traditional static threshold-based approaches, we could have missed flagging this anomaly.

Remember, the deviation from the baseline count alone are not necessarily an indication of malicious activity but gathering more context around the timestamp of anomaly and identifying the cause of the spike along with the gathering more details around behavior of traffic and destination addresses will help analyst to categorize it as malicious or non-malicious which is what investigate query results will provide. The charting function in Sentinel gives various options to visualize the data and analyst can interpret the anomalies visually.  As detailed in previous article, the score threshold value provided in time series function can be tweaked to effectively flag outliers which are actionable in your environments. 

 

Feel free to submit pull requests on other time series analysis based queries on Azure Sentinel Github Repo.  Happy Hunting.

 

References:

  • Looking for unknown anomalies - what is normal? Time Series analysis & its applications in Security

https://techcommunity.microsoft.com/t5/Azure-Sentinel/Looking-for-unknown-anomalies-what-is-normal-T...

  • MITRE ATT&CK Tactic TA0010 – Exfiltration.

https://attack.mitre.org/tactics/TA0010/

1 Comment
Regular Visitor

Great article, Thank you!