当前位置:网站首页>[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
至此结束,撒花
边栏推荐
- 软件测试面试题:设计测试用例时应该考虑哪些方面,即不同的测试用例针对那些方面进行测试?
- If capturable=False, state_steps should not be CUDA tensors
- (十七)51单片机——AD/DA转换
- After the staged testing is complete, have you performed defect analysis?
- GCC:编译时库路径和运行时库路径
- 如何用 Solidity 创建一个“Hello World”智能合约
- 2022 Hangzhou Electric Multi-School 1004 Ball
- PCIe 核配置
- 软件测试面试题:软件测试类型都有哪些?
- 仅3w报价B站up主竟带来1200w播放!品牌高性价比B站投放标杆!
猜你喜欢
JUC线程池(一): FutureTask使用
oracle create user
Introduction to JVM class loading
张驰咨询:揭晓六西格玛管理(6 Sigma)长盛不衰的秘密
Jin Jiu Yin Shi Interview and Job-hopping Season; Are You Ready?
创意代码表白
QSunSync Qiniu cloud file synchronization tool, batch upload
Lattice PCIe Learning 1
Creative code confession
Interview summary: Why do interviewers in large factories always ask about the underlying principles of Framework?
随机推荐
MongoDB搭建及基础操作
FSAWS 的全球基础设施和网络
SV class virtual method of polymorphism
配置类总结
创意代码表白
Matlab uses plotting method for data simulation and simulation
金九银十面试跳槽季;你准备好了吗?
2022 The Third J Question Journey
Software testing interview questions: Have you used some tools for software defect (Bug) management in your past software testing work? If so, please describe the process of software defect (Bug) trac
深度学习训练前快速批量修改数据集中的图片名
Jin Jiu Yin Shi Interview and Job-hopping Season; Are You Ready?
Opencv——视频跳帧处理
Software Testing Interview Questions: What do you think about software process improvement? Is there something that needs improvement in the enterprise you have worked for? What do you expect the idea
阶段性测试完成后,你进行缺陷分析了么?
2022牛客多校第三场 A Ancestor
If capturable=False, state_steps should not be CUDA tensors
2022 Hangzhou Electric Power Multi-School Session 3 K Question Taxi
Inter-process communication and inter-thread communication
Software Testing Interview Questions: What is Software Testing?The purpose and principle of software testing?
二叉树[全解](C语言)