A .NET service reads messages from a queue that several partner systems publish to, and it deserializes each message with BinaryFormatter after verifying the partner's signature. A red team uses one compromised partner system to publish a validly signed gadget-chain payload and gains code execution. Which change BEST removes the weakness?
Show the answer
Correct answerC. Replace BinaryFormatter with a serializer bound to declared types
AWhy not this: Key rotation still lets a compromised partner sign messages with its current key, and the payload is unchanged.
BWhy not this: Lower privilege limits what the injected code can do, but the code still runs during deserialization.
CWhy this is right: A serializer that maps data only to declared types never instantiates attacker-chosen classes, so no gadget chain runs.
DWhy not this: TLS protects messages in transit; the malicious payload comes from a trusted, connected partner.
BinaryFormatter rebuilds whatever types the payload names, so a gadget chain runs code during deserialization; a serializer such as System.Text.Json binds only to declared types. Microsoft states it cannot be made secure and removed it from .NET 9. A signature only proves which partner sent the message, so a compromised partner still delivers a valid one.