Skip to content

Remove BinaryFormatter usage from SettingsPropertyValue #39295

@GrabYourPitchforks

Description

@GrabYourPitchforks

Ref:

using (MemoryStream ms = new MemoryStream((byte[])SerializedValue))
{
value = (new BinaryFormatter()).Deserialize(ms);
}

using (MemoryStream ms = new MemoryStream(buffer))
{
return (new BinaryFormatter()).Deserialize(ms);
}

using (MemoryStream ms = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, _value);
return ms.ToArray();
}

This issue tracks the removal and replacement of this code per the BinaryFormatter obsoletion plan.

For context: Reading from local configuration is generally perceived to be a "safe" operation. However, we have seen cases where the config APIs are used in multi-tenant environments, reading values from arbitrary XML files. The same thing hit ResourceReader a few years back. A popular web service allowed non-admins to upload .resx files, and when the web service tried parsing it it allowed RCE within the context of the service.

Metadata

Metadata

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions