当前位置:网站首页>[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


至此结束,撒花
边栏推荐
- tensor.nozero(),面具,面具
- JUC thread pool (1): FutureTask use
- 新来个技术总监,把DDD落地的那叫一个高级,服气
- 配置类总结
- 4. PCIe 接口时序
- The principle of NMS and its code realization
- 2022牛客多校第三场 A Ancestor
- Countdown to 1 day!From August 2nd to 4th, I will talk with you about open source and employment!
- 软件测试面试题:BIOS, Fat, IDE, Sata, SCSI, Ntfs windows NT?
- 软件测试面试题:软件测试类型都有哪些?
猜你喜欢

软件基础的理论

B站7月榜单丨飞瓜数据B站UP主排行榜发布!

CNI (Container Network Plugin)

自定义线程池

Countdown to 1 day!From August 2nd to 4th, I will talk with you about open source and employment!

金九银十面试跳槽季;你准备好了吗?

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

5. PCIe official example

JUC线程池(一): FutureTask使用

深度学习:使用nanodet训练自己制作的数据集并测试模型,通俗易懂,适合小白
随机推荐
D - I Hate Non-integer Number (count of selected number dp
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
Countdown to 1 day!From August 2nd to 4th, I will talk with you about open source and employment!
Software testing interview questions: Please draw the seven-layer network structure diagram of OSI and the four-layer structure diagram of TCP/IP?
Lattice PCIe 学习 1
canvas Gaussian blur effect
自定义线程池
matlab 采用描点法进行数据模拟和仿真
GCC:编译时库路径和运行时库路径
ORA-00257
tiup telemetry
The principle of NMS and its code realization
DHCP的工作过程
从一次数据库误操作开始了解MySQL日志【bin log、redo log、undo log】
PCIe 核配置
SV class virtual method of polymorphism
Software testing interview questions: What are the seven-layer network protocols?
Software Testing Interview Questions: About Automated Testing Tools?
Software testing interview questions: What stages should a complete set of tests consist of?
E - Distance Sequence (prefix and optimized dp