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


至此结束,撒花
边栏推荐
- ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionExcep
- CNI(Container Network Plugin)
- Binary tree [full solution] (C language)
- 主库预警日志报错ORA-00270
- 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
- JWT简单介绍
- Helm Chart
- Software test interview questions: BIOS, Fat, IDE, Sata, SCSI, Ntfs windows NT?
- 2022牛客多校第三场 J题 Journey
- PCIe 核配置
猜你喜欢

Theory of Software Fundamentals

10年测试经验,在35岁的生理年龄面前,一文不值

Kubernetes 网络入门

行业现状?互联网公司为什么宁愿花20k招人,也不愿涨薪留住老员工~

仅3w报价B站up主竟带来1200w播放!品牌高性价比B站投放标杆!

Jin Jiu Yin Shi Interview and Job-hopping Season; Are You Ready?

测试工作这么难找吗?今年32,失业2个月,大龄测试工程师接下来该拿什么养家?

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

【TA-霜狼_may-《百人计划》】图形4.3 实时阴影介绍

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionExcep
随机推荐
Binary tree [full solution] (C language)
手把手基于YOLOv5定制实现FacePose之《YOLO结构解读、YOLO数据格式转换、YOLO过程修改》
EL定时刷新页面中的皕杰报表实例
MBps与Mbps区别
2022杭电多校第三场 K题 Taxi
深度学习:使用nanodet训练自己制作的数据集并测试模型,通俗易懂,适合小白
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionExcep
Software Testing Interview Questions: What aspects should be considered when designing test cases, i.e. what aspects should different test cases test against?
Dynamic Programming/Knapsack Problem Summary/Summary - 01 Knapsack, Complete Knapsack
Lattice PCIe Learning 1
【机器学习】21天挑战赛学习笔记(二)
Countdown to 1 day!From August 2nd to 4th, I will talk with you about open source and employment!
oracle create tablespace
linux(centOs7)部署mysql(8.0.20)数据库
僵尸进程和孤儿进程
2022 Multi-school Second Session K Question Link with Bracket Sequence I
ORA-00257
软件基础的理论
Software Testing Interview Questions: Qualifying Criteria for Software Acceptance Testing?
D - I Hate Non-integer Number (count of selected number dp