Prototype pollution (not to be confused with Parameter pollution)is a little-known bug. Unlike SQL Injection or XSS, Prototype pollution is not well documented. In this blog let’s understand how to exploit this bug in the wild.
In PHP “==” is used to compare values of two variables, but like PHP the “==” comparison is also weird. When comparing a string and an integer using “==”, PHP will try to convert the string to an integer and then do the comparison. Let’s see how we can exploit it,
Now imagine a website with a hardcoded password (not a good idea )
if($_POST['password'] == "password")
What if we provide 0 (integer) as input? As the “password” string has no number in it, the condition will return true.
“abc” == int(0)
RCE allows an attacker to execute code on a vulnerable machine and the CVSS severity level of RCE is critical (well what more do you need than that?)
Note: Check out this blog for more PHP Pwning and to learn why PHP is targeted.
Similar to the system() function in C, system() in PHP executes all the input as shell commands in the machine. If the user inputs are passed into it, this will lead to Code Execution.
$cmd = $_GET[‘cmd’];
PHP documentation warns developers not you use it without an input sanitization function.
I used to think if a device is not exposed to the public internet, it is safe, because bad actors cannot access them as it has NAT (Network Address Translation) and a firewall in front of the device. Well, let us uncover the truth.
Note: A bit about me, I have been hacking for a while now I have gained some good knowledge in web security. To feed my curiosity I have decided to read all the nominated Web Techniques by Portswigger. This blog series will contain my takeaways from my learning.
This blog is not intended for complete…
<>AKA Gowtham Student at SASTRA Deemed university, Core team member DSC SASTRA </>