随笔分类 -  CTF之命令执行

摘要:代码还是那个代码,这次没有写文件的权限了。这次思路是:我们先POST一个文件,然后执行php临时文件目录下的我们上传的文件即可。 该文件一般存放在/tmp/??????下。 脚本如下: import requests import time url = "http://98985a2d-d3a6-4 阅读全文
posted @ 2022-11-08 22:01 hithub 阅读(97) 评论(0) 推荐(0) 编辑
摘要:$cmd = $_POST['cmd']; if(strlen($cmd) <= 7){ shell_exec($cmd); } 脚本如下: import requests import time url = "http://c85490d2-f0fc-4ed5-86a1-6ee92355718a. 阅读全文
posted @ 2022-11-08 21:57 hithub 阅读(105) 评论(0) 推荐(0) 编辑
摘要:if(!isset($_GET['c'])){ show_source(__FILE__); }else{ //例子 c=20-1 $content = $_GET['c']; if (strlen($content) >= 80) { die("太长了不会算"); } $blacklist = [ 阅读全文
posted @ 2022-11-01 17:44 hithub 阅读(120) 评论(0) 推荐(0) 编辑
摘要:full以后发现题目给了如下字符(几个特殊字符+大写英文字母) 我们利用系统环境变量来构造我们需要的命令: ${PATH:~A}${PWD:~A}${IFS}???????? nl flag.php 自己本地试试就明白命令了。 阅读全文
posted @ 2022-10-31 22:44 hithub 阅读(152) 评论(0) 推荐(0) 编辑
摘要:$ffi = FFI::cdef("int system(const char *command);"); $a='/readflag > 1.txt'; $ffi->system($a); 阅读全文
posted @ 2022-10-31 22:11 hithub 阅读(37) 评论(0) 推荐(0) 编辑
摘要:if(isset($_POST['c'])){ $c= $_POST['c']; eval($c); $s = ob_get_contents(); ob_end_clean(); echo preg_replace("/[0-9]|[a-z]/i","?",$s); }else{ highligh 阅读全文
posted @ 2022-10-31 21:59 hithub 阅读(346) 评论(0) 推荐(0) 编辑
摘要:<?php error_reporting(0); if (isset($_GET['hint'])) { highlight_file(__FILE__); } if (isset($_POST['rce'])) { $rce = $_POST['rce']; if (strlen($rce) < 阅读全文
posted @ 2022-10-29 22:14 hithub 阅读(357) 评论(0) 推荐(0) 编辑
摘要:<?php highlight_file(__FILE__); class ease{ private $method; private $args; function __construct($method, $args) { $this->method = $method; $this->arg 阅读全文
posted @ 2022-10-22 11:02 hithub 阅读(442) 评论(0) 推荐(0) 编辑
摘要:if(isset($_POST['ctf'])){ $ctfshow = $_POST['ctf']; if(!preg_match('/^[a-z0-9_]*$/isD',$ctfshow)) { $ctfshow('',$_GET['show']); } } 首先第一个知识点: 正则绕过很明显, 阅读全文
posted @ 2022-10-20 19:34 hithub 阅读(412) 评论(0) 推荐(0) 编辑
摘要:if(isset($_GET['v1']) && isset($_GET['v2']) && isset($_GET['v3'])){ $v1 = (String)$_GET['v1']; $v2 = (String)$_GET['v2']; $v3 = (String)$_GET['v3']; i 阅读全文
posted @ 2022-10-20 19:00 hithub 阅读(85) 评论(0) 推荐(0) 编辑
摘要:if(isset($_GET['v1']) && isset($_GET['v2']) && isset($_GET['v3'])){ $v1 = (String)$_GET['v1']; $v2 = (String)$_GET['v2']; $v3 = (String)$_GET['v3']; i 阅读全文
posted @ 2022-10-20 17:08 hithub 阅读(278) 评论(0) 推荐(0) 编辑
摘要:function check($x){ if(preg_match('/\\$|\.|\!|\@|\#|\%|\^|\&|\*|\?|\{|\}|\>|\<|nc|wget|exec|bash|sh|netcat|grep|base64|rev|curl|wget|gcc|php|python|pi 阅读全文
posted @ 2022-10-20 14:23 hithub 阅读(264) 评论(0) 推荐(0) 编辑
摘要:if($F = @$_GET['F']){ if(!preg_match('/system|nc|wget|exec|passthru|netcat/i', $F)){ eval(substr($F,0,6)); }else{ die("6个字母都还不够呀?!"); } } get传参 F=`$F 阅读全文
posted @ 2022-10-20 11:05 hithub 阅读(512) 评论(0) 推荐(0) 编辑
摘要:<?php highlight_file(__FILE__); if(isset($_GET['url'])) { $url=$_GET['url']; if(preg_match('/bash|nc|wget|ping|ls|cat|more|less|phpinfo|base64|echo|ph 阅读全文
posted @ 2022-10-09 22:32 hithub 阅读(658) 评论(0) 推荐(0) 编辑
摘要:<?php //php5.5.9 $stuff = $_POST["stuff"]; $array = ['admin', 'user']; if($stuff $array && $stuff[0] != 'admin') { $num= $_POST["num"]; if (preg_match 阅读全文
posted @ 2022-10-07 20:00 hithub 阅读(162) 评论(0) 推荐(0) 编辑
摘要:第一步通过index.php?page=php://filter/convert.base64-encode/resource=index.php来获取源码, 第二步审计源代码发现了 这里进入if只需在http请求头中加入 X-Forwarded-For:127.0.0.1 即可。 然后发现了pre 阅读全文
posted @ 2022-09-28 15:33 hithub 阅读(146) 评论(0) 推荐(0) 编辑
摘要:该题目通过扫面后台目录发现存在git泄漏,用GitHack跑完后发现了该题目的源码,漏洞利用在assert函数任意代码执行,如下图。 我们传入payload:?page=abc') or system("cat templates/flag.php");// 则变为 assert("file_exi 阅读全文
posted @ 2022-09-28 15:10 hithub 阅读(381) 评论(0) 推荐(0) 编辑
摘要:二、PHP系统命令执行函数 1.system('ls'); 2.echo `ls`; 3.passthru("whoami"); 4.echo exec("whoami"); 5.echo shell_exec("whoami");//同反引号 6.popen();//popen('echo "te 阅读全文
posted @ 2022-09-27 18:08 hithub 阅读(2902) 评论(0) 推荐(1) 编辑
摘要:一、查看文件内容 1.cat 2.nl 3.tac 4.rev 倒序输出 5.more:一页一页的显示档案内容 6.less:与 more 类似 head:查看头几行 7.tail:查看尾几行 8.od:以二进制的方式读取档案内容 9.vi:一种编辑器,这个也可以查看 10.vim:一种编辑器,这个 阅读全文
posted @ 2022-08-10 13:26 hithub 阅读(280) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示