Search

Splunk.BOTS / Boss of the SOC Ver.1 Write-Up (30/30)

2016년 Splunk Boss of the SOC 1회차 문제를 풀어볼 수 있다.
홈페이지 변조 사건 랜섬웨어 감염에 대한 Splunk 분석이 주제다.

특징

검색 범위가 그리 넓지 않고, 서버가 생각보다 넉넉해 소스 타입을 지정하지 않고도 전체 시간 범위 일반 문자열 검색이 꽤 빠르다. (ex. “Splunk”)
stats나 eval과 같이 추가적인 쿼리문을 요구하는 문제는 극히 적고 문제에서 요구하는 답을 빨리 찾기 위한 센스가 중심이다.
2016년 대회 당시 기준 문제로 Splunk 내부 로그가 아닌 외부에서 찾아야하는 정보의 경우 현재는 구할 수 없거나 유료인 경우가 간혹 있다.
문제는 빨리 풀수록 가산점이 붙고 한 번 틀릴 때마다 10점 감점이 있다. 감점을 당하더라도 빠르게 시도해보고 다른 시도로 넘어가는 것이 고득점에 유리하다.
1번이 점수가 더 높았음에도 2번에서 시간 소모가 훨씬 오래걸렸다. 웹과 시스템 분야에 대한 이해도가 풀이 속도에 차이를 만든다.

RULES

WriteUp (30/30)

Scenario 1 - Web Site Defacement

Today is Alice's first day at the Wayne Enterprise Security Operations Center. Lucius sits Alice down and gives her first assignment: A memo from Gotham City Police Department (GCPD). Apparently GCPD has found evidence online (http://pastebin.com/Gw6dWjS9) that the website www.imreallynotbatman.com hosted on Wayne Enterprise's IP address space has been compromised. The group has multiple objectives... but a key aspect of their modus operandi is to deface websites in order to embarrass their victim. Lucius has asked Alice to determine if www.imreallynotbatman.com. (the personal blog of Wayne Corporations CEO) was really compromised.
Scenario 1
Done
Scenario 1
Done

Scenario 2 - Ransomeware

After the excitement of yesterday, Alice has started to settle into her new job. Sadly, she realizes her new colleagues may not be the crack cybersecurity team that she was led to believe before she joined. Looking through her incident ticketing queue she notices a “critical” ticket that was never addressed. Shaking her head, she begins to investigate. Apparently on August 24th Bob Smith (using a Windows 10 workstation named we8105desk) came back to his desk after working-out and found his speakers blaring (click below to listen), his desktop image changed (see below) and his files inaccessible.
Alice has seen this before... ransomware. After a quick conversation with Bob, Alice determines that Bob found a USB drive in the parking lot earlier in the day, plugged it into his desktop, and opened up a word document on the USB drive called "Miranda_Tate_unveiled.dotm". With a resigned sigh she begins to dig into the problem...

후기 및 정리

번역은 오역이 많다. 문제가 애매모호한 경우가 많으니 영문을 꼭 제대로 읽어야 한다.
Check Sourcetypes . 어떤 소스타입이 있는지 알고 시작하자
| metadata type=sourcetypes index=botsv1 | table sourcetype totalCount
SQL
복사
아무리 찾아도 나오지 않는다면 검색 시작에 제한한 범위(ip, 소스타입, 시간)이 잘못된 경우다. 다른 방향의 IP, HOST,Soucetype로 접근하는 습관을 들이자. (S2 #207) 가능하면 (src_ip=”1.1.1.1” OR host=”1111") 과 같이 묶어 검색하는 것도 좋다.
Suricata, Windows로그와 같이 자주 쓰이는 소스타입 데이터를 많이 접할수록 유리하다.
문제에 Common이 들어가면 Splunk가 아닌 외부 사이트에서 찾아야되는 경우가 대다수다.
해시값을 구하는 문제는 꾸준히 나온다. ImageLoaded 필드를 기억하자 (S1 #110)
최초와 마지막 이벤트 시간 간격을 구하느라 Transcation을 오랜만에 사용했다.(S1 #118)
"imreallynotbatman.com" "passwd=batman" | rex field=form_data "passwd=(?<pass>\w+)" | transaction pass | eval duration = round(duration,2) | table duration
SQL
복사
다음은 exe 문자가 들어가는 필드들만 남기고 나머지는 필드 값을 null로 만드는 쿼리다. src_ip%exe% 부분만 수정하면 된다.
sourcetype= * src_ip="192.168.0.0" "exe" | foreach * [| eval <<FIELD>>=if(like(<<FIELD>>,"%exe%"),<<FIELD>>,null())]
SQL
복사
Sysmon 로그를 볼 때 CommandLine 필드가 처음에 보이질 않아서 미추출된 줄 알았는데 다음과 같이 설정하면 볼 수 있었다. 필드값을 찾을 때는 꼭 설정을 ‘모든 필드’로 맞추고 찾자. (S2 #204)
USB key (드라이브 이름)은 레지스트리 friendlyname 에 위치해있다. (S2 #205)
File Server 연결은 FTPSMB를 검색한다.(S2 #206) 이외 파일 서비스 프로토콜 : SMB, AFP, NFS, FTP, TFTP, RSync, WebDAV
WinEventLog:Security의 EventCode는 다음 사이트에서 검색하면 편하다
랜섬웨어와 같은 경우 실제로 사용되는 랜섬웨어를 기반으로 로그를 생성했다. (S2 #210) 따라서 Splunk로 찾기보다 관련 보고서를 통해서 문제를 해결하는 방법도 가능하다.

✓ 다른 [워게임] 포스트

Load more
︎ 더 많은 게시물을 보려면
︎ 작성자가 궁금하면?
 2023. absolroot all rights reserved.