https://www.alphabot.com/security/blog/2017/net/How-to-confi...
https://www.alphabot.com/security/blog/2017/net/How-to-confi...
Json.NET seems to allow the same behavior, but has it disabled by default.
> In fact the only kind that is not vulnerable is the default: TypeNameHandling.None
In the JSON case linked, I presume there is a root type given when you are attempting to deserialize a document. However, if one of the properties of that type is ambiguous (say System.Object), and the deserialization algorithm looks for a 'type' property in the JSON with a class name to determine what is instantiated, then there can be all sorts of unintentional types that might be built by the processing of that malicious JSON.
[1] https://googleprojectzero.blogspot.co.uk/2017/04/exploiting-...
Full disclosure, I’m the author of that blog post.
> Binary serialization can be dangerous. Never deserialize data from an untrusted source and never round-trip serialized data to systems not under your control.
The killed it in .NET Core 1.x; but brought it back in .NET Core 2.x due to back compat and interop complaints
I've been using .NET binary serialization for dirt cheap local snapshots for the purpose of undo/redo. It's perfect for this.
Using the Newtonsoft library you can configure it using `JsonSerializerSettings.ReferenceLoopHandling`, and with with protobuf-net you set `AsReference` on your class's `ProtoContractAttribute`. I don't think MessagePack-CSharp or msgpack-cli support cyclic references tho.