From 6943197a84a10b19a9c17b8cf75c069d14959b74 Mon Sep 17 00:00:00 2001 From: Artem Guzhva <21160542+hexcat@users.noreply.github.com> Date: Mon, 16 Sep 2024 11:47:05 +0000 Subject: [PATCH] Set decryptionKey for legacy AES/3DES encryption --- ysoserial/Plugins/ViewStatePlugin.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ysoserial/Plugins/ViewStatePlugin.cs b/ysoserial/Plugins/ViewStatePlugin.cs index 62a9e87..80833ca 100644 --- a/ysoserial/Plugins/ViewStatePlugin.cs +++ b/ysoserial/Plugins/ViewStatePlugin.cs @@ -230,11 +230,14 @@ public object Run(string[] args) var readOnlyField = typeof(ConfigurationElement).GetField("_bReadOnly", BindingFlags.Instance | BindingFlags.NonPublic); readOnlyField.SetValue(config, false); // we don't really need the encryption/decyption keys to create a valid legacy viewstate but this is used when isEncrypted=true - if (!String.IsNullOrEmpty(decryptionKey) && (!isLegacy || (isLegacy && isEncrypted))) + if (!String.IsNullOrEmpty(decryptionKey)) { if (isDebug) { - Console.WriteLine("Encryption is on!"); + if (!isLegacy || (isLegacy && isEncrypted)) + Console.WriteLine("Encryption is on!"); + else if (validationAlg.ToUpper().Equals("3DES") || validationAlg.ToUpper().Equals("AES")) + Console.WriteLine("Legacy AES/3DES encryption is on!"); } config.Decryption = decryptionAlg; config.DecryptionKey = decryptionKey;