当前位置:网站首页>[GYCTF2020]EasyThinking
[GYCTF2020]EasyThinking
2022-08-05 03:25:00 【New Reading of the Classic of Tea.】
[GYCTF2020]EasyThinking
Feel free to test to discover web frameworksthinkphp v6.0.0,Arbitrary file manipulation vulnerabilities may exist
Other than that, nothing was found,f12也没有发现什么异常,dirsearch扫描一下发现了www.zip
Access the download file
在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(\"The current username is already registered\");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");
}
}
}
Audit code foundsession:ThinkPhP6 会默认在 /runtime/session 创建一个sess_xxxx格式的session文件,这里的xxxx就是PHPSESSID(32位),And the content of the file issession的内容,也就是key的内容.并且发现了:
if ($userId){
session("UID",$userId);
return redirect("/home/member/index");
}
这里把uid写入当前的session中,That is what we originally constructedPHPSESSID=1111111111111111111111111111.php的session是没有uid的,没办法实现search功能,这里可以把uid赋给session,That is, you can write horses in the search page(Put the package there to modify and put the package,This will upload the horse)
蚁剑连接:http://xxxxxx.node4.buuoj.cn:81/runtime/session/sess_1111111111111111111111111111.php
use on connectiondisabled_functions插件获取flag
至此结束,撒花
边栏推荐
- QT language file production
- [TA-Frost Wolf_may-"Hundred Talents Project"] Graphics 4.3 Real-time Shadow Introduction
- 论治理与创新,2022 开放原子全球开源峰会 OpenAnolis 分论坛圆满落幕
- The usage of try...catch and finally in js
- Leading the highland of digital medicine, Zhongshan Hospital explores to create a "new paradigm" for future hospitals
- 龙蜥社区第二届理事大会圆满召开!理事换届选举、4 位特约顾问加入
- Common open source databases under Linux, how many do you know?
- Package zip is not available, but is referred to by another package.
- 2022.8.4-----leetcode.1403
- rpc-remote procedure call demo
猜你喜欢
【已解决】Unity Coroutinue 协程未有效执行的问题
Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam
静态方法获取配置文件数据
为什么pca分量没有关联
2022高处安装、维护、拆除考试题模拟考试题库及在线模拟考试
Android 面试题——如何徒手写一个非阻塞线程安全队列 ConcurrentLinkedQueue?
【 genius_platform software platform development 】 : seventy-six vs the preprocessor definitions written cow force!!!!!!!!!!(in the other groups conding personnel told so cow force configuration to can
Detailed and comprehensive postman interface testing practical tutorial
Countdown to 2 days|Cloud native Meetup Guangzhou Station, waiting for you!
随机推荐
Common open source databases under Linux, how many do you know?
Ffmpeg - sources analysis
2022.8.4-----leetcode.1403
惨遭打脸:字节某部门竟有这么多测试员
21天学习挑战赛(2)图解设备树的使用
QT MV\MVC structure
shell脚本:for循环与while循环
One hundred - day plan -- -- DAY2 brush
Open-Falcon of operation and maintenance monitoring system
The usage of try...catch and finally in js
The Tanabata copywriting you want has been sorted out for you!
mysql can't Execute, please solve it
2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam
The problem of lack of dynamic library "libtinfo.so.5" in ksql application under UOS system
[Filter tracking] based on matlab unscented Kalman filter inertial navigation + DVL combined navigation [including Matlab source code 2019]
You may use special comments to disable some warnings. 报错解决的三种方式
Web3.0 Dapps——通往未来金融世界的道路
Mathematics - Properties of Summation Symbols
Walter talked little knowledge | "remote passthrough" that something
高项 02 信息系统项目管理基础