MISP IOC 로그 수집

다음에서 지원:

이 가이드에서는 Bindplane을 사용하여 MISP (멀웨어 정보 공유 플랫폼) IOC (침해 지표) 로그를 Google Security Operations에 수집하는 단계를 설명합니다. 파서는 JSON 또는 CSV 형식으로 지정된 MISP 데이터에서 IOC를 추출합니다. 입력을 파싱하고, 필드를 통합 데이터 모델 (UDM)에 매핑하고, 다양한 IOC 유형(예: IP, 도메인, 파일 해시)을 처리하고, 신뢰도 및 심각도와 같은 위협 인텔리전스 컨텍스트로 데이터를 보강합니다. 파서는 다양한 데이터 형식에 대한 특정 로직을 실행하고 누락되거나 지원되지 않는 필드가 있는 사례를 처리합니다.

시작하기 전에

다음 기본 요건이 충족되었는지 확인합니다.

  • Google SecOps 인스턴스
  • systemd가 있는 Linux 호스트
  • 프록시 뒤에서 실행하는 경우 방화벽 포트가 열려 있음
  • MISP 서버에 대한 권한 액세스

MISP API 키 가져오기

  1. 관리자로 MISP 웹 UI에 로그인합니다.
  2. 관리 > 인증 키 목록으로 이동합니다.
  3. 인증 키 추가를 클릭합니다.
  4. 다음 키 구성을 제공합니다.
    • 사용자: 키와 연결된 사용자 계정을 선택합니다.
    • 허용된 IP: 키에 허용된 IP 주소를 선택적으로 지정할 수 있습니다.
    • 키를 복사하여 안전한 위치에 저장합니다.
    • 키를 기록했습니다를 클릭합니다.

MISP 로그 내보내기 구성

  1. SSH를 사용하여 MISP 인스턴스에 로그인합니다.
  2. 다음 명령어를 사용하여 PyMISP를 설치합니다.

    pip3 install pymisp 
    
  3. 다음을 사용하여 get_csv.py 내보내기 스크립트를 수정합니다.

    #!/usr/bin/env python3
    # -*- coding: utf-8 -*-
    
    import argparse
    
    from pymisp import ExpandedPyMISP
    from keys import misp_url, misp_key, misp_verifycert
    
    if __name__ == '__main__':
        parser = argparse.ArgumentParser(description='Get MISP data in a CSV format.')
        parser.add_argument("--controller", default='attributes', help="Attribute to use for the search (events, objects, attributes)")
        parser.add_argument("-e", "--event_id", help="Event ID to fetch. Without it, it will fetch the whole database.")
        parser.add_argument("-a", "--attribute", nargs='+', help="Attribute column names")
        parser.add_argument("-o", "--object_attribute", nargs='+', help="Object attribute column names")
        parser.add_argument("-t", "--misp_types", nargs='+', help="MISP types to fetch (ip-src, hostname, ...)")
        parser.add_argument("-c", "--context", action='store_true', help="Add event level context (tags...)")
        parser.add_argument("-f", "--outfile", help="Output file to write the CSV.")
        parser.add_argument("-l", "--last", required=True, help="can be defined in days, hours, minutes (for example 5d or 12h or 30m).")
    
        args = parser.parse_args()
        pymisp = ExpandedPyMISP(misp_url, misp_key, misp_verifycert, debug=True)
        attr = []
        if args.attribute:
            attr += args.attribute
        if args.object_attribute:
            attr += args.object_attribute
        if not attr:
            attr = None
        print(args.context)
        response = pymisp.search(return_format='csv', controller=args.controller, eventid=args.event_id, requested_attributes=attr, publish_timestamp=args.last,
                                type_attribute=args.misp_types, include_context=args.context)
    
        if args.outfile:
            with open(args.outfile, 'w') as f:
                f.write(response)
        else:
            print(response)
    
  4. 다음과 같이 MISP API 사용자 인증 정보와 URL을 포함하도록 keys.py 파일을 수정합니다.

    misp_url = 'https://<MISP_URL>'
    misp_key = '<MISP_API_KEY>'
    misp_verifycert = False
    misp_client_cert = ''
    
    • <MISP_URL>을 MISP IP 또는 호스트 이름으로 바꿉니다.
    • <MISP_API_KEY를 이전에 생성된 실제 API 키로 바꿉니다.
  5. crontab -e 명령어를 사용하여 crontab을 열고 다음을 입력합니다.

    0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/url.log -t "url" -l 1d -c
    0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/ip-dst.log -t "ip-dst" -l 1d -c
    0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/ip-src.log -t "ip-src" -l 1d -c
    0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/domain.log -t "domain" -l 1d -c
    0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/sha256.log -t "sha256" -l 1d -c
    0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/file.log -t "filename" -l 1d -c
    0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/registry.log -t "registry" -l 1d -c
    0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/mutex.log -t "mutex" -l 1d -c
    0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/threat-actor.log -t "threat-actor" -l 1d -c
    
    • 실제 내보내기 스크립트 위치에 따라 <YOUR_EXPORT_SCRIPT_PATH>를 업데이트합니다.

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

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

