Giter Club home page Giter Club logo

bootplus's Introduction

bootplus

  _                 _         _
 | |               | |       | |
 | |__   ___   ___ | |_ _ __ | |
 | '_ \ / _ \ / _ \| __| '_ \| | | | / __|
 | |_) | (_) | (_) | |_| |_) | | |_| \__ \
 |_.__/ \___/ \___/ \__| .__/|_|\__,_|___/
                       | |
                       |_|

star fork GitHub Last Commit issues Author


欢迎使用和Star支持,如使用过程中碰到问题,可以提出Issue 我会尽力完善

介绍

  bootplus是基于SpringBoot + Shiro + MyBatisPlus的权限管理框架

  • 项目集成api接口及文档
  • 准备集成定时任务 -- (开发中)
  • 功能还很少,欢迎各位给我提意见和建议~

SpringBoot1.5.1集成例子请参考bootplus_1.5.1 (老项目只进行Bug修复,不再添加新功能实现)

线上预览

项目结构

bootplus
├── sql  -- 项目SQL语句
│
├── App -- 项目启动类
│
├── common -- 公用模块
|    ├── enums -- 枚举工具类
|    ├── hessian -- Hessian自定义配置
|    ├── serializer -- 自定义序列化实现
|    ├── typehandler -- 自定义MyBatis类型转换器
│
├── config -- 配置信息
|    ├── aop -- Spring AOP深入实现
|    ├── filter -- 过滤器
|    ├── interceptor -- 拦截器
|    ├── listener -- 监听器
│
├── controller -- 控制器
|    ├── admin -- 后台管理员控制器
|    ├── api -- Api接口开放层
│
├── dao -- 数据访问接口及对应的XML文件
│
├── entity -- 数据持久化实体类
|    ├── enums -- 实体枚举类型
│
├── frame -- 框架公用模块
|    ├── cache -- 缓存模块
|    ├── constant -- 常量模块
|    ├── controller -- 控制器模块
|    ├── log -- 日志模块
|    ├── prj -- 项目核心模块
|    ├── spring -- spring模块
│
├── service -- 业务逻辑接口
|    ├── impl -- 业务逻辑接口实现类
│
├── shiro -- Shiro验证框架
│
├── task -- 定时任务
│
├── util -- 工具类
|    ├── db -- 数据库模块
|    ├── encry -- 加解密模块
|    ├── exception -- 自定义异常
|    ├── file -- 文件工具类
|    ├── freemaker -- 自定义FreeMarker标签
|    ├── http -- http模块实现
|    ├── sketch -- 字体、素描、图像
|    ├── spring -- spring公用模块
│
├── resources
|    ├── conf -- 不同环境配置
|    ├── file -- 模板文件
|    ├── jdk_fonts -- JDK字体
|    ├── META-INF -- SpringBoot配置
|    ├── statics -- 静态资源(css、js...)
|    ├── templates -- 页面FreeMarker模版
|    ├── upload -- 上传文件

技术选型

  • 核心框架:Spring Boot 2.3.1
  • 安全框架:Apache Shiro
  • 视图框架:Spring MVC
  • 持久层框架:MyBatisMyBatisPlus
  • 缓存技术:EhCacheRedis
  • 定时器:Quartz
  • 数据库连接池:Druid
  • 日志实现:SLF4J
  • 模版技术:FreeMarker
  • 页面交互:BootStrapLayer

效果截图

本地部署

  • mysql执行sql/bootplus.sql文件,初始化数据
  • 修改application.yml,更新MySQL连接信息,更新Redis连接信息(待实现)
  • 项目访问路径:http://localhost/admin
  • 管理员账号密码:admin/admin

捐赠

  如果感觉对您有帮助,请作者喝杯咖啡吧,请注明您的名字或者昵称,方便作者感谢o( ̄︶ ̄)o

微信 支付宝

LICENSE

LICENSE

bootplus's People

Contributors

joeybling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bootplus's Issues

vulnerability

概述:

我在使用springboot1版本进行二次开发,最后测试时发现本项目以及springboot1版本的项目存在两个比较严重的漏洞,分别是任意文件上传shiro权限绕过

问题:

1.任意文件上传

http://domain/admin/sys/user/avatar.html(漏洞页面,即头像上传处)
url:http://domain/file/upload

原因:
漏洞在文件SysFileController.java中52-100行,头像上传功能处。代码中只对上传的头像判空,并未做任何校验。只需要将webshell写入图片然后抓包修改后缀即可上传成功,点击提交修改的时候暴露了上传地址,直接访问即可getshell。

效果:
b55bf715d9b0c2babf6e7e13abd2d71

c661c665ddd1b5f700d457221098716

getshell

2.shiro权限绕过

payload:http://domain/;/需要授权页面路径

原因:
利用了spring控制器和shiro的路由处理方式不同,当这两个一起使用时,url先进入shiro鉴权,分号起到截断作用,"/;/admin/index.html"变成"/",从而绕过shiro。在spring中,分号路由默认会被去掉,"/;/admin/index.html"当成"/admin/index.html"解析,然后匹配相应路由。详细请参考漏洞编号cve-2020-11989

效果:
shiro1

shiro2

解决方案:

1.文件上传漏洞

在代码中增加上传校验步骤,并将上传路径加密传输。例如:

/**
* 文件校验
*/
private int verifyForm(MultipartFile file){
        // 大小: 0<file<1M
        if (file == null || file.getSize() > 1048576){
            return 0;
        }
        // 文件后缀: .png/.jpg/.jpeg
        fileName = file.getOriginalFilename();
        if (!fileName.contains(".") &&
                !fileName.substring(fileName.lastIndexOf(".") + 1).equals("png") &&
                !fileName.substring(fileName.lastIndexOf(".") + 1).equals("jpg") &&
                !fileName.substring(fileName.lastIndexOf(".") + 1).equals("jpeg")){
            return 0;
        }
        // 文件头: ffd8ff=jpg/jpeg,89504e47=png
        if (!getFile(file).toLowerCase().startsWith("ffd8ff") &&
                !getFile(file).toLowerCase().startsWith("89504e47")){
            return 0;
        }
        // 文件名字是否包含sql注入特征:
        if (Pattern.matches("[()<>/';\"@#!$%^`-]*", fileName)){
            return 0;
        }
        // 文件内容是否为图片
        if (FileTypeHelp.getImageFileType((File) file) == null ||
                !FileTypeHelp.getImageFileType((File) file).equals("PNG") ||
                !FileTypeHelp.getImageFileType((File) file).equals("JPG") ||
                !FileTypeHelp.getImageFileType((File) file).equals("JPEG")){
            return 0;
        }
        return 1;
    }

public R upload(...){
...
// 上传路径加密传输: AES->Base64
        fileContextPath = fileContextPath.replace("/", "+");
        byte[] encrypt = AESUtil.encrypt(fileContextPath.getBytes(StandardCharsets.UTF_8), AESKEY);
        return R.ok().put("filePath", Base64.getEncoder().encodeToString(encrypt));
}

public R updateAvatar(...){
// 解密头像上传地址: Base64->AES
        byte[] decryptd = AESUtil.decrypt(
                Base64.getDecoder().decode(avatarUrl), AESKEY);
        currentUser.setAvatarUrl(new String(decryptd).replace("+", "/"));
        int updateAvatar = sysUserService.updateAvatar(currentUser);
...
}

2.shiro权限绕过

将依赖版本升级至 1.7.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.