[SK shieldus Rookies 16기] 클라우드 기반 스마트 융합보안 과정
클라우드기반 시스템 운영 구축 실무 #08
학습 내용
-
-
Sysmon
# 윈도우 운영체제에 설치되는 시스템 모니터링 툴
# 프로세스 생성/종료, 파일 생성/ 수정 시간, 네트워크 설정 정보(IP, 포트 번호)등의 정보
MS의 자회사 Sysinternal
• Microsoft의 Sysinternal suite에 포함된 시스템 모니터링 툴
• 기본 윈도우 이벤트 로그로는 한계가 있는 프로세스 생성, 네트워크 연결,
파일 생성 시간 변경 등의 정보를 추출한 후 윈도우 이벤트 저장소에 저장
* 이벤트 기반 정보가 아닌 ‘행동 기반 정보’를 수집에서 이벤트 저장소에 저장
Sysmon 기능
• 실행 프로세스와 부모 프로세스의 전체 명령 줄을 로그로 저장
• MD5, SHA1, SHA256 알고리즘으로 실행 프로그램의 해시 값을 기록
• 여러 종류의 해시 값을 동시에 기록
• 네트워크 연결에서 IP주소, 포트번호, 호스트명, 포트명 등을 기록
• 레지스트리에서 환경 설정이 변경된 경우 자동으로 다시 읽어 들임
Sysmon 설치
❶ 파일 다운로드 후 설치
C드라이브 밑에 압축을 푼다
❷ sysmon 활성화
관리자 권한으로 명령 프롬프트 실행
cd \sysmon
sysmon64.exe -accepteula –i
이벤트 뷰어 > 응용 프로그램 및 서비스 로그 > Microsoft > Windows > Sysmon > Operational
Sysmon 생성 이벤트 목록
forwarder를 설치하면 시간별 sysmon 로그를 실시간으로 서버에 넘겨줄 수 있다.
[로그 수동 업로드
- 인덱스 생성과 로그 업로드 대신 다음 과정을 진행한다 ]
forwarder를 통해 넘어왔다는 전제하에 실습을 진행하기 위해 환경을 설정한다
sysmon.tgz 파일을 다음 경로에 압축 해제한다
C:\Program Files\Splunk\var\lib\splunk
sysmon 인덱스 환경 설정
C:\Program Files\Splunk\etc\apps\search\local
indexes.conf 파일에 다음 내용을 추가한다
[sysmon] coldPath = $SPLUNK_DB\sysmon\colddb enableDataIntegrityControl = 0 enableTsidxReduction = 0 homePath = $SPLUNK_DB\sysmon\db maxTotalDataSizeMB = 512000 thawedPath = $SPLUNK_DB\sysmon\thaweddb |
➏
변경한 설정을 반영하기 위해
SplunkEnterprise 서버를 다시 시작한다.
설정 > 서버 컨트롤 > Splunk 다시 시작
➐ sysmon 로그 검색
그 결과, sysmon 인덱스가 반영되었고, index=sysmon 검색이 잘 수행된다.
3) PC 이상 징후 분석
❶ 비정상 폴더에서 exe 파일 실행
❷ 파일 실행 후 원본 파일 삭제
❸ 실행 후 네트워크 접속 다수 발생
❹ 네트워크 Shell 실행
❶ 비정상 폴더에서 exe 파일 실행
• 윈도우 실행 파일(시스템폴더) 위치
- C:\Program Files, C:\Program Files(x86), C:\Windows, C:\Window\system32
• 일반적으로 공격에 사용되는 악성코드는 단독 실행 파일로 동작
- 시스템 폴더에 설치되지 않음
<<프로그램의 실행 경로를 판단한다면 이상징후를 판별 가능 >>
- 인터넷으로 다운로드한 악성코드가 처음부터 시스템 폴더에 복사되지는 않기 때문에 최초 실행 폴더를 기반으로 탐지하는 방법은 유효함
- 악성 코드가 사용자 PC에 다운로드되고 실행이 되었다면 프로세스가 생성되므로 Sysmon 이벤트 코드 1에서 해당 이벤트를 찾을 수 있음
* 백도어 프로그램은 윈도우 정상 파일의 대체로 C:\Windows\System32에 설치되기도 함
index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(CurrentDirectory!="*Program FIles*" AND CurrentDirectory!="*system32*")
(Image!="*system32*" AND Image!="*Program FIles*" AND Image!="*SysWOW64*")
[search index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| rare CurrentDirectory limit=10 showperc=f showcount=f]
| table Image
sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
❷ 파일 실행 후 원본 파일 삭제
• 하드 디스크에 저장된 악성코드는 프로세스 상태가 되어야 PC들을 감염시킬 수 있음
• 악성코드 파일 실행 후 원본파일을 디스크에서 삭제해서 분석을 회피하기도 함
* 프로그램을 실행 후 원본 파일을 디스크에서 삭제하는 행위는 정상 행위 아님
index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 ParentImage="C:\\windows\\explorer.exe"
[search index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational"
| where NOT isnull(Image) AND NOT isnull(ParentImage)
| search CommandLine="* del *"
| table ParentImage
| rename ParentImage AS Image]
| table Image
index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 ParentImage="C:\\windows\\explorer.exe"
- sysmon 인덱스에서 sysmon 로그 유형을 검색
- 프로세스 생성(실행) 관련 로그 검색
- 윈도우 탐색기에서 시작된 프로세스 즉, 윈도우 탐색기가 실행한 파일을 검색
[search index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational"
| where NOT isnull(Image) AND NOT isnull(ParentImage)
| search CommandLine="* del *"
| table ParentImage
| rename ParentImage AS Image]
| table Image
❸ 실행 후 네트워크 접속 다수 발생
악성코드(DDoS)에 감염된 것을
index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(Image!="C:\\Windows*" AND Image!="*Program FIles*")
[search index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=3
(DestinationIp!="10.0.0.0/8" AND DestinationIp!="172.16.0.0/12" AND DestinationIp!="192.168.0.0/16")
| stats count(DestinationIp) AS total_count dc(DestinationIp) AS uniq_count by Image
| where total_count > 50 OR uniq_count > 20
| table Image]
| table Image
index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(Image!="C:\\Windows*" AND Image!="*Program FIles*")
-
[search index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=3
(DestinationIp!="10.0.0.0/8" AND DestinationIp!="172.16.0.0/12" AND DestinationIp!="192.168.0.0/16")
| stats count(DestinationIp) AS total_count dc(DestinationIp) AS uniq_count by Image
| where total_count > 50 OR uniq_count > 20
| table Image]
| table Image
❹ 네트워크 Shell 실행
• netsh.exe
- 현재 실행 중인 컴퓨터의 네트워크 구성을 표시하거나 수정할 수 있는 명령줄 스크립팅 유틸리티
- 관리자는 netsh을 이용하여 자동 스크립트를 구성하고 배포
웹 쉘 파일명을 기반으로 검색하는 수밖에 없다.
index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| where match(Image, "netsh.exe$")
| where NOT isnull(ParentImage)
| table ParentImage, Image, COmmandLine
index=sysmon sourcetype="WinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| where match(Image, "netsh.exe$")
| where NOT isnull(ParentImage)
- 파일 탐색기같은 body를 통해 실행되지 않은
| table ParentImage, Image, COmmandLine
'SK shieldus Rookies > 클라우드 기반 시스템 운영ㆍ구축 실무' 카테고리의 다른 글
Splunk 실습 - HTTP Log 분석 (미완) (0) | 2024.01.11 |
---|---|
[SK shieldus Rookies 16기] Splunk 실습 - DNS Log 분석 (0) | 2024.01.11 |
SIEM - Splunk 실습(Splunk Enterprise) & 검색 명령어 (미완) (0) | 2024.01.10 |
[SK shieldus Rookies 16기] Zeek 환경 구성 (0) | 2024.01.09 |
Web 구조, HTTP 메시지 구조 (미완) (0) | 2024.01.09 |