Google SecOps 고객 ID 가져오기

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

MISP 서버에 Bindplane 에이전트 설치

Linux 설치

  1. 루트 또는 sudo 권한으로 터미널을 엽니다.
  2. 다음 명령어를 실행합니다.

    sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
    

추가 설치 리소스

추가 설치 옵션은 설치 가이드를 참고하세요.

MISP 로그 파일을 수집하여 Google SecOps로 전송하도록 Bindplane 에이전트 구성

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

    receivers:
        filelog:
            file_path: /opt/misp/ioc_export/*.log
            log_type: 'file'
    
    exporters:
        chronicle/chronicle_w_labels:
            compression: gzip
            # Adjust the path to the credentials file you downloaded in Step 1
            creds_file_path: '/path/to/ingestion-authentication-file.json'
            # Replace with your actual customer ID from Step 2
            customer_id: <customer_id>
            endpoint: malachiteingestion-pa.googleapis.com
            # Add optional ingestion labels for better organization
            ingestion_labels:
                log_type: 'MISP_IOC'
                raw_log_field: body
    
    service:
        pipelines:
            logs/source0__chronicle_w_labels-0:
                receivers:
                  - filelog
                exporters:
                    - chronicle/chronicle_w_labels
    
    • 인프라에 필요한 대로 포트와 IP 주소를 바꿉니다.
    • <customer_id>를 실제 고객 ID로 바꿉니다.
    • Google SecOps 수집 인증 파일 가져오기 섹션에서 인증 파일이 저장된 경로로 /path/to/ingestion-authentication-file.json를 업데이트합니다.

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

Linux에서 Bindplane 에이전트를 다시 시작하려면 다음 명령어를 실행합니다.

  sudo systemctl restart bindplane-agent

UDM 매핑 테이블

로그 필드 UDM 매핑 논리
Attribute.category event.idm.entity.metadata.threat.category_details 'data' 필드 내 중첩된 JSON 객체의 Attribute.category에서 직접 매핑됩니다. JSON 파싱 경로에서 사용됩니다.
Attribute.comment event.idm.entity.metadata.threat.summary 'data' 필드 내 중첩된 JSON 객체의 Attribute.comment에서 직접 매핑됩니다. JSON 파싱 경로에서 사용됩니다.
Attribute.deleted event.idm.entity.metadata.threat.detection_fields.value Attribute.deleted에서 직접 매핑되었으며 키가 'Attribute deleted'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Attribute.event_id event.idm.entity.metadata.threat.detection_fields.value Attribute.event_id에서 직접 매핑되었으며 키가 'Attribute event_id'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Attribute.first_seen event.idm.entity.metadata.threat.detection_fields.value Attribute.first_seen에서 직접 매핑되었으며 키가 'Attribute first_seen'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Attribute.id event.idm.entity.metadata.threat.detection_fields.value Attribute.id에서 직접 매핑되며, 파싱 경로에 따라 키가 '속성 ID' 또는 '속성 ID $$'인 감지 필드로 추가됩니다. CSV 및 JSON 파싱 경로 모두에서 사용됩니다.
Attribute.timestamp event.idm.entity.metadata.threat.detection_fields.value Attribute.timestamp에서 직접 매핑되었으며 키가 'Attribute timestamp'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Attribute.to_ids event.idm.entity.metadata.threat.detection_fields.value Attribute.to_ids에서 직접 매핑되고 키가 'Attribute to_ids'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Attribute.type log_type 'data' 필드 내 중첩된 JSON 객체의 Attribute.type에서 직접 매핑됩니다. 임시 필드로 사용되며 나중에 다른 UDM 필드를 채우는 데 사용됩니다. JSON 파싱 경로에서 사용됩니다.
Attribute.uuid event.idm.entity.metadata.product_entity_id 'data' 필드 내 중첩된 JSON 객체의 Attribute.uuid에서 직접 매핑됩니다. JSON 파싱 경로에서 사용됩니다.
Attribute.value 다수 이 필드의 값은 Attribute.type (또는 Attribute.type에서 파생된 경우 log_type)에 따라 여러 UDM 필드를 채우는 데 사용됩니다.
- type이 'domain'인 경우 event.idm.entity.entity.hostname
- event.idm.entity.entity.file.md5(type이 'md5'인 경우)
- event.idm.entity.entity.file.sha1(type이 'sha1'인 경우)
- type이 'sha256'인 경우 event.idm.entity.entity.file.sha256
- type이 'mutex'인 경우 event.idm.entity.entity.resource.name
- type이 'regkey'인 경우 event.idm.entity.entity.registry.registry_key
- type이 'threat-actor'인 경우 event.idm.entity.entity.user.email_addresses
- typeuri 또는 url인 경우 event.idm.entity.entity.url
- type이 'filename'인 경우 event.idm.entity.entity.file.full_path
- type이 'ip-dst|port', 'ip-dst' 또는 'ip-src'인 경우 IP 및 포트가 파싱됩니다. JSON 파싱 경로에서 사용됩니다.
column1 event.idm.entity.metadata.product_entity_id CSV 파싱 경로의 column1에서 직접 매핑됩니다.
column14 event.idm.entity.metadata.threat.description의 일부 description와 연결되어 위협 메타데이터의 최종 설명을 형성합니다. CSV 파싱 경로에서 사용됩니다.
column16 event.idm.entity.metadata.threat.threat_feed_name, event.ioc.feed_name column16에서 직접 매핑됩니다. CSV 파싱 경로에서 사용됩니다.
column18 event.idm.entity.metadata.threat.severity_details, event.ioc.raw_severity column18에서 직접 매핑됩니다. CSV 파싱 경로에서 사용됩니다.
column21 event.idm.entity.metadata.threat.description, event.ioc.description의 일부 설명의 기본으로 사용되며 나중에 event_info와 연결됩니다. CSV 파싱 경로에서 사용됩니다.
column3 event.ioc.categorization의 일부 column3에서 직접 매핑되고 'IOC'와 연결되어 최종 분류를 형성합니다. CSV 파싱 경로에서 사용됩니다.
column4 event.idm.entity.metadata.description column4에서 직접 매핑됩니다. CSV 파싱 경로에서 사용됩니다.
column5 다수 이 필드의 값은 column4 필드(type에 매핑됨)에 따라 여러 UDM 필드를 채우는 데 사용됩니다.
- event.idm.entity.entity.hostname(type이 'domain'인 경우)
- type이 'ip-dst|port', 'ip-dst' 또는 'ip-src'인 경우 IP 및 포트가 파싱됩니다.
- event.idm.entity.entity.file.md5(type이 'md5'인 경우)
- event.idm.entity.entity.file.sha1(type이 'sha1'인 경우)
- type이 'sha256'인 경우 event.idm.entity.entity.file.sha256
- type이 'mutex'인 경우 event.idm.entity.entity.resource.name
- type이 'regkey'인 경우 event.idm.entity.entity.registry.registry_key
- type이 'threat-actor'인 경우 event.idm.entity.entity.user.email_addresses
- typeuri 또는 url인 경우 event.idm.entity.entity.url
- type이 'filename'인 경우 event.idm.entity.entity.file.full_path CSV 파싱 경로에서 사용됩니다.
column6 event.idm.entity.metadata.threat.summary column6에서 직접 매핑됩니다. CSV 파싱 경로에서 사용됩니다.
column8 event.ioc.active_timerange.start, event.idm.entity.metadata.interval.start_time UNIX 타임스탬프로 파싱됩니다. CSV 파싱 경로에서 사용됩니다.
date description event.idm.entity.metadata.threat.description 'data' 필드 내 중첩된 JSON 객체의 description에서 직접 매핑됩니다. JSON 파싱 경로에서 사용됩니다.
event_creator_email event.idm.entity.entity.labels.value event_creator_email에서 직접 매핑되고 키가 'event_creator_email'인 라벨로 추가됩니다. JSON 파싱 경로에서 사용됩니다.
event_id Feed.publish event.idm.entity.metadata.threat.detection_fields.value Feed.publish에서 직접 매핑되고 키가 '피드 게시'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
first_seen event.ioc.active_timerange.start, event.idm.entity.metadata.interval.start_time 'yyyy-MM-ddTHH:mm:ssZZ' 형식의 타임스탬프로 파싱됩니다. JSON 파싱 경로에서 사용됩니다.
id info event.idm.entity.metadata.description 'data' 필드 내 중첩된 JSON 객체의 info에서 직접 매핑됩니다. JSON 파싱 경로에서 사용됩니다.
last_seen event.ioc.active_timerange.end 'yyyy-MM-ddTHH:mm:ssZZ' 형식의 타임스탬프로 파싱됩니다. JSON 파싱 경로에서 사용됩니다.
Org.name event.idm.entity.metadata.threat.detection_fields.value Org.name에서 직접 매핑되고 키가 'Org name'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
published event.idm.entity.metadata.threat.detection_fields.value published에서 직접 매핑되고 키가 'published'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Tag.colour event.idm.entity.metadata.threat.detection_fields.value Tag.colour에서 직접 매핑되었으며 키가 '태그 색상'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Tag.exportable event.idm.entity.metadata.threat.detection_fields.value Tag.exportable에서 직접 매핑되었으며 키가 'tag exportable'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Tag.hide_tag event.idm.entity.metadata.threat.detection_fields.value Tag.hide_tag에서 직접 매핑되고 키가 'tag hide_tag'인 감지 필드로 추가됩니다. JSON 파싱 경로에서 사용됩니다.
Tag.id event.idm.entity.metadata.threat.detection_fields.value Tag.id에서 직접 매핑되고 키가 'tag id'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Tag.is_custom_galaxy event.idm.entity.metadata.threat.detection_fields.value Tag.is_custom_galaxy에서 직접 매핑되었으며 키가 'tag is_custom_galaxy'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Tag.is_galaxy event.idm.entity.metadata.threat.detection_fields.value Tag.is_galaxy에서 직접 매핑되었으며 키가 'tag is_galaxy'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Tag.isinherited event.idm.entity.metadata.threat.detection_fields.value Tag.isinherited에서 직접 매핑되었으며 키가 'tag isinherited'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Tag.name event.idm.entity.metadata.threat.detection_fields.value Tag.name에서 직접 매핑되고 키가 '태그 이름'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Tag.numerical_value event.idm.entity.metadata.threat.detection_fields.value Tag.numerical_value에서 직접 매핑되었으며 키가 'tag numerical_value'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
Tag.user_id event.idm.entity.metadata.threat.detection_fields.value Tag.user_id에서 직접 매핑되었으며 키가 'tag user_id'인 감지 필드로 추가되었습니다. JSON 파싱 경로에서 사용됩니다.
threat_level_id event.idm.entity.entity.labels.value threat_level_id에서 직접 매핑되고 키가 'threat_level_id'인 라벨로 추가됩니다. JSON 파싱 경로에서 사용됩니다.
timestamp event.idm.entity.metadata.collected_timestamp, event.idm.entity.metadata.interval.start_time UNIX 타임스탬프로 파싱됩니다. CSV 파싱 경로에서 사용됩니다.
uuid event.idm.entity.metadata.vendor_name 파서에 의해 'MISP'로 설정됩니다. 파서에 의해 'MISP'로 설정됩니다. 기본값을 먼 미래 (에포크 이후 253402300799초)로 설정합니다. type 또는 log_type 필드를 기반으로 파서에 의해 결정됩니다. 'FILE', 'DOMAIN_NAME', 'IP_ADDRESS', 'MUTEX', 'RESOURCE', 'USER'일 수 있습니다. Attribute.type에 따라 Attribute.comment 또는 Attribute.value에서 파생될 수 있습니다. 유형이 IP 관련인 경우 Attribute.value 또는 column5에서 파싱됩니다. 유형이 'ip-dst|port'인 경우 Attribute.value 또는 column5에서 파싱됩니다. CSV 파싱의 column3 또는 JSON 파싱의 Attribute.category에서 파생됩니다. CSV 파싱의 column21column14에서 파생됩니다. column8 또는 first_seen에서 파생됩니다. last_seen에서 파생됨 grok 패턴을 사용하여 description에서 파생됩니다. column16에서 파생되거나 'MISP'로 설정됩니다. column18에서 파생됨 유형이 IP 관련인 경우 Attribute.value 또는 column5에서 파싱됩니다. 유형이 'ip-dst|port'인 경우 Attribute.value 또는 column5에서 파싱됩니다. 유형이 '도메인'인 경우 Attribute.value 또는 column5에서 파생됩니다. description 필드에서 추출된 confidence 필드에서 파생됩니다. 값은 'HIGH_CONFIDENCE', 'MEDIUM_CONFIDENCE', 'LOW_CONFIDENCE' 또는 'UNKNOWN_CONFIDENCE'일 수 있습니다. description 필드에서 추출된 confidence 필드에서 직접 매핑됩니다. CSV 파싱 경로의 column18에서 파생된 threat_level 필드에서 직접 매핑됩니다. CSV 파싱 경로의 column16에서 파생된 feed_name 필드에서 직접 매핑됩니다. CSV 파싱의 column21column14에서 파생됩니다. CSV 파싱의 column6 또는 JSON 파싱의 Attribute.comment에서 파생됩니다. 여러 필드가 해당 키와 함께 감지 필드로 추가됩니다. 여러 필드가 해당 키와 함께 라벨로 추가됩니다. 원시 로그의 최상위 timestamp 필드에서 복사했습니다.

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