Closed
Description
Ref:
Lines 99 to 102 in af828ae
| using (MemoryStream ms = new MemoryStream((byte[])SerializedValue)) | |
| { | |
| value = (new BinaryFormatter()).Deserialize(ms); | |
| } |
Lines 196 to 199 in af828ae
| using (MemoryStream ms = new MemoryStream(buffer)) | |
| { | |
| return (new BinaryFormatter()).Deserialize(ms); | |
| } |
Lines 222 to 227 in af828ae
| 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
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
pgovind commentedon Feb 10, 2021
I think this is a fairly easy library to turn off binary formatter support. Here's my proposal:
There already exists a
SettingsSerializeAs.Xmlenum. So, let's markSettingsSerializeAs.BinaryasObsoletefor .NET 6. Further, I want to throw an exception whenSettingsSerializeAs.Binaryis used unlessEnableUnsafeBinaryFormatterSerializationis set in the csproj.@GrabYourPitchforks, @ericstj, area-owners, thoughts?