Now Hacked
EN-GB

Daily security quiz #9

Question for 2026-11-09. Read the code and pick the most serious security vulnerability.

MediumJavaScript (Node.js)2026-11-09

This function merges user settings with defaults. body is the request JSON. What is the most serious vulnerability?

function merge(target, source) {
  for (const key in source) {
    if (typeof source[key] === 'object' && source[key] !== null) {
      target[key] = merge(target[key] ?? {}, source[key]);
    } else {
      target[key] = source[key];
    }
  }
  return target;
}
 
const settings = merge({}, req.body);

Past questions