Skip to main content
Back to challenges

Web Security · Capture the flag

Prototype Pollution to RCE

Advanced · 4/5
Paid planSpecialist rank required125 points on first solo solve

Challenge brief

A Node.js application uses a vulnerable merge function. Exploit prototype pollution to achieve RCE.

Vulnerable Code

function merge(target, source) {
  for (let key in source) {
    if (typeof source[key] === 'object') {
      target[key] = merge(target[key] || {}, source[key]);
    } else {
      target[key] = source[key];
    }
  }
  return target;
}

Endpoint

POST /api/settings
Content-Type: application/json

{"theme": "dark"}

Pollute Object.prototype, redirect execution through the merge path, and recover code execution.

Solo practice

Sign in to submit an answer and save your progress.

Sign in to practice