【红日Day2-CTF】filter_var函数缺陷

练习记录

复现代码:

index.php

<?php 
$url = $_GET['url'];
if(isset($url) && filter_var($url, FILTER_VALIDATE_URL)){
    $site_info = parse_url($url);
    if(preg_match('/sec-pz.com$/',$site_info['host'])){
        exec('curl "'.$site_info['host'].'"', $result);
        echo "

You have curl {$site_info['host']} successfully!