#0606
Your configuration loader parses a JSON string and returns the resulting map for use at runtime.
The buggy implementation does not check whether the parsed object contains a `__class__` key. An attacker supplies `{"__class__":"os.system","args":"id"}` to trigger object instantiation and gain remote code execution.
The fix must inspect the parsed map and throw `'Disallowed class'` if a `__class__` key is present, accepting only plain data objects.
Insecure deserialization that allows class or type injection has led to critical RCE vulnerabilities in frameworks across every major language. A simple key-presence check prevents the entire attack surface.
loadConfig('{"__class__":"os.system","args":"rm -rf /"}')// BUG returns the map — attacker payload accepted// FIX throws: 'Disallowed class'
loadConfig('{"host":"localhost","port":5432}')// returns: {host: 'localhost', port: 5432}