PowerShell 로그 수집

다음에서 지원:

이 문서에서는 Bindplane을 사용하여 PowerShell 로그를 Google Security Operations에 수집하는 방법을 설명합니다. 파서는 원시 Microsoft PowerShell 로그를 통합 데이터 모델 (UDM)로 변환합니다. 먼저 원시 로그 메시지에서 필드를 추출하고 UDM 필드로 정규화한 다음 특정 이벤트 ID를 기반으로 추가 컨텍스트를 사용하여 데이터를 보강하여 보안 분석을 위한 구조화된 UDM 이벤트를 생성합니다.

시작하기 전에

  • Google SecOps 인스턴스가 있는지 확인합니다.
  • Windows 2016 이상이 설치되어 있는지 확인합니다.
  • 프록시 뒤에서 실행하는 경우 방화벽 포트가 열려 있는지 확인합니다.

Google SecOps 수집 인증 파일 가져오기

  1. Google SecOps 콘솔에 로그인합니다.
  2. SIEM 설정 > 수집 에이전트로 이동합니다.
  3. 수집 인증 파일을 다운로드합니다. Bindplane이 설치될 시스템에 파일을 안전하게 저장합니다.

Google SecOps 고객 ID 가져오기

  1. Google SecOps 콘솔에 로그인합니다.
  2. SIEM 설정 > 프로필로 이동합니다.
  3. 조직 세부정보 섹션에서 고객 ID를 복사하여 저장합니다.

Windows에 Bindplane 에이전트 설치

  1. 명령 프롬프트 또는 PowerShell을 관리자로 엽니다.
  2. 다음 명령어를 실행합니다.

    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
    

추가 설치 리소스

Syslog를 수집하여 Google SecOps로 전송하도록 Bindplane 에이전트 구성

  1. YAML 파일을 구성하기 전에 서비스 패널에서 observIQ Distro for Open Telemetry Collector 서비스를 중지합니다.
  2. 구성 파일에 액세스합니다.

    1. config.yaml 파일을 찾습니다. 일반적으로 Linux에서는 /etc/bindplane-agent/ 디렉터리에 있고 Windows에서는 설치 디렉터리에 있습니다.
    2. 텍스트 편집기 (예: nano, vi, 메모장)를 사용하여 파일을 엽니다.
  3. 다음과 같이 config.yaml 파일을 수정합니다.

    receivers:
      windowseventlog/powershell:
        channel: Microsoft-Windows-PowerShell/Operational
        max_reads: 100
        poll_interval: 5s
        raw: true
        start_at: end
    
    processors:
      batch:
    
    exporters:
      chronicle/powershell:
        endpoint: malachiteingestion-pa.googleapis.com
        # Adjust the path to the credentials file you downloaded in Step 1
        creds: '/path/to/ingestion-authentication-file.json'
        log_type: 'POWERSHELL'
        override_log_type: false
        raw_log_field: body
        customer_id: '<customer_id>'
    
    service:
      pipelines:
        logs/winpowershell:
          receivers:
            - windowseventlog/powershell
          processors: [batch]
          exporters: [chronicle/powershell] 
    
  4. <customer_id>를 실제 고객 ID로 바꿉니다.

  5. Google SecOps 수집 인증 파일 가져오기 섹션에서 인증 파일이 저장된 경로로 /path/to/ingestion-authentication-file.json를 업데이트합니다.

  6. config.yaml 파일을 저장한 후 observIQ Distro for Open Telemetry Collector 서비스시작합니다.

Bindplane 에이전트를 다시 시작하여 변경사항 적용

  • Windows에서 Bindplane 에이전트를 다시 시작하려면 서비스 콘솔을 사용하거나 다음 명령어를 입력하면 됩니다.

    net stop BindPlaneAgent && net start BindPlaneAgent
    

UDM 매핑 테이블

