Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set decryptionKey for legacy AES/3DES encryption #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ysoserial/Plugins/ViewStatePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down