一、代码审计打开靶场,获得以下代码:// php版本:5.4.44 header("Content-type: text/html; charset=utf-8"); highlight_file(__FILE__); class evil{ public $hint; public function __construct($hint){ $this->hint = $hint; } public function __destruct(){ if($this->hint==="hint.php") @$this->hint = base64_encode(file_get_contents($this->hint)); var_dump($this->hint); } function __wakeup() { if ($this->hint != "
index.phpinclude 'tm.php'; // Next step in tm.php if (preg_match('/tm\.php\/*$/i', $_SERVER['PHP_SELF'])) { exit("no way!"); } if (isset($_GET['source'])) { $path = basename($_SERVER['PHP_SELF']); if (!preg_match('/tm.php$/', $path) && !preg_match('/index.php$/', $path)) { exit("nonono!"); } highlight_file($path); exit(); }basename函数漏洞:在使用默认语言环境设置时,basename() 会删除文件名开头的非 ASCII 字符。例如:$path1="/www/%ffindex.php"; echo basename
道格安全CTF-EZSSRF1. 代码审计进入靶场,我们发现一页PHP代码。<?php highlight_file(__FILE__); //find something in flag1.php <-- 提示1 $d = $_GET['d']; $file = $_GET['ctf']; if (filter_var($d, FILTER_VALIDATE_URL)) { $r = parse_url($d); if (isset($file)) { if (strpos($file, "lai") !== false && strpos($file, "ya") !== false) { @include($file . '.php');//解题点一 } else { die("Sorry, you can not pass"); } if (preg_matc
一、代码审计include("flag.php"); highlight_file(__FILE__); class FileHandler { protected $op; protected $filename; protected $content; function __construct() { $op = "1"; $filename = "/tmp/tmpfile"; $content = "Hello World!"; $this->process(); } public function process() { if($this->op == "1") { $this->write(); } else if($this->op == "2") {
一、信息收集打开靶场,发现表单,尝试数据1很明显,这是一道SQL注入题目。验证添加单引号,报错信息证明是字符型注入。再添加and 1=1#,返回正常页面。再尝试1' and 1=2#,返回报错证明存在SQL注入漏洞,尝试联合查询。发现关键词屏蔽,我们注意到where被屏蔽,证明常规注入手法已经失效。二、堆叠注入黑名单没有屏蔽show,尝试使用堆叠注入。查询表名0';show tables;#查询列名0';show columns from words;#,发现正常显示数据。查询列名0';show columns from \`1919810931114514\`;#,发现flag字段。三、爆数据这里爆数据的思路是通过修改查询的表名称来使前台返回数据,也是这个题的考点。我们通过管理数据库命令是无法查询到flag中的内容的,我们可以考虑通过rename命令,将1919810931114514表重命名为words表,再为其添加一个id列,保证我们可以正常查询到其中内容。payload:1'; rename table words to word1; rename table `1919810
Equinox
一个乐于分享的网安人