当前位置: 首页 > news >正文

越权访问漏洞

V2Board Admin.php 越权访问漏洞 ## 漏洞描述 V2board面板 Admin.php 存在越权访问漏洞,由于部分鉴权代码于v1.6.1版本进行了修改,鉴权方式变为从Redis中获取缓存判定是否存在可以调用…

V2Board Admin.php 越权访问漏洞
漏洞描述
V2board面板 Admin.php 存在越权访问漏洞,由于部分鉴权代码于v1.6.1版本进行了修改,鉴权方式变为从Redis中获取缓存判定是否存在可以调用接口,导致任意用户都可以调用管理员权限的接口获取后台权限

漏洞影响
V2Board v1.6.1

网络测绘
title=“V2Board”

漏洞复现
对比代码更新部分
在这里插入图片描述
与之前的代码相比较,鉴权在 v1.6.1 版本可以通过 auth_data 或 authorizetion 字段来实现验证

<?php namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\Cache; class Admin { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $authorization = $request->input('auth_data') ?? $request->header('authorization'); if (!$authorization) abort(403, '未登录或登陆已过期'); $authData = explode(':', base64_decode($authorization)); if (!Cache::has($authorization)) { if (!isset($authData[1]) || !isset($authData[0])) abort(403, '鉴权失败,请重新登入'); $user = \App\Models\User::where('password', $authData[1]) ->where('email', $authData[0]) ->select([ 'id', 'email', 'is_admin', 'is_staff' ]) ->first(); if (!$user) abort(403, '鉴权失败,请重新登入'); if (!$user->is_admin) abort(403, '鉴权失败,请重新登入'); Cache::put($authorization, $user->toArray(), 3600); } $request->merge([ 'user' => Cache::get($authorization) ]); return $next($request); } } 可以发现主要要通过两次逻辑实现验证,一个是存在 header 中的 authorization 参数,再一个是校验 authorizations 是否存在于 Redis缓存中的 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/a6d8ae0839dd4b858c21c5b2fa068a99.png) 在登陆验证的代码中,成功使用 email 和 password 登陆后会返回 token 和 auth_data ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/218a3910da6e4d968394d6d6112ed644.png) 同时 auth_data 会缓存于 Redis 中 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/8ebd412b191840f3ab244c5a847bb047.png) 由于 Admin.php 文件中只验证了 authrization 是否在 Redis的缓存中,所以当注册任意一个用户进行登陆后获取到 auth_data 就可以任意调用 管理员的接口 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/cb15d375928e40b98ec75b99fe81c481.png) ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/d331bc1cb44a4b7e9bea29f16d6ac66e.png)
http://www.lryc.cn/news/480930.html

相关文章:

  • 【Ant.designpro】上传图片
  • 为何选择Spring AI Alibaba开发智能客服平台?
  • HiveSQL 中判断字段是否包含某个值的方法
  • Nginx简易配置将内网网站ssh转发到外网
  • 【go从零单排】error错误处理及封装
  • 全平台设置jetbrains mono字体
  • 高校体育场管理系统+ssm
  • Python学习从0到1 day27 第三阶段 Spark ② 数据计算Ⅰ
  • Python学习从0到1 day27 第三阶段 Spark ③ 数据计算 Ⅱ
  • 腾讯混元3D模型Hunyuan3D-1.0部署与推理优化指南
  • 基于 PyTorch 从零手搓一个GPT Transformer 对话大模型
  • IDEA构建JavaWeb项目,并通过Tomcat成功运行
  • Mac解决 zsh: command not found: ll
  • 库打包工具 rollup
  • unplugin-vue-components 库作用
  • LinkedList和单双链表。
  • AI与OCR:数字档案馆图像扫描与文字识别技术实现与项目案例
  • Spring boot 读模块项目升级为spring cloud 项目步骤以及问题
  • 时序数据库之influxdb和倒排索引以及LSM-TREE
  • 如何避免消息的重复消费问题?(消息消费时的幂等性)
  • 【Java SE】类与对象
  • 基于springboot的公益服务平台的设计与实现
  • Tomcat(6) 什么是Servlet容器?
  • 用js去除变量里的html标签
  • Vue3+element-plus摘要
  • Android Studio 将项目打包成apk文件
  • 贪心算法day2(最长递增子序列)
  • arcgis pro 学习笔记
  • OpenGL 进阶系列06 - OpenGL变换反馈(TransformFeedback)
  • elementUI 点击弹出时间 date-picker