1.1.Modbus协议分析

题目:黑客通过外网进入一家工厂的控制网络,之后对工控网络中的操作员站系统进行了攻击,最终通过工控协议破坏了正常的业务。我们得到了操作员站在攻击前后的网络流量数据包,我们需要分析流量中的蛛丝马迹,找到FLAG。
题目附件连接:https://pan.baidu.com/s/1jGu7-1EKc29HTQc-pCJZlw (提取码:8kqx)
解题步骤:

  1. 首先打开流量包,数据包都是关于Modbus/TCP的流量。

  2. 运行脚本,分析流量包中Modbus/TCP的协议功能码,脚本和运行结果如下:

    import pyshark
    def get_code():
         captures = pyshark.FileCapture("question_1564353677_modbus1.pcap")
         func_codes = {}
         for c in captures:
             for pkt in c:
                 if pkt.layer_name == "modbus":
                     func_code = int(pkt.func_code)
                     if func_code in func_codes:
                         func_codes[func_code] += 1
                     else:
                         func_codes[func_code] = 1
         print(func_codes)
    if __name__ == '__main__':
     get_code()
    

  3. modbus常见功能码分析,分析结果我们可以知道1(读取线圈状态),3(读多个寄存器),4(读输入寄存器),2(读取输入内容),四个功能码都出现了702次,唯独16(预置多个寄存器)功能码只出现了两次,所以猜测与16功能码相关的流量可能存在关键数据,于是运行脚本分析与16功能码相关的流量,提取其中的数据,脚本和运行结果如下:

    import pyshark
    def find_flag():
         cap = pyshark.FileCapture("question_1564353677_modbus1.pcap")
         idx = 1
         for c in cap:
             for pkt in c:
                 if pkt.layer_name == "modbus":
                     func_code = int(pkt.func_code)
                     if func_code == 16:
                         payload = str(c["TCP"].payload).replace(":", "")
                         print(hex_to_ascii(payload))
                         print("{0} *".format(idx))
             idx += 1
    def hex_to_ascii(payload):
     data = payload
     flags = []
     for d in data:
         _ord = ord(d)
         if (_ord > 0) and (_ord < 128):
             flags.append(chr(_ord))
     return ''.join(flags)
    if __name__ == '__main__':
     find_flag()
    

  4. 提出的数据存在一个16进制字符串
    00000000003901100001001932005400680065004d006f006400620075007300500072006f0074006f0063006f006c0049007300460075006e006e00790021,将16进制字符串在线转换对应的ASII码,得到TheModbusProtocolIsFunny!,提交成功,Flag为TheModbusProtocolIsFunny!

1.2.工业协议分析1

