当前位置:网站首页>[GYCTF2020]EasyThinking
[GYCTF2020]EasyThinking
2022-08-05 00:54:00 【茶经新读.】
[GYCTF2020]EasyThinking

随便测试一下发现网页框架thinkphp v6.0.0,可能存在任意文件操作漏洞
![]()

除此之外没有发现什么东西,f12也没有发现什么异常,dirsearch扫描一下发现了www.zip

访问下载文件
![]()
在web/home/controller有一个Member.php,得到网页源码:
<?php
namespace app\home\controller;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
use app\common\model\User;
use think\facade\Request;
use app\common\controller\Auth;
class Member extends Base
{
public function index()
{
if (session("?UID"))
{
$data = ["uid" => session("UID")];
$record = session("Record");
$recordArr = explode(",", $record);
$username = Db::name("user")->where($data)->value("username");
return View::fetch('member/index',["username" => $username,"record_list" => $recordArr]);
}
return view('member/index',["username" => "Are you Login?","record_list" => ""]);
}
public function login()
{
if (Request::isPost()){
$username = input("username");
$password = md5(input("password"));
$data["username"] = $username;
$data["password"] = $password;
$userId = Db::name("user")->where($data)->value("uid");
$userStatus = Db::name("user")->where($data)->value("status");
if ($userStatus == 1){
return "<script>alert(\"该用户已被禁用,无法登陆\");history.go(-1)</script>";
}
if ($userId){
session("UID",$userId);
return redirect("/home/member/index");
}
return "<script>alert(\"用户名或密码错误\");history.go(-1)</script>";
}else{
return view('login');
}
}
public function register()
{
if (Request::isPost()){
$data = input("post.");
if (!(new Auth)->validRegister($data)){
return "<script>alert(\"当前用户名已注册\");history.go(-1)</script>";
}
$data["password"] = md5($data["password"]);
$data["status"] = 0;
$res = User::create($data);
if ($res){
return redirect('/home/member/login');
}
return "<script>alert(\"注册失败\");history.go(-1)</script>";
}else{
return View("register");
}
}
public function logout()
{
session("UID",NULL);
return "<script>location.href='/home/member/login'</script>";
}
public function updateUser()
{
$data = input("post.");
$update = Db::name("user")->where("uid",session("UID"))->update($data);
if($update){
return json(["code" => 1, "msg" => "修改成功"]);
}
return json(["code" => 0, "msg" => "修改失败"]);
}
public function rePassword()
{
$oldPassword = input("oldPassword");
$password = input("password");
$where["uid"] = session("UID");
$where["password"] = md5($oldPassword);
$res = Db::name("user")->where($where)->find();
if ($res){
$rePassword = User::update(["password" => md5($password)],["uid"=> session("UID")]);
if ($rePassword){
return json(["code" => 1, "msg" => "修改成功"]);
}
return json(["code" => 0, "msg" => "修改失败"]);
}
return json(["code" => 0, "msg" => "原密码错误"]);
}
public function search()
{
if (Request::isPost()){
if (!session('?UID'))
{
return redirect('/home/member/login');
}
$data = input("post.");
$record = session("Record");
if (!session("Record"))
{
session("Record",$data["key"]);
}
else
{
$recordArr = explode(",",$record);
$recordLen = sizeof($recordArr);
if ($recordLen >= 3){
array_shift($recordArr);
session("Record",implode(",",$recordArr) . "," . $data["key"]);
return View::fetch("result",["res" => "There's nothing here"]);
}
}
session("Record",$record . "," . $data["key"]);
return View::fetch("result",["res" => "There's nothing here"]);
}else{
return View("search");
}
}
}审计代码发现了session:ThinkPhP6 会默认在 /runtime/session 创建一个sess_xxxx格式的session文件,这里的xxxx就是PHPSESSID(32位),而文件的内容就是session的内容,也就是key的内容。并且发现了:
if ($userId){
session("UID",$userId);
return redirect("/home/member/index");
}这里把uid写入当前的session中,即我们本来构造的PHPSESSID=1111111111111111111111111111.php的session是没有uid的,没办法实现search功能,这里可以把uid赋给session,即可以在搜索页面写入马(都要放包那里修改并且放包,这样才会上传马)


蚁剑连接:http://xxxxxx.node4.buuoj.cn:81/runtime/session/sess_1111111111111111111111111111.php

连接上利用disabled_functions插件获取flag


至此结束,撒花
边栏推荐
- JUC thread pool (1): FutureTask use
- ORA-00257
- 2022牛客多校训练第二场 H题 Take the Elevator
- 二叉树[全解](C语言)
- Software Testing Interview Questions: What aspects should be considered when designing test cases, i.e. what aspects should different test cases test against?
- B站7月榜单丨飞瓜数据B站UP主排行榜发布!
- Software Testing Interview Questions: What's the Difference Between Manual Testing and Automated Testing?
- 配置类总结
- OPENWIFI实践1:下载并编译SDRPi的HDL源码
- The method of freely controlling concurrency in the sync package in GO
猜你喜欢
](/img/4d/2d81dc75433c23c5ba6b31453396f0.png)
二叉树[全解](C语言)

CNI (Container Network Plugin)

活动推荐 | 快手StreamLake品牌发布会,8月10日一起见证!

Dynamic Programming/Knapsack Problem Summary/Summary - 01 Knapsack, Complete Knapsack

手把手基于YOLOv5定制实现FacePose之《YOLO结构解读、YOLO数据格式转换、YOLO过程修改》

蓝牙Mesh系统开发四 ble mesh网关节点管理

If capturable=False, state_steps should not be CUDA tensors

【机器学习】21天挑战赛学习笔记(二)

5.PCIe官方示例

gorm joint table query - actual combat
随机推荐
VOC格式数据集转COCO格式数据集
第十一章 开关级建模
Theory of Software Fundamentals
FSAWS 的全球基础设施和网络
GCC:头文件和库文件的路径
手把手基于YOLOv5定制实现FacePose之《YOLO结构解读、YOLO数据格式转换、YOLO过程修改》
码率vs.分辨率,哪一个更重要?
2022 Hangzhou Electric Power Multi-School Session 3 Question L Two Permutations
Software Testing Interview Questions: Qualifying Criteria for Software Acceptance Testing?
创意代码表白
How DHCP works
DHCP的工作过程
Software testing interview questions: What are the seven-layer network protocols?
配置类总结
软件基础的理论
Redis visual management software Redis Desktop Manager2022
2022 Nioke Multi-School Training Session 2 J Question Link with Arithmetic Progression
After the staged testing is complete, have you performed defect analysis?
BC(转)[js]js计算两个时间相差天数
5. PCIe official example