로그 필드 UDM 매핑 논리
AccountName principal.user.userid 원시 로그의 AccountName 필드에서 직접 매핑됩니다.
ActivityID security_result.detection_fields[0].value 원시 로그의 ActivityID 필드에서 직접 매핑됩니다. 중괄호가 삭제됩니다.
채널 IDM 객체에 매핑되지 않았습니다.
collection_time.nanos IDM 객체에 매핑되지 않았습니다.
collection_time.seconds IDM 객체에 매핑되지 않았습니다.
명령어 IDM 객체에 매핑되지 않았습니다.
CommandLine IDM 객체에 매핑되지 않았습니다.
컴퓨터 principal.hostname 있는 경우 원시 로그의 Computer 필드에서 직접 매핑됩니다.
ContextInfo IDM 객체에 매핑되지 않았습니다.
ContextInfo_Command Name security_result.detection_fields[0].value 있는 경우 원시 로그의 ContextInfo_Command Name 필드에서 직접 매핑됩니다.
ContextInfo_Command 유형 security_result.detection_fields[1].value 있는 경우 원시 로그의 ContextInfo_Command Type 필드에서 직접 매핑됩니다.
ContextInfo_호스트 애플리케이션 target.process.command_line powershell.Host Application이 없는 경우 원시 로그의 ContextInfo_Host Application 필드에서 직접 매핑됩니다.
ContextInfo_Host ID target.asset.asset_id powershell.Host ID이 없는 경우 원시 로그의 ContextInfo_Host ID 필드에서 직접 매핑됩니다. 값에 Host ID:이 프리픽스로 붙습니다.
ContextInfo_Host Name target.hostname powershell.Host Name이 없는 경우 원시 로그의 ContextInfo_Host Name 필드에서 직접 매핑됩니다.
ContextInfo_Script Name target.process.file.full_path script_name이 없는 경우 원시 로그의 ContextInfo_Script Name 필드에서 직접 매핑됩니다.
ContextInfo_Sequence Number security_result.detection_fields[2].value 있는 경우 원시 로그의 ContextInfo_Sequence Number 필드에서 직접 매핑됩니다. 문자열로 변환되었습니다.
ContextInfo_Severity IDM 객체에 매핑되지 않았습니다.
create_time.nanos IDM 객체에 매핑되지 않았습니다.
create_time.seconds IDM 객체에 매핑되지 않았습니다.
customer_id IDM 객체에 매핑되지 않았습니다.
데이터 IDM 객체에 매핑되지 않았습니다.
데이터 security_result.detection_fields[0].value 있는 경우 원시 로그의 Data 필드에서 직접 매핑됩니다.
Data_1 security_result.detection_fields[1].value 있는 경우 원시 로그의 Data_1 필드에서 직접 매핑됩니다.
Data_2 security_result.detection_fields[2].value 있는 경우 원시 로그의 Data_2 필드에서 직접 매핑됩니다.
도메인 principal.administrative_domain 원시 로그의 Domain 필드에서 직접 매핑됩니다.
entries IDM 객체에 매핑되지 않았습니다.
ERROR_EVT_UNRESOLVED IDM 객체에 매핑되지 않았습니다.
EventCategory IDM 객체에 매핑되지 않았습니다.
EventData IDM 객체에 매핑되지 않았습니다.
EventID metadata.product_event_type, security_result.rule_name 원시 로그의 EventID 필드에서 직접 매핑됩니다. security_result.rule_name 필드의 값에는 EventID:이 접두사로 붙습니다.
EventLevel IDM 객체에 매핑되지 않았습니다.
EventLevelName security_result.severity EventLevelName 값에 따라 매핑됩니다.
~InformationINFORMATIONAL에 매핑됩니다.
- VerboseLOW에 매핑됩니다.
EventLog IDM 객체에 매핑되지 않았습니다.
EventReceivedTime IDM 객체에 매핑되지 않았습니다.
EventType IDM 객체에 매핑되지 않았습니다.
EventTime metadata.event_timestamp 있는 경우 타임스탬프를 추출하는 데 사용됩니다.
ExecutionProcessID principal.process.pid 원시 로그의 ExecutionProcessID 필드에서 직접 매핑됩니다(있는 경우, 비어 있지 않거나 0이 아닌 경우). 문자열로 변환되었습니다.
ExecutionThreadID security_result.detection_fields[2].value 원시 로그의 ExecutionThreadID 필드에서 직접 매핑됩니다(있는 경우, 비어 있지 않거나 0이 아닌 경우). 문자열로 변환되었습니다.
파일 target.process.file.full_path 있는 경우 원시 로그의 File 필드에서 직접 매핑됩니다.
호스트 애플리케이션 IDM 객체에 매핑되지 않았습니다.
HostApplication IDM 객체에 매핑되지 않았습니다.
호스트 이름 principal.hostname 원시 로그의 Hostname 필드에서 직접 매핑됩니다.
id IDM 객체에 매핑되지 않았습니다.
키워드 IDM 객체에 매핑되지 않았습니다.
log_type metadata.log_type 원시 로그의 log_type 필드에서 직접 매핑됩니다.
머신 principal.asset.asset_id, principal.asset.platform_software.platform_version Machine 필드는 머신 ID와 플랫폼 정보를 추출하기 위해 파싱됩니다. 머신 ID에는 Machine ID: 프리픽스가 붙습니다. 플랫폼은 값에 따라 UDM enum에 매핑됩니다.
~winWINDOWS에 매핑됩니다.
- macMAC에 매핑됩니다.
- linLINUX에 매핑됩니다.
- 기타 값은 UNKNOWN_PLATFORM에 매핑됩니다.
ManagementGroupName additional.fields[0].value.string_value 있는 경우 원시 로그의 ManagementGroupName 필드에서 직접 매핑됩니다.
Message.EventTime metadata.event_timestamp 있는 경우 타임스탬프를 추출하는 데 사용됩니다. 문자열로 변환되었습니다.
Message.Message security_result.description EventID이 [403, 4103, 4104] 및 message_message_not_found에 있는 경우 원시 로그의 Message.Message 필드에서 직접 매핑됩니다. 캐리지 리턴과 탭은 쉼표로 바뀝니다.
메시지 security_result.description 있는 경우 원시 로그의 Message 필드에서 직접 매핑됩니다.
MessageNumber IDM 객체에 매핑되지 않았습니다.
MessageSourceAddress principal.ip 있는 경우 원시 로그의 MessageSourceAddress 필드에서 직접 매핑됩니다.
MessageTotal IDM 객체에 매핑되지 않았습니다.
MG IDM 객체에 매핑되지 않았습니다.
명령 코드 metadata.description 원시 로그의 Opcode 필드에서 직접 매핑됩니다.
OpcodeValue IDM 객체에 매핑되지 않았습니다.
출력 security_result.detection_fields[0].value 있는 경우 원시 로그의 Output 필드에서 직접 매핑됩니다.
powershell.명령어 이름 security_result.detection_fields[0].value 있는 경우 powershell.Command Name 필드에서 직접 매핑됩니다.
powershell.Command 유형 security_result.detection_fields[1].value 있는 경우 powershell.Command Type 필드에서 직접 매핑됩니다.
powershell.Host Application target.process.command_line 있는 경우 원시 로그의 powershell.Host Application 필드에서 직접 매핑됩니다.
powershell.Host ID target.asset.asset_id 있는 경우 원시 로그의 powershell.Host ID 필드에서 직접 매핑됩니다. 값에 Host ID:이 프리픽스로 붙습니다.
powershell.호스트 이름 target.hostname 있는 경우 원시 로그의 powershell.Host Name 필드에서 직접 매핑됩니다.
powershell.HostApplication target.process.command_line 있는 경우 원시 로그의 powershell.HostApplication 필드에서 직접 매핑됩니다.
powershell.HostId target.asset.asset_id 있는 경우 원시 로그의 powershell.HostId 필드에서 직접 매핑됩니다. 값에 Host ID:이 프리픽스로 붙습니다.
powershell.HostName target.hostname 있는 경우 원시 로그의 powershell.HostName 필드에서 직접 매핑됩니다.
powershell.스크립트 이름 target.process.file.full_path 있는 경우 원시 로그의 powershell.Script Name 필드에서 직접 매핑됩니다.
powershell.ScriptName target.process.file.full_path 있는 경우 원시 로그의 powershell.ScriptName 필드에서 직접 매핑됩니다.
powershell.Sequence Number security_result.detection_fields[2].value 있는 경우 원시 로그의 powershell.Sequence Number 필드에서 직접 매핑됩니다.
powershell.SequenceNumber security_result.detection_fields[0].value 있는 경우 원시 로그의 powershell.SequenceNumber 필드에서 직접 매핑됩니다.
powershell.UserId principal.user.userid 있는 경우 원시 로그의 powershell.UserId 필드에서 직접 매핑됩니다.
프로세스 ID principal.process.pid ExecutionProcessIDProcessID가 없거나 비어 있거나 0인 경우 원시 로그의 Process ID 필드에서 직접 매핑됩니다. 문자열로 변환되었습니다.
ProcessID principal.process.pid ExecutionProcessID이 없거나 비어 있거나 0인 경우 원시 로그의 ProcessID 필드에서 직접 매핑됩니다. 문자열로 변환되었습니다.
ProviderGuid metadata.product_deployment_id 원시 로그의 ProviderGuid 필드에서 직접 매핑됩니다. 중괄호가 삭제됩니다.
PSEdition IDM 객체에 매핑되지 않았습니다.
PSRemotingProtocolVersion IDM 객체에 매핑되지 않았습니다.
PSVersion IDM 객체에 매핑되지 않았습니다.
RecordNumber metadata.product_log_id 원시 로그의 RecordNumber 필드에서 직접 매핑됩니다. 문자열로 변환되었습니다.
RenderedDescription security_result.description 있는 경우 원시 로그의 RenderedDescription 필드에서 직접 매핑됩니다.
RunAs 사용자 IDM 객체에 매핑되지 않았습니다.
ScriptBlockId IDM 객체에 매핑되지 않았습니다.
ScriptBlockText security_result.detection_fields[0].value 있는 경우 원시 로그의 ScriptBlockText 필드에서 직접 매핑됩니다.
ScriptBlock ID IDM 객체에 매핑되지 않았습니다.
심각도 security_result.severity, security_result.severity_details Severity 값에 따라 매핑됩니다.
~verbose 또는 infoLOW에 매핑됩니다.
- warn 또는 errMEDIUM에 매핑됩니다.
- critHIGH에 매핑됩니다.
원시 값도 security_result.severity_details에 매핑됩니다.
source.collector_id IDM 객체에 매핑되지 않았습니다.
source.customer_id IDM 객체에 매핑되지 않았습니다.
소스 additional.fields[1].value.string_value 있는 경우 원시 로그의 Source 필드에서 직접 매핑됩니다.
SourceModuleName principal.resource.name 원시 로그의 SourceModuleName 필드에서 직접 매핑됩니다.
SourceModuleType principal.resource.resource_subtype 원시 로그의 SourceModuleType 필드에서 직접 매핑됩니다.
SourceName metadata.product_name 원시 로그의 SourceName 필드에서 직접 매핑됩니다.
start_time.nanos IDM 객체에 매핑되지 않았습니다.
start_time.seconds IDM 객체에 매핑되지 않았습니다.
TenantId additional.fields[2].value.string_value 있는 경우 원시 로그의 TenantId 필드에서 직접 매핑됩니다.
ThreadID IDM 객체에 매핑되지 않았습니다.
timestamp.nanos IDM 객체에 매핑되지 않았습니다.
timestamp.seconds IDM 객체에 매핑되지 않았습니다.
유형 IDM 객체에 매핑되지 않았습니다.
UserID principal.user.windows_sid 원시 로그의 UserID 필드에서 직접 매핑됩니다.
사용자 이름 principal.user.userid AccountName이 없는 경우 원시 로그의 Username 필드에서 직접 매핑됩니다.
metadata.vendor_name Microsoft로 설정합니다.
metadata.event_type EventID4104이고 _PathMessage에 있거나 EventID4103이거나 EventID이 [800, 600, 400] 에 있고 powershell.ScriptNamepowershell.HostApplication이 있는 경우 PROCESS_LAUNCH로 설정합니다. EventID403이고 _HostApplicationMessage에 있거나 EventID403이고 NewEngineStateStopped인 경우 PROCESS_TERMINATION로 설정합니다. EventID4104이고 _PathMessage에 없거나, EventID4103이고 no_value, script_name이 비어 있고 script_name_not_found, host_application_not_found이 모두 true이거나, EventID53504이거나, EventID40962이거나, EventID40961이거나, EventID이 비어 있고 MessageSourceAddress이 있는 경우 STATUS_UPDATE로 설정합니다. EventID이 비어 있고 Username이 있으면 USER_UNCATEGORIZED로 설정합니다. EventID이 비어 있고 MessageSourceAddressUsername이 없는 경우 GENERIC_EVENT로 설정됩니다.
metadata.product_name SourceName이 없으면 Powershell로 설정합니다.
security_result.action ALLOW로 설정합니다.
security_result.detection_fields[0].key Activity ID로 설정합니다.
security_result.detection_fields[1].key Sequence Number로 설정합니다.
security_result.detection_fields[2].key ExecutionThreadID로 설정합니다.
additional.fields[0].key Management Group Name로 설정합니다.
additional.fields[1].key Source로 설정합니다.
additional.fields[2].key TenantId로 설정합니다.
principal.asset.platform_software.platform platform_softwarewin이 포함되어 있으면 WINDOWS로 설정하고, mac이 포함되어 있으면 MAC로 설정하고, lin이 포함되어 있으면 LINUX로 설정하고, 그렇지 않으면 UNKNOWN_PLATFORM로 설정합니다.
target.process.file.full_path EventID4104이고 _PathMessage에 있으면 _Path로 설정합니다. EventID4104이고 file_pathMessage에 있으면 file_path로 설정합니다. EventID403이고 _HostApplicationMessage에 있으면 _HostApplication로 설정합니다.

도움이 더 필요하신가요? 커뮤니티 회원 및 Google SecOps 전문가로부터 답변을 받으세요.