题目:工业网络中存在异常,尝试通过分析PCAP流量包,分析出流量数据中的异常点,并拿到FLAG。
题目附件连接:https://pan.baidu.com/s/17jkHLBqcjxP0o9FpGIfObA (提取码:95ds)
解题步骤:

  1. 打开流量包,发现存在PRES、TCP、COTP、MMS协议的流量,其中选择一个数据包,追踪TCP流发现存在关键字flag.txt,如图所示:

  2. 然而通过多次分析与flag.txt相对应的流量包中,没有发现flag.txt的内容,于是换一个思路,对流量包进行关键字(jpg、png、zip、rar、flag)搜索,查看是否存在其他的文件。在linux系统中使用grep指令,可以对文件进行指定关键字搜索。linux中grep命令用法,我们使用指令进行关键字搜索

    grep "flag" -a test.pacp
    grep ".zip" -a test.pacp
    grep ".jpg" -a test.pacp
    grep ".png" -a test.pacp
    

    最终,发现存在base64加密的png图片码,如图所示:

  3. 运行脚本,将图片码进行base64解码,解码后得到写有Flag的图片,Flag为flag{ICS-mm104},脚本和原始图片如下:
    # coding=utf-8
    import os, base64
    img_str = 'iVBORw0KGgoAAAANSUhEUgAAAdAAAABiCAYAAADgKILKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABzXSURBVHhe7Z2Js11Fncfn75maqZmaqZkaS0elXAp1GHRUhGFAQHYQFQRFBWQRiBoBWQyyKaBsxo0tCAgkQHayQEL2jSxAyEoSIAHOvM/JPTPn9fv1Od19+9z3bvh+qr5FkXe77z33ntO/7l//fr/+m0IIIYQQ0ciACiGEEAnIgAohhBAJyIAKIYQQCciACiGEEAnIgAohhBAJyIAKIYQQCciACiGEEAnIgAohhBAJyIAKIYQQCciACiGEEAnIgAohhBAJyIAKIYQQCciACiGEEAnIgAohhBAJyIAKIYQQCciACiGEEAnIgAohhBAJyIAKIYQQCciACiGEEAnIgAohhBAJyIAKIYQQCciACiGEEAnIgAohhBAJyIAKIYQQCciACiGEEAnIgAohhBAJyIAKIYQQCciACiGEEAl0ZkDff78oNm/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zJUJ9UKvOOtb1N2UzNHGCEyhIwZou6cuAinSIDqv/0JVWRYTGuzlbPBScjyqEEB80WGnXx0NEClKXyICOE5brhplvzP7K5OvHFnXgINyJssISQohBgPfPOhvad0B+LmRAxwH2Qt0fGpGnGAOHhFv9HHbkc+UKF9c17lAhhDjUeOzJzWV1JaLorZQdtodyHn5uIQM6DpCv6f7YiOIQsfhOoa/EyQpCCHGo0ZZGeO/UblefIAM6YNiot35sROWiWAhuuOZGf1EBGVAhxKGIz4CyFcbKdBCRxDKgiVAyjvM4if4NgVzDh6Zt9KbbpJwpWocC6Rxv5tbHlQEVQhyKuAaUoMrrp6zoK5MiFhnQROp5n6TO3Dd1fbFw8fbS506VIIozE8zDgbwYzqYi8iT0p6w+LZh1UU2J/las2lVs2jKxz+UUQogUKMlIURxSFHe/OT7ZBzKgCZDXGVK4IVS56moKIYQYHDKgCVDJxDKEKaLgghBCiOFDBjQBcossYxgj/PXzXlCKiRBCDCsyoIlwQjvlrz50uH04s0/Hnjq3DEAa5MHNQggh8iMD2icH3n2/WLlqd1kE/tY7VxdXTV5a1nw9/6JF5X8paECR96dnvDruxcuFEELkQwZUCCGESEAGVAghhEhABlQIIYRIQAZUCCGESEAGVAghhEhABlQIIYRIQAZUCCGESEAGVAghhEhABlQIIYRIQAZUCCGESEAGVAghhEhABlQIIYRIQAZUCCGESEAGVAghhIimKP4XBcAIzFfvoBoAAAAASUVORK5CYII='
    img_data = base64.b64decode(img_str)
    with open('1.png', 'wb') as f:
       f.write(img_data)
    print 'successful'
    

1.3.工业协议分析2

题目:在进行工业企业检查评估工作中,发现了疑似感染恶意软件的上位机。现已提取出上位机通信流量,尝试分析出异常点,获取FLAG。
题目附件连接:https://pan.baidu.com/s/1efRIQfLXkXDwrMhJZC2ZOA (提取码:vxx2)
解题步骤:

  1. 打开流量包,发现存在关于ARP、UDP、SNA协议的流量包,其中存在大量的UDP流量,如图所示:

  2. 首先对UDP流量包进行分析,分析发现UDP流量包的长度存在大量相同,一共出现的长度分别为16 17 12 14 10 18 19 20 22 25 32 89 95 104 105 116 131 137 524 528,在这些长度中仅12,89,104,105,131,137出现一次,其余长度多次出现,于是猜测这仅出现一次的流量包存在异常,于是分别分析12,89,104,105,131,137对应的流量包,发现131,137对应的流量包存在异常的字符串,如图所示:

  3. 提取出字符串666c61677b37466f4d3253746b6865507a7d,并转换成对应ACII码,得到Flag,Flag为flag{7FoM2StkhePz}

1.4.组态软件安全分析

题目:一些组态软件中进行会配置连接很多PLC设备信息。我们在SCADA工程中写入了flag字段,请获取该工程flag
题目附件连接:链接:https://pan.baidu.com/s/1LmaQpEJ-n3t654BhdjUrRg (提取码:xbuu)
解题步骤:

  1. 解压附件,发现得到一个.PCZ的文件,用记事本打开发现文件头为PK,于是将.PCZ的文件后缀改为.zip,解压后得到一个演示工程的文件夹,里面包含了很多文件,如图所示:

  2. 题目表明Flag就在文件夹中的某一个文件中,一个个打开审计过于麻烦,可以利用linux系统的grep指令,帮助我们在文件夹中查找指定关键字,在演示工程的文件夹中,使用指令grep -r "flag" ./进行搜索,最终得到Flag,Flag为flag{D076-4D7E-92AC-A05ACB788292}

1.5.工控蜜罐日志分析

