Home
%3CLINGO-SUB%20id%3D%22lingo-sub-430740%22%20slang%3D%22en-US%22%3EAzure%20Sentinel%3A%20Performing%20Additional%20Security%20Monitoring%20of%20High-Value%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-430740%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3EIntroduction%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMost%20if%20not%20every%20environment%20has%20high-value%20accounts.%20These%20could%20be%20accounts%20with%20high%20privileges%20needed%20to%20perform%20administrative%20functions%20or%20accounts%20with%20access%20to%20sensitive%20data%20%E2%80%93%20for%20example%20high-level%20employees%20such%20as%20CEO%20or%20CIO.%26nbsp%3B%20These%20high-value%20accounts%20are%20often%20the%20focus%20of%20attacks%20due%20to%20the%20value%20of%20the%20information%20or%20assets%20that%20they%20can%20access.%20Increased%20security%20monitoring%20for%20these%20accounts%20is%20therefore%20desirable%20and%20security%20teams%20may%20be%20more%20tolerant%20of%20greater%20noise%20given%20the%20high%20impact%20of%20compromise.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20post%20illustrates%20putting%20privileged%20account%20monitoring%20in%20place%20using%20Azure%20Sentinel.%20This%20example%20will%20focus%20on%20monitoring%20rare%20activity%20from%20high-value%20accounts%20and%20providing%20a%20quick%20view%20into%20related%20activity%20by%20these%20accounts%20across%20network%20and%20cloud%20logs.%20This%20provides%20a%20security%20team%20with%20the%20ability%20to%20get%20some%20sense%20of%20context%20surrounding%20the%20unusual%20activity%20and%20so%20rapidly%20understand%20the%20who%2C%20what%2C%20where%20and%20when%20of%20the%20activity%2C%20allowing%20quick%20determination%20of%20whether%20further%20investigation%20is%20needed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20security%20team%20can%20provide%20their%20own%20custom%20list%20of%20privileged%20accounts.%20However%20knowing%20which%20accounts%20are%20privileged%20is%20not%20always%20straightforward%3A%20so%20we%20also%20show%20an%20example%20of%20augmenting%20that%20custom%20list%20with%20additional%20privileged%20accounts%20%3CEM%3Einferred%3C%2FEM%3E%20from%20the%20log%20data%20itself.%20For%20example%2C%20accounts%20recently%20added%20to%20well-known%20privileged%20groups%20can%20be%20inferred%20as%20high-value%20accounts%20that%20should%20be%20added%20to%20the%20custom%20list.%20The%20specific%20query%20discussed%20here%20is%20posted%20on%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Sentinel%20Github%3C%2FA%3E.%20However%2C%20the%20same%20concepts%20are%20applicable%20to%20monitoring%20other%20entities%20(e.g.%20high-value%20hosts%20or%20sensitive%20files%20rather%20than%20accounts)%20assuming%20that%20you%20have%20corresponding%20logs%20and%20that%20these%20are%20connected%20to%20Azure%20Sentinel.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EHigh-value%20account%20monitoring%20details%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThe%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%2Fblob%2Fmaster%2FHunting%2520Queries%2FMultipleDataSources%2FTrackingPrivAccounts.txt%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ETracking%20Privileged%20Account%3C%2FA%3E%20query%20discussed%20in%20this%20section%20makes%20use%20of%20the%20following%20logs%20that%20include%20Account%20entity%20types%3A%20AWSCloudTrail%2C%20SigninLogs%2C%20SecurityEvent%2C%20OfficeActivity%2C%20W3CIISLog%2C%20SecurityAlert.%20It%20is%20provided%20as%20a%20starting%20point%20and%20modifying%20it%20for%20your%20environment%20is%20encouraged!%20Check%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Sentinel%20Github%3C%2FA%3E%20for%20the%20latest%20version.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENote%3CSTRONG%3E%3A%3C%2FSTRONG%3E%20In%20order%20for%20data%20to%20be%20present%20in%20these%20data%20tables%2C%20the%20corresponding%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsentinel%2Fconnect-data-sources%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Econnector%3C%2FA%3E%20must%20be%20enabled.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EBuilding%20the%20privileged%20account%20list%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThe%20datatable%20construct%20allows%20building%20your%20own%20custom%20list%20of%20privileged%20accounts%2C%20made%20up%20in%20this%20case%20of%20Account%20and%20Domain%20values%3A%3C%2FP%3E%0A%3CPRE%20style%3D%22background-color%3A%20%23f4f4f4%3B%20color%3A%20%23c7254e%3B%20border%3A%201px%20solid%20%23969696%3B%22%3Elet%20List%20%3D%20datatable(Account%3Astring%2C%20Domain%3Astring)%0A%5B%22john%22%2C%20%22johnsdomain.com%22%2C%20%22greg%22%2C%20%22gregsdomain.net%22%2C%20%22larry%22%2C%20%22Domain%22%5D%3B%3C%2FPRE%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%20text-autospace%3A%20none%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22font-size%3A%2012.0pt%3B%20line-height%3A%20107%25%3B%22%3EAs%20discussed%20above%2C%20we%20can%20infer%20additional%20high-value%20user%20accounts%20from%20membership%20addition%20to%20well-known%20privileged%20groups.%20The%20query%20snippet%20below%20shows%20identifying%20such%20accounts%20form%20the%20SecurityEvents%20table%20using%20a%20regex%20pattern%20match%20for%20well%20known%20SIDs%20for%20Active%20Directory.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20style%3D%22background-color%3A%20%23f4f4f4%3B%20color%3A%20%23c7254e%3B%20border%3A%201px%20solid%20%23969696%3B%22%3Elet%20WellKnownLocalSID%20%3D%20%22S-1-5-32-5%5B0-9%5D%5B0-9%5D%22%3B%0Alet%20WellKnownGroupSID%20%3D%20%22S-1-5-21-%5B0-9%5D*-%5B0-9%5D*-%5B0-9%5D*-5%5B0-9%5D%5B0-9%5D%7CS-1-5-21-%5B0-9%5D*-%5B0-9%5D*-%5B0-9%5D*-1102%7CS-1-5-21-%5B0-9%5D*-%5B0-9%5D*-%5B0-9%5D*-1103%22%3B%0Alet%20InferredPrivilegedAccounts%20%3D%20SecurityEvent%0A%7C%20where%20TimeGenerated%20%26gt%3B%20ago(8d)%20%0A%7C%20where%20EventID%20in%20(%224728%22%2C%20%224732%22%2C%20%224756%22)%0A%7C%20where%20AccountType%20%3D%3D%20%22User%22%20and%20MemberName%20%3D%3D%20%22-%22%20%0A%2F%2F%20Exclude%20Remote%20Desktop%20Users%20group%3A%20S-1-5-32-555%0A%7C%20where%20TargetSid%20!in%20(%22S-1-5-32-555%22)%20%0A%2F%2F%204728%20-%20A%20member%20was%20added%20to%20a%20security-enabled%20global%20group%20%0A%2F%2F%204732%20-%20A%20member%20was%20added%20to%20a%20security-enabled%20local%20group%20%0A%2F%2F%204756%20-%20A%20member%20was%20added%20to%20a%20security-enabled%20universal%20group%20%0A%7C%20where%20TargetSid%20matches%20regex%20WellKnownLocalSID%20or%20TargetSid%20matches%20regex%20WellKnownGroupSID%20%0A%7C%20project%20DomainSlashAccount%20%3D%20tolower(SubjectAccount)%2C%20AccountAtDomain%20%3D%20tolower(strcat(SubjectUserName%2C%22%40%22%2CSubjectDomainName))%2C%20AccountNameOnly%20%3D%20tolower(SubjectUserName)%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThe%20account%20name%20can%20be%20recorded%20in%20varying%20forms%20in%20different%20logs%2C%20for%20example%20%E2%80%98account%40domain.com%E2%80%99%20or%20%E2%80%98domain%5Caccount%E2%80%99.%26nbsp%3B%3C%2FSPAN%3ESo%20now%20that%20we%20have%20our%20list%20of%20user%20accounts%20defined%20and%20stored%20in%20the%20list%2C%20we%20format%20them%20multiple%20ways%20%E2%80%93%20here%203%20formatted%20versions%20for%20each%20of%20our%20individual%20Account%20and%20Domain%20properties%3A%20AccountAtDomain%2C%20(i.e.%20testaccount%40contoso.com)%3B%20AccountNameOnly%2C%20(i.e.%20testaccount)%3B%20AccountSlashDomain%2C%20(i.e.%20contoso%5Ctestaccount).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20style%3D%22background-color%3A%20%23f4f4f4%3B%20color%3A%20%23c7254e%3B%20border%3A%201px%20solid%20%23969696%3B%22%3Elet%20AccountFormatCustomList%20%3D%20CustomAccountList%20%0A%7C%20extend%20AccountAtDomain%20%3D%20tolower(strcat(Account%2C%22%40%22%2CDomain))%2C%20%0A%20%20AccountNameOnly%20%3D%20tolower(Account)%2C%20%0A%20%20DomainSlashAccount%20%3D%20tolower(strcat(NtDomain%2C%22%5C%5C%22%2CAccount))%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EFinding%20unusual%20privileged%20account%20activity%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20an%20account%20in%20our%20list%20performs%20a%20new%20logon%20attempt%20to%20a%20system%20or%20performs%20a%20new%20type%20of%20service%20activity%20not%20seen%20in%20the%20prior%20week%2C%20the%20first%20part%20of%20our%20hunting%20query%20returns%20a%20summary%20of%20the%20new%20activity%20and%20the%20timeframe%20it%20occurred%20in.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFirst%20we%20normalize%20each%20dataset%20to%20common%20column%20names%20such%20as%20%E2%80%98AccountName%E2%80%99%20in%20the%20snippet%20below%3A%3C%2FP%3E%0A%3CPRE%20style%3D%22background-color%3A%20%23f4f4f4%3B%20color%3A%20%23c7254e%3B%20border%3A%201px%20solid%20%23969696%3B%22%3E%26lt%3Bsnip%26gt%3B%0A(OfficeActivity%20%0A%7C%20where%20TimeGenerated%20%26lt%3B%3D%20ActivityEndTime%20and%20TimeGenerated%20%26gt%3B%3D%20ActivityStartTime%0A%7C%20extend%20DataType%20%3D%20%22OfficeActivity%22%2C%20AccountName%20%3D%20tolower(UserId)%20%0A%7C%20project-rename%20EventType%20%3D%20Operation%2C%20ServiceOrSystem%20%3D%20OfficeWorkload%0A%7C%20join%20kind%3Dinner%20(AccountFormat%20%7C%20project%20AccountNameOnly%2C%20AccountName%20%3D%20AccountAtDomain%2C%20DomainSlashAccount)%20on%20AccountName)%2C%0A(W3CIISLog%0A%7C%20where%20TimeGenerated%20%26lt%3B%3D%20ActivityEndTime%20and%20TimeGenerated%20%26gt%3B%3D%20ActivityStartTime%0A%7C%20extend%20DataType%20%3D%20%22W3CIISLog%22%2C%20AccountName%20%3D%20tolower(csUserName)%0A%7C%20where%20csUserName%20!%3D%20%22-%22%20and%20isnotempty(csUserName)%0A%7C%20project-rename%20EventType%20%3D%20csMethod%2C%20ServiceOrSystem%20%3D%20sSiteName%2C%20ClientIP%20%3D%20cIP%0A%7C%20join%20kind%3Dinner%20(AccountFormat%20%7C%20project%20AccountNameOnly%2C%20AccountName%20%3D%20AccountAtDomain%2C%20DomainSlashAccount)%20on%20AccountName)%2C%0A%26lt%3Bsnip%26gt%3B%3C%2FPRE%3E%0A%3CP%3EHaving%20collected%20this%20information%20in%20a%20standardized%20way%20across%20multiple%20datasets%20we%20can%20look%20for%20just%20new%20types%20of%20activity%20today%20that%20hadn%E2%80%99t%20occurred%20in%20the%20prior%20week%3A%3C%2FP%3E%0A%3CPRE%20style%3D%22background-color%3A%20%23f4f4f4%3B%20color%3A%20%23c7254e%3B%20border%3A%201px%20solid%20%23969696%3B%22%3E%26lt%3Bsnip%26gt%3B%0A%2F%2F%20Find%20new%20activity%20today%20versus%20prior%20week%0Alet%20ActivityLastDay%20%3D%20activity(LastDay%2C%20now())%0A%7C%20summarize%0ARareActivityStartTimeUtc%20%3D%20min(TimeGenerated)%2C%0ARareActivityEndTimeUtc%20%3D%20max(TimeGenerated)%2C%20%0ARareActivityCount%20%3D%20count()%20%0Aby%20DataType%2C%20AccountName%2C%20EventType%2C%20ServiceOrSystem%2C%20WinSecEventDomain%3B%0Alet%20Activity7day%20%3D%20activity(Prev7Day%2C%20PrevDay)%0A%7C%20summarize%20HistoricalActivityCount%20%3D%20count()%20by%20DataType%2C%20AccountName%2C%20EventType%2C%20ServiceOrSystem%3B%0Alet%20NewActivityToday%20%3D%20ActivityLastDay%20%0A%7C%20join%20kind%3Dleftanti%20(Activity7day)%20on%20DataType%2C%20AccountName%2C%20ServiceOrSystem%0A%26lt%3Bsnip%26gt%3B%3C%2FPRE%3E%0A%3CP%3ELooking%20for%20such%20basic%20anomalies%20for%20%3CEM%3Eall%3C%2FEM%3E%20accounts%20would%20typically%20be%20too%20noisy%20%E2%80%93%20by%20restricting%20this%20to%20high-value%20accounts%20we%20limit%20the%20set%20of%20results%20just%20to%20those%20accounts%20where%20we%20are%20most%20concerned%20about%20the%20potential%20impact%20of%20a%20compromise.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EResults%20from%20a%20sample%20network%20environment%20are%20shown%20below%3A%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%2F108030i33CAEC9105743E1D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22shownbelow.png%22%20title%3D%22shownbelow.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20shows%20a%20high-value%20account%20logged%20on%20to%203%20hosts%20for%20the%20first%20time%20and%20also%20performed%20Sharepoint%20searches%20%E2%80%93%20activities%20that%20were%20atypical%20for%20this%20account%20based%20on%20its%20prior%20week%20history.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ERetrieving%20related%20context%20for%20unusual%20privileged%20account%20activity%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20aid%20in%20triage%20we%20want%20to%20know%20what%20related%20activity%20surrounded%20this%20unusual%20event%20so%20we%20have%20better%20context%20and%20can%20investigate%20in%20more%20detail%20if%20needed.%3C%2FP%3E%0A%3CPRE%20style%3D%22background-color%3A%20%23f4f4f4%3B%20color%3A%20%23c7254e%3B%20border%3A%201px%20solid%20%23969696%3B%22%3E%26lt%3Bsnip%26gt%3B%0Alet%20RelatedActivity%20%3D%20%0A(union%20isfuzzy%3Dtrue%0A(NewActivityToday%20%0A%7C%20join%20kind%3Dinner%20(%0AOfficeActivity%20%0A%7C%20where%20TimeGenerated%20%26gt%3B%20LastDay%0A%7C%20summarize%20RelatedActivityStartTimeUtc%20%3D%20min(TimeGenerated)%2C%20RelatedActivityEndTimeUtc%20%3D%20max(TimeGenerated)%2C%20RelatedActivityServiceOrSystemCount%20%3D%20dcount(OfficeWorkload)%2C%20RelatedActivityServiceOrSystemSet%20%3D%20makeset(OfficeWorkload)%2C%20RelatedActivityClientIPSet%20%3D%20makeset(ClientIP)%2C%20RelatedActivityCount%20%3D%20count()%20by%20AccountName%20%3D%20tolower(UserId)%2C%20RelatedActivityEventType%20%3D%20Operation%20%0A)%20on%20AccountName)%2C%0A%26lt%3Bsnip%26gt%3B%3C%2FPRE%3E%0A%3CP%3EFor%20the%20example%20above%2C%20the%20related%20activity%20(slightly%20redacted)%20is%20shown%20below.%20The%20account%20successfully%20logged%20onto%209%20and%20then%2013%20different%20systems%20during%20this%20timeframe.%26nbsp%3B%20Additionally%2C%20you%20can%20see%20the%20failed%20logon%20attempts%20to%20SharePoint%20as%20part%20of%20Office365%2C%20where%20the%20account%20is%20later%20able%20to%20login%20and%20then%20add%20a%20member%20to%20the%20role.%26nbsp%3B%20Review%20of%20the%20source%20IP%20addresses%20can%20be%20a%20quick%20pointer%20to%20confirm%20that%20the%20activity%20is%20malicious.%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%2F108033iB7F850B6DEECB77B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22shownbelow2.png%22%20title%3D%22shownbelow2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20such%20a%20query%20has%20been%20adapted%20with%20a%20suitable%20custom%20list%20it%20can%20be%20added%20to%20%26nbsp%3BAzure%20Sentinel%E2%80%99s%20Hunting%20Queries%3A%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%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F108037iA2AF75C086FD9BB5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22shownbelow3.png%22%20title%3D%22shownbelow3.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EQueries%20whose%20results%20are%20high-confidence%20enough%20that%20they%20should%20trigger%20alerts%20and%20investigations%20can%20be%20added%20via%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsentinel%2Ftutorial-detect-threats%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Sentinel%20alert%20rule%20creation%20experience%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20post%20we%20have%20shown%20Azure%20Sentinel%20users%20how%20to%20search%20for%20unusual%20activity%20across%20a%20variety%20of%20logs%20to%20identify%20suspect%20activity%20in%20your%20environment%20%E2%80%93%20this%20helps%20reduce%20mean%20time%20to%20detection%2C%20reduce%20mean%20time%20to%20remediation%20and%20quickly%20understand%20the%20breadth%20of%20impact%20an%20attack%20may%20have%20had.%26nbsp%3B%20This%20is%20just%20one%20such%20fusion%20of%20data%20that%20will%20help%20in%20this%20endeavor%20%E2%80%93%20you%20can%20contribute%20and%20share%20security%20knowledge%20and%20experience%20through%20valuable%20queries%20in%20the%20Azure%20Sentinel%20GitHub%20community.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EHappy%20Hunting!!%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAppendix%20%E2%80%93%20miscellaneous%20notes%20about%20the%20query%20language%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ELogs%20often%20have%20similar%20Entity%20types%2C%20but%20the%20column%2Fproperty%20name%20may%20be%20different.%26nbsp%3B%20How%20to%20normalize%20(for%20example%20lower%2Fupper%20case%20as%20above)%20is%20an%20important%20consideration.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20union-ing%20multiple%20logs%20%E2%80%93%20some%20of%20which%20may%20not%20exist%20%E2%80%93%20an%20important%20argument%20to%20the%20%E2%80%9C%20union%20operation%20is%20the%20%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fdocs.microsoft.com%252Fen-us%252Fazure%252Fkusto%252Fquery%252Funionoperator%26amp%3Bdata%3D02%257C01%257Cv-ersta%2540microsoft.com%257C9eb744f4472f46688c8b08d6bdeaaca0%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C636905212949658985%26amp%3Bsdata%3DE015TOKAS53HppGvM6tDpkzIWF1F8RuYJiq4jAVV8V8%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%3Eisfuzzy%3Dtrue%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%3E%20argument.%20This%20will%20keep%20the%20query%20from%20failing%20when%20the%20engine%20does%20the%20initial%20check%3C%2FSPAN%3E%26nbsp%3Bfor%20existence%20of%20each%20table%20in%20the%20union.%20See%20KQL%20documentation%20and%20best%20practices%20for%20further%20advice%20on%20queries.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20performing%20joins%20and%20one%20table%20is%20known%20to%20be%20smaller%2C%20put%20it%20on%20the%20left%20hand%20side%20to%20improve%20performance%20%E2%80%93%20in%20the%20case%20above%20the%20set%20of%20high-value%20counts%20is%20likely%20relatively%20smaller%20so%20we%20put%20it%20on%20the%20left%20hand%20side%20of%20the%20join%20operations.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EKQL%20is%20the%20query%20language%20used%20and%20more%20details%20are%20available%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3EAdditionally%2C%20Log%20Analytics%20has%20some%20minor%20limitations%20from%20the%20full%20KQL%2C%20which%20is%20detailed%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Flog-query%2Fdata-explorer-difference%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-430740%22%20slang%3D%22en-US%22%3E%3CP%3EMost%20environments%20have%20high-value%20accounts%20and%20are%20often%20attacked.%20This%20post%20shows%20high-value%20account%20monitoring%20using%20Azure%20Sentinel.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-430740%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Sentinel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDetection%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHunting%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EInvestigation%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

Introduction

 

Most if not every environment has high-value accounts. These could be accounts with high privileges needed to perform administrative functions or accounts with access to sensitive data – for example high-level employees such as CEO or CIO.  These high-value accounts are often the focus of attacks due to the value of the information or assets that they can access. Increased security monitoring for these accounts is therefore desirable and security teams may be more tolerant of greater noise given the high impact of compromise.

 

This post illustrates putting privileged account monitoring in place using Azure Sentinel. This example will focus on monitoring rare activity from high-value accounts and providing a quick view into related activity by these accounts across network and cloud logs. This provides a security team with the ability to get some sense of context surrounding the unusual activity and so rapidly understand the who, what, where and when of the activity, allowing quick determination of whether further investigation is needed.

 

A security team can provide their own custom list of privileged accounts. However knowing which accounts are privileged is not always straightforward: so we also show an example of augmenting that custom list with additional privileged accounts inferred from the log data itself. For example, accounts recently added to well-known privileged groups can be inferred as high-value accounts that should be added to the custom list. The specific query discussed here is posted on the Azure Sentinel Github. However, the same concepts are applicable to monitoring other entities (e.g. high-value hosts or sensitive files rather than accounts) assuming that you have corresponding logs and that these are connected to Azure Sentinel.

 

High-value account monitoring details

The Tracking Privileged Account query discussed in this section makes use of the following logs that include Account entity types: AWSCloudTrail, SigninLogs, SecurityEvent, OfficeActivity, W3CIISLog, SecurityAlert. It is provided as a starting point and modifying it for your environment is encouraged! Check the Azure Sentinel Github for the latest version.

 

Note: In order for data to be present in these data tables, the corresponding connector must be enabled.

 

Building the privileged account list

The datatable construct allows building your own custom list of privileged accounts, made up in this case of Account and Domain values:

let List = datatable(Account:string, Domain:string)
["john", "johnsdomain.com", "greg", "gregsdomain.net", "larry", "Domain"];

 

As discussed above, we can infer additional high-value user accounts from membership addition to well-known privileged groups. The query snippet below shows identifying such accounts form the SecurityEvents table using a regex pattern match for well known SIDs for Active Directory.

 

let WellKnownLocalSID = "S-1-5-32-5[0-9][0-9]";
let WellKnownGroupSID = "S-1-5-21-[0-9]*-[0-9]*-[0-9]*-5[0-9][0-9]|S-1-5-21-[0-9]*-[0-9]*-[0-9]*-1102|S-1-5-21-[0-9]*-[0-9]*-[0-9]*-1103";
let InferredPrivilegedAccounts = SecurityEvent
| where TimeGenerated > ago(8d) 
| where EventID in ("4728", "4732", "4756")
| where AccountType == "User" and MemberName == "-" 
// Exclude Remote Desktop Users group: S-1-5-32-555
| where TargetSid !in ("S-1-5-32-555") 
// 4728 - A member was added to a security-enabled global group 
// 4732 - A member was added to a security-enabled local group 
// 4756 - A member was added to a security-enabled universal group 
| where TargetSid matches regex WellKnownLocalSID or TargetSid matches regex WellKnownGroupSID 
| project DomainSlashAccount = tolower(SubjectAccount), AccountAtDomain = tolower(strcat(SubjectUserName,"@",SubjectDomainName)), AccountNameOnly = tolower(SubjectUserName);

 

The account name can be recorded in varying forms in different logs, for example ‘account@domain.com’ or ‘domain\account’. So now that we have our list of user accounts defined and stored in the list, we format them multiple ways – here 3 formatted versions for each of our individual Account and Domain properties: AccountAtDomain, (i.e. testaccount@contoso.com); AccountNameOnly, (i.e. testaccount); AccountSlashDomain, (i.e. contoso\testaccount).

 

let AccountFormatCustomList = CustomAccountList 
| extend AccountAtDomain = tolower(strcat(Account,"@",Domain)), 
  AccountNameOnly = tolower(Account), 
  DomainSlashAccount = tolower(strcat(NtDomain,"\\",Account));

 

Finding unusual privileged account activity

 

If an account in our list performs a new logon attempt to a system or performs a new type of service activity not seen in the prior week, the first part of our hunting query returns a summary of the new activity and the timeframe it occurred in.

 

First we normalize each dataset to common column names such as ‘AccountName’ in the snippet below:

<snip>
(OfficeActivity 
| where TimeGenerated <= ActivityEndTime and TimeGenerated >= ActivityStartTime
| extend DataType = "OfficeActivity", AccountName = tolower(UserId) 
| project-rename EventType = Operation, ServiceOrSystem = OfficeWorkload
| join kind=inner (AccountFormat | project AccountNameOnly, AccountName = AccountAtDomain, DomainSlashAccount) on AccountName),
(W3CIISLog
| where TimeGenerated <= ActivityEndTime and TimeGenerated >= ActivityStartTime
| extend DataType = "W3CIISLog", AccountName = tolower(csUserName)
| where csUserName != "-" and isnotempty(csUserName)
| project-rename EventType = csMethod, ServiceOrSystem = sSiteName, ClientIP = cIP
| join kind=inner (AccountFormat | project AccountNameOnly, AccountName = AccountAtDomain, DomainSlashAccount) on AccountName),
<snip>

Having collected this information in a standardized way across multiple datasets we can look for just new types of activity today that hadn’t occurred in the prior week:

<snip>
// Find new activity today versus prior week
let ActivityLastDay = activity(LastDay, now())
| summarize
RareActivityStartTimeUtc = min(TimeGenerated),
RareActivityEndTimeUtc = max(TimeGenerated), 
RareActivityCount = count() 
by DataType, AccountName, EventType, ServiceOrSystem, WinSecEventDomain;
let Activity7day = activity(Prev7Day, PrevDay)
| summarize HistoricalActivityCount = count() by DataType, AccountName, EventType, ServiceOrSystem;
let NewActivityToday = ActivityLastDay 
| join kind=leftanti (Activity7day) on DataType, AccountName, ServiceOrSystem
<snip>

Looking for such basic anomalies for all accounts would typically be too noisy – by restricting this to high-value accounts we limit the set of results just to those accounts where we are most concerned about the potential impact of a compromise.

 

Results from a sample network environment are shown below:

 

shownbelow.png

 

This shows a high-value account logged on to 3 hosts for the first time and also performed Sharepoint searches – activities that were atypical for this account based on its prior week history.

 

Retrieving related context for unusual privileged account activity

 

To aid in triage we want to know what related activity surrounded this unusual event so we have better context and can investigate in more detail if needed.

<snip>
let RelatedActivity = 
(union isfuzzy=true
(NewActivityToday 
| join kind=inner (
OfficeActivity 
| where TimeGenerated > LastDay
| summarize RelatedActivityStartTimeUtc = min(TimeGenerated), RelatedActivityEndTimeUtc = max(TimeGenerated), RelatedActivityServiceOrSystemCount = dcount(OfficeWorkload), RelatedActivityServiceOrSystemSet = makeset(OfficeWorkload), RelatedActivityClientIPSet = makeset(ClientIP), RelatedActivityCount = count() by AccountName = tolower(UserId), RelatedActivityEventType = Operation 
) on AccountName),
<snip>

For the example above, the related activity (slightly redacted) is shown below. The account successfully logged onto 9 and then 13 different systems during this timeframe.  Additionally, you can see the failed logon attempts to SharePoint as part of Office365, where the account is later able to login and then add a member to the role.  Review of the source IP addresses can be a quick pointer to confirm that the activity is malicious.

 

shownbelow2.png

 

Once such a query has been adapted with a suitable custom list it can be added to  Azure Sentinel’s Hunting Queries:

 

shownbelow3.png

 

Queries whose results are high-confidence enough that they should trigger alerts and investigations can be added via the Azure Sentinel alert rule creation experience.

 

In this post we have shown Azure Sentinel users how to search for unusual activity across a variety of logs to identify suspect activity in your environment – this helps reduce mean time to detection, reduce mean time to remediation and quickly understand the breadth of impact an attack may have had.  This is just one such fusion of data that will help in this endeavor – you can contribute and share security knowledge and experience through valuable queries in the Azure Sentinel GitHub community.

 

Happy Hunting!!

 

Appendix – miscellaneous notes about the query language

Logs often have similar Entity types, but the column/property name may be different.  How to normalize (for example lower/upper case as above) is an important consideration.

 

When union-ing multiple logs – some of which may not exist – an important argument to the “ union operation is the isfuzzy=true argument. This will keep the query from failing when the engine does the initial check for existence of each table in the union. See KQL documentation and best practices for further advice on queries.

 

When performing joins and one table is known to be smaller, put it on the left hand side to improve performance – in the case above the set of high-value counts is likely relatively smaller so we put it on the left hand side of the join operations.

 

KQL is the query language used and more details are available here.

Additionally, Log Analytics has some minor limitations from the full KQL, which is detailed here.