ssrf訪問內網及url地址過濾繞過
阿新 • • 發佈:2017-10-07
str tps class 127.0.0.1 get match hacker ase 讀取
<?php /*//設置open_basedir ini_set("open_basedir", "/home/shawn/www/index/"); */ if (isset($_GET[‘file‘])) { $file = trim($_GET[‘file‘]); } else { $file = "main.html"; } // disallow ip if (preg_match(‘/^(http:\/\/)+([^\/]+)/i‘, $file, $domain)) { $domain = $domain[2]; if (stripos($domain, ".") !== false) { die("Hacker"); } } if( @file_get_contents($file)!=‘‘){ echo file_get_contents($file); }else{ $str=<<<EOF
如上引用了XDCTF的一道題目的源碼,此題需要get提交file變量,並且正則匹配file變量中的ip地址,點號被過濾。
第一種繞過方式:
file=php://filter/resource=http://127.0.0.1/(這是針對這道題的正則匹配來繞過,觀察正則表達式,是從file變量開始匹配,如此構造payload匹配不到ip地址巧妙繞過)
ssrf訪問內網及url地址過濾繞過