题目:工控安全分析人员在互联网上部署了工控仿真蜜罐,通过蜜罐可抓取并分析互联网上针对工业资产的扫描行为,将存在高危扫描行为的IP加入防火墙黑名单可有效减少工业企业对于互联网的攻击面。分析出日志中针对西门子私有通信协议扫描最多的IP,分析该扫描组织。FLAG为该IP的域名。
题目附件连接:https://pan.baidu.com/s/1WtuqaE64Zm2HqTPseIKUig (提取码:zu58)
解题步骤:

  1. 附件是一个henoypot.log,内容格式如图所示:

  2. 根据题目提示,Flag为某个IP对应的域名,于是可以编写脚本,首先提取出日志的IP,并且去重IP,然后再对每一个IP反查域名,寻找正确的域名,脚本和运行结果如下:

    #-*- coding:utf-8 -*-
    import fileinput
    import re
    import os
    import shutil
    def readIp():
     with open(r'/root/python/honeypot.log', 'r') as f:
          for line in f.readlines():
             result2 = re.findall('[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}',line) #匹配ip正则表达式                          
             if not result2 == []:
                 result = result2[0] + '\n'
             with open('/root/python/ip.txt', 'a+') as w:
                 w.write(result)
    def setIp():#去重
     a=0
     readDir = "/root/python/ip.txt"
     writeDir = "/root/python/newip.txt"#new
     lines_seen = set()
     outfile = open(writeDir, "w")
     f = open(readDir, "r")
     for line in f:
       if line not in lines_seen:
         a+=1
         outfile.write(line)
         lines_seen.add(line)
     print(a)
     outfile.close()
    def readDns():
     with open(r'/root/python/newip.txt', 'r') as g:
         for i in g.readlines():
             com=os.popen('nslookup %s'%i)
             comm=com.read()
             if comm.find('NXDOMAIN')==-1:
                 print comm
    if __name__ == '__main__':
     readIp()
     setIp()
     readDns()
    

  3. 最终尝试域名,找到正确的域名为:scan-42.security.ipip.net,Flag为scan-42.security.ipip.net

1.6.隐信道数据安全分析

题目:安全分析人员截获间谍发出的秘密邮件,该邮件只有一个mp3文件,安全人员怀疑间谍通过某种private的方式将信息传递出去,尝试分析该文件,获取藏在文件中的数据?
题目附件连接:链接:https://pan.baidu.com/s/1IcP-kaKw02jHUOIgTEOh6g (提取码:kgqa)
解题步骤:

  1. 题目提示文件使用了private加密信息,在010Editor中打开mp3文件,发现存在private bit,因此,只需要提取每一个mf组中的该字节,组合起来,就是答案。可以从图中看到 ms 开始位为1 C1B8H,即第115128字节,如图所示:,如图所示:
uint32 frame_sync : 12
    uint32 mpeg_id : 1
    uint32 layer_id : 2
    uint32 protection_bit : 1
    uint32 bitrate_index : 4
    uint32 frequency_index : 2
    uint32 padding_bit : 1
    uint32 private_bit : 1
    uint32 channel_mode : 2
    uint32 mode_extension : 2
    uint32 copyright : 1
    uint32 original : 1
    uint32 emphasis : 2

12+1+2+1+4+2+1+1+2+2+1+1+2=32,即总共4字节,private_bit 为24,所在的字节为第3个字节因此要从前一个,即第二个字节开始提取内容,该字节对应的地址为 115130观察每一个mf组,大小都为414h,即1044字节,因此可以得到以下脚本:

# coding:utf-8
import re
import binascii
n = 115130
result = ''
fina = ''
file = open('flag-woody.mp3','rb')
while n < 2222222 :
    file.seek(n,0)
    n += 1044
    file_read_result = file.read(1)
    read_content = bin(ord(file_read_result))[-1]
    result = result + read_content
textArr = re.findall('.{'+str(8)+'}', result)
textArr.append(result[(len(textArr)*8):])
for i in textArr:
    fina = fina + hex(int(i,2))[2:].strip('\n')
fina = fina#.decode('hex')
print (fina)

将得到的字符串
464c41477b707231763474335f6269377d25a1cedc3e69888894dac4dd3a87c5e1c5276fa6d626832148d39288a0c596c95abaac3f09f9f524647595ae4894f9b82b3f4c1b47537c365d8d69d84a353c1a93ae436761d430e666e4111752d479746d1828f9c07c27ab1c3eaf1948f8a9e839b280a4342f321e89eb73b237a2b55d5310b77811c0975cfc1365e146f6c9212e244751398f73c17ee1a6664b4fd712d4b0a297275fa471fb65e440bc7bdc12fb0a39d81a1d374f2d55b8faabf9bf2c342f1046fbab7e66ac7896ffac672d277b89f8606759a8ac21a58fbb4b9b51d45f126a7f67c1a297e1fcb638356ec739b89555568816
转换对应的ASCII码,得到Flag,Flag为FLAG{pr1v4t3_bi7}

点击收藏 | 1 关注 | 1
  • 动动手指,沙发就是你的了!
登录 后跟帖