5
6Sophos UTM
7(C) Copyright 2000-2014 Sophos Limited and others. All rights reserved.
8Sophos is a registered trademark of Sophos Limited and Sophos Group.
9All other product and company names mentioned are trademarks or registered
10trademarks of their respective owners.
11
12For more copyright information look at /doc/astaro-license.txt
13or http://www.astaro.com/doc/astaro-license.txt
14
15NOTE: If not explicitly approved by Sophos support, any modifications
16 done by root will void your support.
17
18loginuser@test:/home/login > su
19Password:
20test:/home/login # id
21uid=0(root) gid=0(root) groups=0(root),890(xorp)
22test:/home/login # uname -a
23Linux test 3.8.13.27-0.176377654.gd7350fc-smp64 #1 SMP Wed Sep 17 10:45:23 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
24test:/home/login # cat /proc/version
25Linux version 3.8.13.27-0.176377654.gd7350fc-smp64 (abuild@axgbuild) (gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) ) #1 SMP Wed Sep 17 10:45:23 UTC 2014
26test:/home/login # cat /etc/version
27 9.208008
28test:/home/login # 2. 登录抓包
接下来就是登录抓包进行登录验证分析,使用的工具是Burp Suite Pro,正确配置之后,就可以有完整的登录验证包。
1POST /webadmin.plx HTTP/1.1
2Host: 192.168.21.100:4444
3User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0
4Accept: text/javascript, text/html, application/xml, text/xml, */*
5Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
6Accept-Encoding: gzip, deflate
7X-Requested-With: XMLHttpRequest
8X-Prototype-Version: 1.5.1.1
9Content-type: application/x-www-form-urlencoded; charset=UTF-8
10Content-Length: 287
11Origin: http://192.168.21.100:4444
12Connection: close
13Referer: http://192.168.21.100:4444/
14
15{"objs": [{"elements": {"login_username": "admin", "login_password": "test0011"}, "FID": "login_process"}], "SID": "0", "browser": "gecko", "backend_version": -1, "loc": "english", "_cookie": null, "wdebug": 0, "RID": "1604979704552_0.8572369473251601", "current_uuid": "", "ipv6": true}发现登陆是使用json格式进行网络请求,方法是POST,请求的的接口文件是webadmin.plx,同时登陆之后的页面请求和展示都是通过webadmin.plx进行数据交互,接下来就是对webadmin.plx进行解析分析。 02疑难问题截止到此处,还没有遇到无法解决的问题,但深入文件分析时却给了沉重的一击,先来看webadmin.plx的文件属性:
1test:/var/sec/chroot-httpd/var/webadmin # file webadmin.plx
2webadmin.plx: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped
32位可执行文件,没有异常,但是当使用GDB调试的时候提示:
[attach]58947[/attach]
GDB提示文件格式不正确,事实是该文件可以执行:
1test:/var/sec/chroot-httpd/var/webadmin # ./webadmin.plx
2[19370] WARN: Use of uninitialized value $ENV{"REQUEST_METHOD"} in string eq at /wfe/asg/modules/asg_fcgi.pm line 59.
3test#
有正常的错误返回,说明webadmin.plx文件正常,执行正常。
又发现该文件没有任何的Section:
1a@DESKTOP-22L12IV:$ readelf -S webadmin.plx
2There are no sections in this file.
IDA Pro又能够正常解析elf文件,只有 LOAD节。
[attach]58948[/attach]
两眼一抓瞎,这时该怎么办?
GDB调试进程,失败。
尝试使用GDB附加调试进程,失败+1,not in executable format: File format not recognized。
尝试GDB附加父进程,然后调试子进程,失败+1,not in executable format: File format not recognized。
尝试GDB dumps内存,失败+1,not in executable format: File format not recognized。
GDB Server远程调试,失败+1,not in executable format: File format not recognized。
获取两个不同版本的webadmin.plx文件,进行补丁对比,无差别,失败+1。
查找分析ELF反调试手段,失败+1。
最后得出结论,GDB调试无效,继续接着找其他办法。 梳理一下目前得到的信息:
1. webadmin.plx负责处理UTM系统登录,页面交互处理等等工作,是一个主体处理文件。
2. ELF可执行程序,32位。
3. 可正常执行。
4. GDB调试无效。
5. 无反调试。
6. 补丁对比无效。
若进行安全分析和漏洞挖掘,就必须剁掉webadmin.plx,接着分析吧。
分析webadmin.plx,查找ELF中的字符串,其中几个字段尤为可疑:
1[test@192 Desktop]$ ./test
2Hello, World! # 正常执行
3[test@192 Desktop]$
使用GDB调试编译好的程序:
1[test@192 Desktop]$ gdb test
2GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-119.el7
3Copyright (C) 2013 Free Software Foundation, Inc.
4License GPLv3+: GNU GPL version 3 or later
5This is free software: you are free to change and redistribute it.
6There is NO WARRANTY, to the extent permitted by law. Type "show copying"
7and "show warranty" for details.
8This GDB was configured as "x86_64-redhat-linux-gnu".
9For bug reporting instructions, please see:
10...
11"/home/test/Desktop/test": not in executable format: File format not recognized # 同样的报错提示
12(gdb)
好吧,同样的not in executable format: File format not recognized报错提示,完美复刻webadmin.plx遇到的问题。 现在来梳理一下目前的信息:
1. webadmin.plx是使用 PerlApp编译而成的ELF文件2. 不能使用GDB调试,GDB Server也不行3. 网络上没有Linux反编译Perl的资料在团队小伙伴ztop(此处应该有掌声)的帮助下,发现使用IDA的linux_server,结合IDA远程调试,就可以完美绕过GDB无法调试的问题。在Centos 7中无法使用IDA远程调试,不知道具体原因是什么,遂放弃,选择使用Kali 2018 R4,IDA的主机为Windows。1root@kali:~# chmod +x linux_server
2root@kali:~# ./linux_server
3IDA Linux 32-bit remote debug server(ST) v1.22. Hex-Rays (c) 2004-2017
4Listening on 0.0.0.0:23946...
5
6[1] Accepting connection from 192.168.21.1...
7Warning: Section header string table index 26 is out of bounds
8Hello, World!
9Looking for GNU DWARF file at "/usr/lib32/2651bcf6f5569acd1dba629eaaaa5f002af684.debug"... no.
10Looking for GNU DWARF file at "/usr/lib32/.debug/2651bcf6f5569acd1dba629eaaaa5f002af684.debug"... no.
11[1] Closing connection from 192.168.21.1...
12
linux_server的监听23946端口,需要在宿主机进行配置。
[attach]58953[/attach]
webadmin.plx的main函数中:
1signed int __cdecl paperl_main(int a1, int a2, int a3, _DWORD *a4, int (__cdecl *a5)(int))
2{
3 signed int v5; // ebx
4 int v7; // [esp+10h] [ebp-8h]